From 9c3e65f15f60ca968e8e5c0475dce4968ea77b76 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 7 Nov 2018 18:21:21 -0600 Subject: [PATCH] net/mld: Fix a few compilation problems that cropped up in a different network configuration. Fix a logic error in setting the 'Other Querier Present' timer. Various cosmetic improvements. --- arch/mips/src/pic32mz/pic32mz-head.S | 2 +- include/nuttx/net/ip.h | 3 ++- include/nuttx/net/netstats.h | 2 +- net/icmpv6/icmpv6_neighbor.c | 4 +++- net/mld/mld_done.c | 1 + net/mld/mld_query.c | 27 ++++++++++++++------------- net/mld/mld_report.c | 1 + net/neighbor/neighbor_lookup.c | 2 +- net/udp/udp_psock_sendto_buffered.c | 7 ++++--- 9 files changed, 28 insertions(+), 21 deletions(-) diff --git a/arch/mips/src/pic32mz/pic32mz-head.S b/arch/mips/src/pic32mz/pic32mz-head.S index 84c4ed9e08..db012008fe 100644 --- a/arch/mips/src/pic32mz/pic32mz-head.S +++ b/arch/mips/src/pic32mz/pic32mz-head.S @@ -540,7 +540,7 @@ __start: mtc0 t0, PIC32MZ_CP0_STATUS #ifdef CONFIG_MIPS_MICROMIPS - /* Exception handlers are also being compiled for microMIPS, so enable + /* Exception handlers are also being compiled for microMIPS, so enable * config3ISAOnExc now that exception vectors have been [re]located. */ diff --git a/include/nuttx/net/ip.h b/include/nuttx/net/ip.h index 88a95dae99..bdacec48ea 100644 --- a/include/nuttx/net/ip.h +++ b/include/nuttx/net/ip.h @@ -593,7 +593,8 @@ bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1, * * An IPv6 multicast address is an identifier for a group of interfaces * (typically on different nodes). An interface may belong to any number - * of multicast groups. Multicast addresses have the following format: + * of multicast groups. Multicast addresses have the following format + * (in host order): * * | 8 | 4 | 4 | 112 bits | * +------ -+----+----+---------------------------------------------+ diff --git a/include/nuttx/net/netstats.h b/include/nuttx/net/netstats.h index 7de843faea..f1f8cd0931 100644 --- a/include/nuttx/net/netstats.h +++ b/include/nuttx/net/netstats.h @@ -106,7 +106,7 @@ struct net_stats_s struct igmp_stats_s igmp; /* IGMP statistics */ #endif -#ifdef CONFIG_NET_IGMP +#ifdef CONFIG_NET_MLD struct mld_stats_s mld; /* MLD statistics */ #endif diff --git a/net/icmpv6/icmpv6_neighbor.c b/net/icmpv6/icmpv6_neighbor.c index a071d11e91..7244329718 100644 --- a/net/icmpv6/icmpv6_neighbor.c +++ b/net/icmpv6/icmpv6_neighbor.c @@ -215,7 +215,9 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr) if (net_ipv6addr_cmp(ipaddr, g_ipv6_unspecaddr) || net_is_addr_mcast(ipaddr)) { - /* We don't need to send the Neighbor Solicitation */ + /* We don't need to send the Neighbor Solicitation. But for the case + * of the Multicast address, a routing able entry will be required. + */ return OK; } diff --git a/net/mld/mld_done.c b/net/mld/mld_done.c index 34406c2fa3..dae9f1757f 100644 --- a/net/mld/mld_done.c +++ b/net/mld/mld_done.c @@ -41,6 +41,7 @@ #include #include +#include #include #include "devif/devif.h" diff --git a/net/mld/mld_query.c b/net/mld/mld_query.c index 656877336e..6fbf689e55 100644 --- a/net/mld/mld_query.c +++ b/net/mld/mld_query.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -241,21 +242,21 @@ static void mld_check_querier(FAR struct net_driver_s *dev, /* Switch to non-Querier mode */ CLR_MLD_QUERIER(group->flags); - - /* Are we past the start up phase (where the timer is used for a - * different purpose)? - */ - - if (!IS_MLD_STARTUP(group->flags)) - { - /* Yes.. cancel the poll timer and start the 'Other Querier - * Present' Timeout. - */ - - mld_start_polltimer(group, MSEC2TICK(MLD_OQUERY_MSEC)); - } } } + + /* Check if the member is a Non-Querier AND that we are past the start up + * phase (where the timer is used for a different purpose)? + */ + + if (!IS_MLD_QUERIER(group->flags) && !IS_MLD_STARTUP(group->flags)) + { + /* Yes.. cancel the poll timer and [re-]start the 'Other Querier + * Present' Timeout. + */ + + mld_start_polltimer(group, MSEC2TICK(MLD_OQUERY_MSEC)); + } } /**************************************************************************** diff --git a/net/mld/mld_report.c b/net/mld/mld_report.c index 994481c717..3c133a6c75 100644 --- a/net/mld/mld_report.c +++ b/net/mld/mld_report.c @@ -42,6 +42,7 @@ #include #include +#include #include #include diff --git a/net/neighbor/neighbor_lookup.c b/net/neighbor/neighbor_lookup.c index 67d8764303..5f84801ad6 100644 --- a/net/neighbor/neighbor_lookup.c +++ b/net/neighbor/neighbor_lookup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * net/neighbor/neighbor.c + * net/neighbor/neighbor_lookup.c * * Copyright (C) 2007-2009, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/net/udp/udp_psock_sendto_buffered.c b/net/udp/udp_psock_sendto_buffered.c index d6cceb8feb..ba18b3cfe0 100644 --- a/net/udp/udp_psock_sendto_buffered.c +++ b/net/udp/udp_psock_sendto_buffered.c @@ -508,9 +508,10 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev, if (dev->d_sndlen <= 0 && (flags & UDP_NEWDATA) == 0 && (flags & UDP_POLL) != 0 && !sq_empty(&conn->write_q)) { - /* Check if the destination IP address is in the ARP or Neighbor - * table. If not, then the send won't actually make it out... it - * will be replaced with an ARP request or Neighbor Solicitation. + /* Check if the destination IP address is in the ARP, Neighbor + * table, or routing table. If not, then the send won't actually + * make it out... it will be replaced with an ARP request or + * Neighbor Solicitation. */ if (sendto_addrcheck(conn, dev))