svn commit: r347339 - stable/11/sys/netinet
Alexander Motin
mav at FreeBSD.org
Wed May 8 15:24:07 UTC 2019
Author: mav
Date: Wed May 8 15:24:05 2019
New Revision: 347339
URL: https://svnweb.freebsd.org/changeset/base/347339
Log:
MFC r346898: ip multicast debug: fix strings vs defines
Turning on multicast debug made multicast failure worse
because the strings and #define values no longer matched
up. Fix them, and make sure they stay matched-up.
Modified:
stable/11/sys/netinet/in_mcast.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/netinet/in_mcast.c
==============================================================================
--- stable/11/sys/netinet/in_mcast.c Wed May 8 15:23:45 2019 (r347338)
+++ stable/11/sys/netinet/in_mcast.c Wed May 8 15:24:05 2019 (r347339)
@@ -2935,7 +2935,14 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_ARGS)
#if defined(KTR) && (KTR_COMPILE & KTR_IGMPV3)
-static const char *inm_modestrs[] = { "un", "in", "ex" };
+static const char *inm_modestrs[] = {
+ [MCAST_UNDEFINED] = "un",
+ [MCAST_INCLUDE] = "in",
+ [MCAST_EXCLUDE] = "ex",
+};
+_Static_assert(MCAST_UNDEFINED == 0 &&
+ MCAST_EXCLUDE + 1 == nitems(inm_modestrs),
+ "inm_modestrs: no longer matches #defines");
static const char *
inm_mode_str(const int mode)
@@ -2947,16 +2954,20 @@ inm_mode_str(const int mode)
}
static const char *inm_statestrs[] = {
- "not-member",
- "silent",
- "idle",
- "lazy",
- "sleeping",
- "awakening",
- "query-pending",
- "sg-query-pending",
- "leaving"
+ [IGMP_NOT_MEMBER] = "not-member",
+ [IGMP_SILENT_MEMBER] = "silent",
+ [IGMP_REPORTING_MEMBER] = "reporting",
+ [IGMP_IDLE_MEMBER] = "idle",
+ [IGMP_LAZY_MEMBER] = "lazy",
+ [IGMP_SLEEPING_MEMBER] = "sleeping",
+ [IGMP_AWAKENING_MEMBER] = "awakening",
+ [IGMP_G_QUERY_PENDING_MEMBER] = "query-pending",
+ [IGMP_SG_QUERY_PENDING_MEMBER] = "sg-query-pending",
+ [IGMP_LEAVING_MEMBER] = "leaving",
};
+_Static_assert(IGMP_NOT_MEMBER == 0 &&
+ IGMP_LEAVING_MEMBER + 1 == nitems(inm_statestrs),
+ "inm_statetrs: no longer matches #defines");
static const char *
inm_state_str(const int state)
More information about the svn-src-all
mailing list