diff --git a/net/mld/Kconfig b/net/mld/Kconfig index d57b7a2183..a8256f77d3 100644 --- a/net/mld/Kconfig +++ b/net/mld/Kconfig @@ -16,5 +16,22 @@ menuconfig NET_MLD if NET_MLD +config NET_MLD_DEBUG + bool "Force MLD debug" + default n + depends on DEBUG_ERROR + ---help--- + Normally, MLD debug output is controlled by CONFIG_DEBUG_NET_*. + This option will force debug output from MLD files even if network + debug is not enabled. This feature does still depend on global + debug output CONFIG_DEBUG_INFO, CONFIG_DEBUG_WARN, and + CONFIG_DEBUG_ERROR. + +config NET_MLD_TXDUMP + bool "Enable TX Packet Dump" + default n + ---help--- + Dump the content of all outgoing packets. + endif # NET_MLD endif # NET_ICMPv6 diff --git a/net/mld/mld.h b/net/mld/mld.h index ffbb6cc4f5..07884ce34b 100644 --- a/net/mld/mld.h +++ b/net/mld/mld.h @@ -109,6 +109,7 @@ #include #include #include +#include #include #include @@ -152,6 +153,30 @@ #define IS_MLD_SCHEDMSG(f) (((f) & MLD_SCHEDMSG) != 0) #define IS_MLD_WAITMSG(f) (((f) & MLD_WAITMSG) != 0) +/* Debug ********************************************************************/ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_NET_MLD_DEBUG +# define mlderr(format, ...) _err(format, ##__VA_ARGS__) +# define mldwarn(format, ...) _warn(format, ##__VA_ARGS__) +# define mldinfo(format, ...) _info(format, ##__VA_ARGS__) +# else +# define mlderr(format, ...) nerr(format, ##__VA_ARGS__) +# define mldwarn(format, ...) nwarn(format, ##__VA_ARGS__) +# define mldinfo(format, ...) ninfo(format, ##__VA_ARGS__) +# endif +#else +# ifdef CONFIG_NET_MLD_DEBUG +# define mlderr _err +# define mldwarn _warn +# define mldinfo _info +# else +# define mlderr nerr +# define mldwarn nwarn +# define mldinfo ninfo +# endif +#endif + /**************************************************************************** * Public Type Definitions ****************************************************************************/ diff --git a/net/mld/mld_done.c b/net/mld/mld_done.c index 97c054a053..a95c608758 100644 --- a/net/mld/mld_done.c +++ b/net/mld/mld_done.c @@ -85,7 +85,7 @@ int mld_done_v1(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6 = IPv6BUF; FAR struct mld_group_s *group; - ninfo("Version 1 Multicast Listener Done\n"); + mldinfo("Version 1 Multicast Listener Done\n"); MLD_STATINCR(g_netstats.mld.done_received); /* The done message is sent to the link-local, all routers multicast @@ -115,7 +115,7 @@ int mld_done_v1(FAR struct net_driver_s *dev, #else /* We are not a router so we can just ignore Done messages */ - ninfo("Version 1 Multicast Listener Done\n"); + mldinfo("Version 1 Multicast Listener Done\n"); MLD_STATINCR(g_netstats.mld.done_received); #endif diff --git a/net/mld/mld_group.c b/net/mld/mld_group.c index 07e6d503a5..b34e442ab8 100644 --- a/net/mld/mld_group.c +++ b/net/mld/mld_group.c @@ -60,36 +60,6 @@ #ifdef CONFIG_NET_MLD -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Debug ********************************************************************/ - -#undef MLD_GRPDEBUG /* Define to enable detailed MLD group debug */ - -#ifndef CONFIG_NET_MLD -# undef MLD_GRPDEBUG -#endif - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef MLD_GRPDEBUG -# define grperr(format, ...) nerr(format, ##__VA_ARGS__) -# define grpinfo(format, ...) ninfo(format, ##__VA_ARGS__) -# else -# define grperr(x...) -# define grpinfo(x...) -# endif -#else -# ifdef MLD_GRPDEBUG -# define grperr nerr -# define grpinfo ninfo -# else -# define grperr (void) -# define grpinfo (void) -# endif -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -110,10 +80,10 @@ FAR struct mld_group_s *mld_grpalloc(FAR struct net_driver_s *dev, { FAR struct mld_group_s *group; - ninfo("addr: %08x dev: %p\n", *addr, dev); + mldinfo("addr: %08x dev: %p\n", *addr, dev); group = (FAR struct mld_group_s *)kmm_zalloc(sizeof(struct mld_group_s)); - grpinfo("group: %p\n", group); + mldinfo("group: %p\n", group); /* Check if we successfully allocated a group structure */ @@ -186,23 +156,23 @@ FAR struct mld_group_s *mld_grpfind(FAR struct net_driver_s *dev, { FAR struct mld_group_s *group; - grpinfo("Searching for addr %08x\n", (int)*addr); + mldinfo("Searching for addr %08x\n", (int)*addr); for (group = (FAR struct mld_group_s *)dev->d_mld_grplist.head; group; group = group->next) { - grpinfo("Compare: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - group->grpaddr[0], group->grpaddr[1], group->grpaddr[2], - group->grpaddr[3], group->grpaddr[4], group->grpaddr[5], - group->grpaddr[6], group->grpaddr[7]); - grpinfo("Versus: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - addr[0], addr[1], addr[2], addr[3], - addr[4], addr[5], addr[6], addr[7]); + mldinfo("Compare: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + group->grpaddr[0], group->grpaddr[1], group->grpaddr[2], + group->grpaddr[3], group->grpaddr[4], group->grpaddr[5], + group->grpaddr[6], group->grpaddr[7]); + mldinfo("Versus: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + addr[0], addr[1], addr[2], addr[3], + addr[4], addr[5], addr[6], addr[7]); if (net_ipv6addr_cmp(group->grpaddr, addr)) { - grpinfo("Match!\n"); + mldinfo("Match!\n"); DEBUGASSERT(group->ifindex == dev->d_ifindex); break; } @@ -225,13 +195,13 @@ FAR struct mld_group_s *mld_grpallocfind(FAR struct net_driver_s *dev, { FAR struct mld_group_s *group = mld_grpfind(dev, addr); - grpinfo("group: %p addr: %08x\n", group, (int)*addr); + mldinfo("group: %p addr: %08x\n", group, (int)*addr); if (!group) { group = mld_grpalloc(dev, addr); } - grpinfo("group: %p\n", group); + mldinfo("group: %p\n", group); return group; } @@ -248,7 +218,7 @@ FAR struct mld_group_s *mld_grpallocfind(FAR struct net_driver_s *dev, void mld_grpfree(FAR struct net_driver_s *dev, FAR struct mld_group_s *group) { - grpinfo("Free: %p flags: %02x\n", group, group->flags); + mldinfo("Free: %p flags: %02x\n", group, group->flags); /* Cancel the timers */ @@ -270,7 +240,7 @@ void mld_grpfree(FAR struct net_driver_s *dev, FAR struct mld_group_s *group) /* Then release the group structure resources. */ - grpinfo("Call sched_kfree()\n"); + mldinfo("Call sched_kfree()\n"); kmm_free(group); } diff --git a/net/mld/mld_initialize.c b/net/mld/mld_initialize.c index 98f2a7a677..d850e0450c 100644 --- a/net/mld/mld_initialize.c +++ b/net/mld/mld_initialize.c @@ -76,7 +76,7 @@ void mld_initialize(void) void mld_devinit(struct net_driver_s *dev) { - ninfo("MLD initializing dev %p\n", dev); + mldinfo("MLD initializing dev %p\n", dev); DEBUGASSERT(dev->d_mld_grplist.head == NULL); /* Add the all nodes address to the group */ diff --git a/net/mld/mld_join.c b/net/mld/mld_join.c index 3f414bb978..28c6612a70 100644 --- a/net/mld/mld_join.c +++ b/net/mld/mld_join.c @@ -100,20 +100,20 @@ int mld_joingroup(FAR const struct ipv6_mreq *mrec) if (dev == NULL) { - nerr("ERROR: No device for this interface index: %u\n", - mrec->ipv6mr_interface); + mlderr("ERROR: No device for this interface index: %u\n", + mrec->ipv6mr_interface); return -ENODEV; } - ninfo("Join group: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - mrec->ipv6mr_multiaddr.s6_addr16[0], - mrec->ipv6mr_multiaddr.s6_addr16[1], - mrec->ipv6mr_multiaddr.s6_addr16[2], - mrec->ipv6mr_multiaddr.s6_addr16[3], - mrec->ipv6mr_multiaddr.s6_addr16[4], - mrec->ipv6mr_multiaddr.s6_addr16[5], - mrec->ipv6mr_multiaddr.s6_addr16[5], - mrec->ipv6mr_multiaddr.s6_addr16[7]); + mldinfo("Join group: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + mrec->ipv6mr_multiaddr.s6_addr16[0], + mrec->ipv6mr_multiaddr.s6_addr16[1], + mrec->ipv6mr_multiaddr.s6_addr16[2], + mrec->ipv6mr_multiaddr.s6_addr16[3], + mrec->ipv6mr_multiaddr.s6_addr16[4], + mrec->ipv6mr_multiaddr.s6_addr16[5], + mrec->ipv6mr_multiaddr.s6_addr16[5], + mrec->ipv6mr_multiaddr.s6_addr16[7]); /* Check if a this address is already in the group */ @@ -122,7 +122,7 @@ int mld_joingroup(FAR const struct ipv6_mreq *mrec) { /* No... allocate a new entry */ - ninfo("Allocate new group entry\n"); + mldinfo("Allocate new group entry\n"); group = mld_grpalloc(dev, mrec->ipv6mr_multiaddr.s6_addr16); if (group == NULL) @@ -140,7 +140,7 @@ int mld_joingroup(FAR const struct ipv6_mreq *mrec) ret = mld_waitmsg(group, MLD_SEND_V2REPORT); if (ret < 0) { - nerr("ERROR: Failed to schedule Report: %d\n", ret); + mlderr("ERROR: Failed to schedule Report: %d\n", ret); mld_grpfree(dev, group); return ret; } diff --git a/net/mld/mld_leave.c b/net/mld/mld_leave.c index 6c7412bf3b..608af4513f 100644 --- a/net/mld/mld_leave.c +++ b/net/mld/mld_leave.c @@ -105,22 +105,22 @@ int mld_leavegroup(FAR const struct ipv6_mreq *mrec) return -ENODEV; } - ninfo("Leave group: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - mrec->ipv6mr_multiaddr.s6_addr16[0], - mrec->ipv6mr_multiaddr.s6_addr16[1], - mrec->ipv6mr_multiaddr.s6_addr16[2], - mrec->ipv6mr_multiaddr.s6_addr16[3], - mrec->ipv6mr_multiaddr.s6_addr16[4], - mrec->ipv6mr_multiaddr.s6_addr16[5], - mrec->ipv6mr_multiaddr.s6_addr16[5], - mrec->ipv6mr_multiaddr.s6_addr16[7]); + mldinfo("Leave group: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + mrec->ipv6mr_multiaddr.s6_addr16[0], + mrec->ipv6mr_multiaddr.s6_addr16[1], + mrec->ipv6mr_multiaddr.s6_addr16[2], + mrec->ipv6mr_multiaddr.s6_addr16[3], + mrec->ipv6mr_multiaddr.s6_addr16[4], + mrec->ipv6mr_multiaddr.s6_addr16[5], + mrec->ipv6mr_multiaddr.s6_addr16[5], + mrec->ipv6mr_multiaddr.s6_addr16[7]); /* Find the entry corresponding to the address leaving the group */ group = mld_grpfind(dev, mrec->ipv6mr_multiaddr.s6_addr16); if (group != NULL) { - ninfo("Leaving group: %p\n", group); + mldinfo("Leaving group: %p\n", group); /* Cancel the timers and discard any queued Reports. Canceling the * timer will prevent any new Reports from being sent; clearing the @@ -150,14 +150,14 @@ int mld_leavegroup(FAR const struct ipv6_mreq *mrec) if (IS_MLD_LASTREPORT(group->flags)) { - ninfo("Schedule Done message\n"); + mldinfo("Schedule Done message\n"); MLD_STATINCR(g_netstats.mld.done_sched); ret = mld_waitmsg(group, MLD_SEND_V1DONE); if (ret < 0) { - nerr("ERROR: Failed to schedule message: %d\n", ret); + mlderr("ERROR: Failed to schedule message: %d\n", ret); } } @@ -173,7 +173,7 @@ int mld_leavegroup(FAR const struct ipv6_mreq *mrec) /* Return ENOENT if the address is not a member of the group */ - ninfo("Return -ENOENT\n"); + mldinfo("Return -ENOENT\n"); return -ENOENT; } diff --git a/net/mld/mld_mcastmac.c b/net/mld/mld_mcastmac.c index e01d9c85e8..abfa20c550 100644 --- a/net/mld/mld_mcastmac.c +++ b/net/mld/mld_mcastmac.c @@ -67,9 +67,9 @@ static void mld_mcastmac(FAR const net_ipv6addr_t ipaddr, FAR uint8_t *mac) { FAR uint8_t *ipaddr8 = (FAR uint8_t *)ipaddr; - ninfo("Mcast IP: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], - ipaddr[4], ipaddr[5], ipaddr[6], ipaddr[7]); + mldinfo("Mcast IP: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], + ipaddr[4], ipaddr[5], ipaddr[6], ipaddr[7]); /* For the MAC address by insert the low 32 Bits of the multicast IPv6 * Address into the Ethernet Address . This mapping is from the IETF @@ -83,8 +83,8 @@ static void mld_mcastmac(FAR const net_ipv6addr_t ipaddr, FAR uint8_t *mac) mac[2] = ipaddr8[14]; /* Bits: 112-119 */ mac[2] = ipaddr8[15]; /* Bits: 120-127 */ - ninfo("Mcast MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + mldinfo("Mcast MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } /**************************************************************************** @@ -104,7 +104,7 @@ void mld_addmcastmac(FAR struct net_driver_s *dev, { uint8_t mcastmac[6]; - ninfo("Adding MAC address filter\n"); + mldinfo("Adding MAC address filter\n"); if (dev->d_addmac != NULL) { @@ -126,7 +126,7 @@ void mld_removemcastmac(FAR struct net_driver_s *dev, { uint8_t mcastmac[6]; - ninfo("Removing MAC address filter\n"); + mldinfo("Removing MAC address filter\n"); if (dev->d_rmmac != NULL) { diff --git a/net/mld/mld_msg.c b/net/mld/mld_msg.c index 65e205e254..0c00630bc2 100644 --- a/net/mld/mld_msg.c +++ b/net/mld/mld_msg.c @@ -77,8 +77,8 @@ int mld_schedmsg(FAR struct mld_group_s *group, uint8_t msgtype) dev = netdev_findbyindex(group->ifindex); if (dev == NULL) { - nerr("ERROR: No device for this interface index: %u\n", - group->ifindex); + mlderr("ERROR: No device for this interface index: %u\n", + group->ifindex); return -ENODEV; } @@ -117,7 +117,7 @@ int mld_waitmsg(FAR struct mld_group_s *group, uint8_t msgtype) ret = mld_schedmsg(group, msgtype); if (ret < 0) { - nerr("ERROR: Failed to schedule the message: %d\n", ret); + mlderr("ERROR: Failed to schedule the message: %d\n", ret); goto errout; } diff --git a/net/mld/mld_poll.c b/net/mld/mld_poll.c index fedd873de8..ad3802b93f 100644 --- a/net/mld/mld_poll.c +++ b/net/mld/mld_poll.c @@ -126,7 +126,7 @@ void mld_poll(FAR struct net_driver_s *dev) if (IS_MLD_WAITMSG(group->flags)) { - ninfo("Awakening waiter\n"); + mldinfo("Awakening waiter\n"); nxsem_post(&group->sem); } diff --git a/net/mld/mld_query.c b/net/mld/mld_query.c index c4a6138cb3..905537103d 100644 --- a/net/mld/mld_query.c +++ b/net/mld/mld_query.c @@ -291,7 +291,7 @@ int mld_query(FAR struct net_driver_s *dev, unsigned int mldsize; bool mldv1 = false; - ninfo("Multicast Listener Query\n"); + mldinfo("Multicast Listener Query\n"); #if 0 /* Not used */ /* Max Response Delay. The Max Response Code field specifies the maximum @@ -318,7 +318,7 @@ int mld_query(FAR struct net_driver_s *dev, } else if (mldsize < SIZEOF_MLD_MCAST_LISTEN_QUERY_S(0)) { - nwarn("WARNING: Invalid size for MLD query: %u\n", mldsize); + mldinfo("WARNING: Invalid size for MLD query: %u\n", mldsize); dev->d_len = 0; return -EINVAL; @@ -366,7 +366,7 @@ int mld_query(FAR struct net_driver_s *dev, /* This is the general query */ - ninfo("General multicast query\n"); + mldinfo("General multicast query\n"); MLD_STATINCR(g_netstats.mld.gmq_query_received); /* Two passes through the member list. On the first, just check if we @@ -391,8 +391,8 @@ int mld_query(FAR struct net_driver_s *dev, if (!mldv1 && IS_MLD_V1COMPAT(member->flags)) { - nwarn("WARNING: MLDv2 query received in MLDv1 " - "compatibility mode\n"); + mldinfo("WARNING: MLDv2 query received in MLDv1 " + "compatibility mode\n"); } } } @@ -448,7 +448,7 @@ int mld_query(FAR struct net_driver_s *dev, group = mld_grpfind(dev, query->grpaddr); if (group != NULL) { - ninfo("We are not a member of this group\n"); + mldinfo("We are not a member of this group\n"); dev->d_len = 0; return -ENOENT; @@ -462,7 +462,7 @@ int mld_query(FAR struct net_driver_s *dev, if (!mldv1 && IS_MLD_V1COMPAT(group->flags)) { - nwarn("WARNING: MLDv2 query received in MLDv1 compatibility mode\n"); + mldinfo("WARNING: MLDv2 query received in MLDv1 compatibility mode\n"); } /* Check for Multicast Address Specific Query */ @@ -471,12 +471,12 @@ int mld_query(FAR struct net_driver_s *dev, { if (query->nsources == 0) { - ninfo("Multicast Address Specific Query\n"); + mldinfo("Multicast Address Specific Query\n"); MLD_STATINCR(g_netstats.mld.mas_query_received); } else { - ninfo("Multicast Address and Source Specific Query\n"); + mldinfo("Multicast Address and Source Specific Query\n"); MLD_STATINCR(g_netstats.mld.massq_query_received); } @@ -493,7 +493,7 @@ int mld_query(FAR struct net_driver_s *dev, else if (net_ipv6addr_cmp(ipv6->destipaddr, dev->d_ipv6addr)) { - ninfo("Unicast query\n"); + mldinfo("Unicast query\n"); MLD_STATINCR(g_netstats.mld.ucast_query_received); /* Check MLDv1 compatibility mode */ @@ -506,7 +506,7 @@ int mld_query(FAR struct net_driver_s *dev, } else { - nwarn("WARNING: Unhandled query\n"); + mldinfo("WARNING: Unhandled query\n"); MLD_STATINCR(g_netstats.mld.bad_query_received); /* Need to set d_len to zero to indication that nothing is being sent */ diff --git a/net/mld/mld_report.c b/net/mld/mld_report.c index 6ef08999d2..b8c222b97f 100644 --- a/net/mld/mld_report.c +++ b/net/mld/mld_report.c @@ -69,9 +69,9 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr) * destipaddr idenfies the group. */ - ninfo("grpaddr: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - grpaddr[0], grpaddr[1], grpaddr[2], grpaddr[3], - grpaddr[4], grpaddr[5], grpaddr[6], grpaddr[7]); + mldinfo("grpaddr: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + grpaddr[0], grpaddr[1], grpaddr[2], grpaddr[3], + grpaddr[4], grpaddr[5], grpaddr[6], grpaddr[7]); /* Find the group (or create a new one) using the incoming IP address. * If we are not a router (and I assume we are not), then can ignore @@ -84,7 +84,7 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr) group = mld_grpallocfind(dev, grpaddr); if (group == NULL) { - nerr("ERROR: Failed to allocate group\n"); + mlderr("ERROR: Failed to allocate group\n"); return -ENOMEM; } @@ -92,7 +92,7 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr) group = mld_grpfind(dev, grpaddr); if (group == NULL) { - nwarn("WARNING: Ignoring group. We are not a member\n"); + mldinfo("WARNING: Ignoring group. We are not a member\n"); return -ENOENT; } #endif @@ -145,7 +145,7 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr) int mld_report_v1(FAR struct net_driver_s *dev, FAR const struct mld_mcast_listen_report_v1_s *report) { - ninfo("Version 1 Multicast Listener Report\n"); + mldinfo("Version 1 Multicast Listener Report\n"); DEBUGASSERT(dev != NULL && report != NULL); MLD_STATINCR(g_netstats.mld.v1report_received); @@ -178,7 +178,7 @@ int mld_report_v2(FAR struct net_driver_s *dev, int ret = -ENOENT; int i; - ninfo("Version 2 Multicast Listener Report\n"); + mldinfo("Version 2 Multicast Listener Report\n"); DEBUGASSERT(dev != NULL && report != NULL); MLD_STATINCR(g_netstats.mld.v2report_received); diff --git a/net/mld/mld_send.c b/net/mld/mld_send.c index 91a1be6911..96ad45f50d 100644 --- a/net/mld/mld_send.c +++ b/net/mld/mld_send.c @@ -62,13 +62,7 @@ /* Debug */ -#undef MLD_DUMPPKT /* Define to enable packet dump */ - -#ifndef CONFIG_DEBUG_NET -# undef MLD_DUMPPKT -#endif - -#ifdef MLD_DUMPPKT +#ifdef CONFIG_NET_MLD_TXDUMP # define mld_dumppkt(b,n) lib_dumpbuffer("MLD", (FAR const uint8_t*)(b), (n)) #else # define mld_dumppkt(b,n) @@ -136,14 +130,14 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group, { case MLD_SEND_GENQUERY: /* Send General Query */ { - ninfo("Send General Query, flags=%02x\n", group->flags); + mldinfo("Send General Query, flags=%02x\n", group->flags); mldsize = SIZEOF_MLD_MCAST_LISTEN_QUERY_S(0); } break; case MLD_SEND_V1REPORT: /* Send MLDv1 Report message */ { - ninfo("Send MLDv1 Report, flags=%02x\n", group->flags); + mldinfo("Send MLDv1 Report, flags=%02x\n", group->flags); mldsize = sizeof(struct mld_mcast_listen_report_v1_s); } break; @@ -152,7 +146,7 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group, { unsigned int addreclen; - ninfo("Send MLDv2 Report, flags=%02x\n", group->flags); + mldinfo("Send MLDv2 Report, flags=%02x\n", group->flags); addreclen = SIZEOF_MLD_MCAST_ADDREC_V2_S(0, 0); mldsize = SIZEOF_MLD_MCAST_LISTEN_REPORT_V2_S(addreclen); } @@ -160,14 +154,14 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group, case MLD_SEND_V1DONE: /* Send MLDv1 Done message */ { - ninfo("Send Done message, flags=%02x\n", group->flags); + mldinfo("Send Done message, flags=%02x\n", group->flags); mldsize = sizeof(struct mld_mcast_listen_done_v1_s); } break; default: { - nerr("Bad msgtype: %02x \n", msgtype); + mlderr("Bad msgtype: %02x \n", msgtype); DEBUGPANIC(); } return; @@ -235,9 +229,9 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group, return; } - ninfo("destipaddr: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - destipaddr[0], destipaddr[1], destipaddr[2], destipaddr[3], - destipaddr[4], destipaddr[5], destipaddr[6], destipaddr[7]); + mldinfo("destipaddr: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + destipaddr[0], destipaddr[1], destipaddr[2], destipaddr[3], + destipaddr[4], destipaddr[5], destipaddr[6], destipaddr[7]); net_ipv6addr_hdrcopy(ipv6->destipaddr, destipaddr); @@ -364,8 +358,8 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group, MLD_STATINCR(g_netstats.icmpv6.sent); MLD_STATINCR(g_netstats.ipv6.sent); - ninfo("Outgoing ICMPv6 MLD packet length: %d (%d)\n", - dev->d_len, (ipv6->len[0] << 8) | ipv6->len[1]); + mldinfo("Outgoing ICMPv6 MLD packet length: %d (%d)\n", + dev->d_len, (ipv6->len[0] << 8) | ipv6->len[1]); - mld_dumppkt(RA, IPMLD_HDRLEN + RASIZE); + mld_dumppkt((FAR const uint8_t *)IPv6BUF, MLD_HDRLEN + mldsize); } diff --git a/net/mld/mld_timer.c b/net/mld/mld_timer.c index db613d31e9..f7c9f290e9 100644 --- a/net/mld/mld_timer.c +++ b/net/mld/mld_timer.c @@ -55,36 +55,6 @@ #ifdef CONFIG_NET_MLD -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Debug ********************************************************************/ - -#undef MLD_MTMRDEBUG /* Define to enable detailed MLD group debug */ - -#ifndef CONFIG_NET_MLD -# undef MLD_MTMRDEBUG -#endif - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef MLD_MTMRDEBUG -# define mtmrerr(format, ...) nerr(format, ##__VA_ARGS__) -# define mtmrinfo(format, ...) ninfo(format, ##__VA_ARGS__) -# else -# define mtmrerr(x...) -# define mtmrinfo(x...) -# endif -#else -# ifdef MLD_MTMRDEBUG -# define mtmrerr nerr -# define mtmrinfo ninfo -# else -# define mtmrerr (void) -# define mtmrinfo (void) -# endif -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -142,7 +112,7 @@ static void mld_polldog_work(FAR void *arg) ret = mld_schedmsg(group, mld_report_msgtype(group)); if (ret < 0) { - nerr("ERROR: Failed to schedule message: %d\n", ret); + mlderr("ERROR: Failed to schedule message: %d\n", ret); } /* Send the report until the unsolicited report count goes to zero @@ -181,7 +151,7 @@ static void mld_polldog_work(FAR void *arg) ret = mld_schedmsg(group, MLD_SEND_GENQUERY); if (ret < 0) { - nerr("ERROR: Failed to schedule message: %d\n", ret); + mlderr("ERROR: Failed to schedule message: %d\n", ret); } /* Restart the Querier timer */ @@ -209,7 +179,7 @@ static void mld_polldog_timout(int argc, uint32_t arg, ...) FAR struct mld_group_s *group; int ret; - ninfo("Timeout!\n"); + mldinfo("Timeout!\n"); /* Recover the reference to the group */ @@ -223,7 +193,7 @@ static void mld_polldog_timout(int argc, uint32_t arg, ...) ret = work_queue(LPWORK, &group->work, mld_polldog_work, group, 0); if (ret < 0) { - nerr("ERROR: Failed to queue timeout work: %d\n", ret); + mlderr("ERROR: Failed to queue timeout work: %d\n", ret); } } @@ -290,7 +260,7 @@ static void mld_v1dog_timout(int argc, uint32_t arg, ...) FAR struct mld_group_s *group; int ret; - ninfo("Timeout!\n"); + mldinfo("Timeout!\n"); /* Recover the reference to the group */ @@ -308,7 +278,7 @@ static void mld_v1dog_timout(int argc, uint32_t arg, ...) ret = work_queue(LPWORK, &group->work, mld_v1dog_work, group, 0); if (ret < 0) { - nerr("ERROR: Failed to queue timeout work: %d\n", ret); + mlderr("ERROR: Failed to queue timeout work: %d\n", ret); } } @@ -330,7 +300,7 @@ void mld_start_polltimer(FAR struct mld_group_s *group, clock_t ticks) /* Start the timer */ - mtmrinfo("ticks: %lu\n", (unsigned long)ticks); + mldinfo("ticks: %lu\n", (unsigned long)ticks); ret = wd_start(group->polldog, ticks, mld_polldog_timout, 1, (uint32_t)group); @@ -352,7 +322,7 @@ void mld_start_v1timer(FAR struct mld_group_s *group, clock_t ticks) /* Start the timer */ - mtmrinfo("ticks: %lu\n", (unsigned long)ticks); + mldinfo("ticks: %lu\n", (unsigned long)ticks); ret = wd_start(group->v1dog, ticks, mld_v1dog_timout, 1, (uint32_t)group);