Skip to content

Commit

Permalink
ip multicast debug: fix strings vs defines
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris Torek authored and kmoore134 committed Apr 17, 2017
1 parent 76f63e4 commit f768c70
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions sys/netinet/in_mcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -2920,7 +2920,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)
Expand All @@ -2932,16 +2939,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)
Expand Down

0 comments on commit f768c70

Please sign in to comment.