From 23e1d2e4033416821f972fb1086de5278f770996 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 20 Sep 2019 07:54:10 -0600 Subject: [PATCH] Dispatch ICMP_POLL to device's callback list too since icmpv6_neighbor still append the callback into this list. --- net/devif/devif_poll.c | 8 ++++++-- net/icmpv6/icmpv6_poll.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net/devif/devif_poll.c b/net/devif/devif_poll.c index 5cdc0791a1..2caf2d58a0 100644 --- a/net/devif/devif_poll.c +++ b/net/devif/devif_poll.c @@ -365,9 +365,12 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev, /* Traverse all of the allocated ICMPV6 connections and perform the poll action */ - while (!bstop && (conn = icmpv6_nextconn(conn)) != NULL) + do { - /* Perform the ICMPV6 poll */ + /* Perform the ICMPV6 poll + * Note: conn equal NULL in the first iteration means poll dev's callback list + * since icmpv6_neighbor still append it's callback into this list. + */ icmpv6_poll(dev, conn); @@ -379,6 +382,7 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev, bstop = callback(dev); } + while (!bstop && (conn = icmpv6_nextconn(conn)) != NULL); return bstop; } diff --git a/net/icmpv6/icmpv6_poll.c b/net/icmpv6/icmpv6_poll.c index 7ffbae69a9..acfd23dcd6 100644 --- a/net/icmpv6/icmpv6_poll.c +++ b/net/icmpv6/icmpv6_poll.c @@ -83,7 +83,7 @@ void icmpv6_poll(FAR struct net_driver_s *dev, /* Perform the application callback */ - (void)devif_conn_event(dev, conn, ICMPv6_POLL, conn->list); + devif_conn_event(dev, conn, ICMPv6_POLL, conn ? conn->list : &dev->d_conncb); } #endif /* CONFIG_NET_ICMPv6_SOCKET || CONFIG_NET_ICMPv6_NEIGHBOR */