diff --git a/src/neigh.c b/src/neigh.c index a589226d71aed4da28e8ae557483ff855097c665..8798592f95f52916ea9a05a81bf373a00f131800 100644 --- a/src/neigh.c +++ b/src/neigh.c @@ -1109,6 +1109,7 @@ struct neigh_entry *neigh_enqueue(void *nq, uint8_t *macaddr, uint16_t state, if (ip->family == AF_INET) { if (!ipaddr_equal(&e->ipv4, ip)) { memcpy(&e->ipv4, ip, sizeof(*ip)); + e->event_pending = 0; hostmngr_host_event(priv, HOST_EVENT_CONNECT, e); } } diff --git a/src/neigh.h b/src/neigh.h index 0049e2fb0b6e28f26e1eac41b8cb62c19e81dcca..a45a0333e3c16eebb9d0418dc91221d476c1a786 100644 --- a/src/neigh.h +++ b/src/neigh.h @@ -86,6 +86,7 @@ struct neigh_entry { uint32_t ageing_time; /* in msecs */ struct timeval ageing_tmo; int probe_cnt; + int event_pending; uint32_t num_tcp; uint32_t num_udp; diff --git a/src/netlink.c b/src/netlink.c index 0c4bc95995498449def27809566f9236be88a975..8a2decbab1de4cd58da1c175b2e39943200f76ba 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -201,6 +201,11 @@ static int hostmngr_handle_neigh_tbl_change(struct hostmngr_private *priv, bool if (!e) { dbg("Skip enqueue WiFi neigh through neigh table change\n"); return 0; + } else { + if (e->event_pending && !ipaddr_is_zero(&e->ipv4)) { + e->event_pending = 0; + hostmngr_host_event(priv, HOST_EVENT_CONNECT, e); + } } } diff --git a/src/ubus.c b/src/ubus.c index e0674af543f5f1785584038af23d7e0d61495a08..1a5216c9ba3368ab929a54e20645bcc26a308159 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -1209,6 +1209,8 @@ static void hostmngr_wifi_sta_event_handler(struct hostmngr_private *p, if (!ipaddr_is_zero(&new->ipv4)) hostmngr_host_event(p, HOST_EVENT_CONNECT, new); + else + new->event_pending = 1; } } else if (del) { dbg("%s: neigh_dequeue " MACFMT " (priv = %p) >>>\n",