diff --git a/src/neigh.c b/src/neigh.c index dcd70e8030f5ab0c596bb9278949dfa985202c15..f72048f426f373ffd9a30817f8d01b269ed83cf1 100644 --- a/src/neigh.c +++ b/src/neigh.c @@ -634,7 +634,6 @@ struct neigh_entry *neigh_lookup_by_ipaddr(void *priv, struct ip_address *ip) return NULL; } - struct neigh_entry *neigh_lookup_by_aladdr(void *priv, uint8_t *aladdr) { struct hostmngr_private *p = (struct hostmngr_private *)priv; diff --git a/src/neigh.h b/src/neigh.h index 4718b0c96ab1fc6a3590c77b5d7b6a5eaa0c1f24..79517bc36e751c6c134fca00a07803d93db26e4a 100644 --- a/src/neigh.h +++ b/src/neigh.h @@ -64,6 +64,7 @@ struct neigh_entry { char ifname[16]; uint16_t brport; /* valid when 'ifname' is bridge type */ enum neigh_type type; + uint8_t isremote; /* true when connected behind extender */ uint8_t is1905; uint8_t is1905_slave; /* member interface of 1905 device */ uint8_t is1905_link; /* 1905 interface forming link with nbr */ diff --git a/src/ubus.c b/src/ubus.c index 0207e1a19f2fa1ab6fd9f90c4b17fd0f0ecd8225..501ecfe7c8d3e1f8195543bc9072678f7043cfb8 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -387,6 +387,26 @@ static void hostmngr_1905topology_cb(struct ubus_request *req, int type, return; } + /* appropriately set neigh-type of non-local hosts */ + if (memcmp(node_aladdr, priv->ieee1905id, 6)) { + struct neigh_entry *rn = NULL; + + rn = neigh_lookup(&priv->neigh_q, xbr_macaddr); + if (rn) { + rn->isremote = 1; + n = neigh_lookup_by_aladdr(priv, node_aladdr); + if (n) { + struct node_interface *nif = NULL; + + list_for_each_entry(nif, &rn->iflist, list) { + if (!memcmp(nif->macaddr, xbr_viaaddr, 6) && + nif->mediatype == IF_MEDIA_WIFI) + rn->type =NEIGH_TYPE_WIFI; + } + } + } + } + dbg("%s: Xbr " MACFMT "\n", __func__, MAC2STR(xbr_macaddr)); dbg("%s: Xif " MACFMT "\n", __func__, MAC2STR(xbr_viaaddr)); iter++; @@ -704,6 +724,7 @@ int hostmngr_ubus_show_hosts(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_string(&bb, "macaddr", macstr); blobmsg_add_string(&bb, "hostname", e->hostname); blobmsg_add_u8(&bb, "active", e->unreachable ? false : true); + blobmsg_add_u8(&bb, "local", e->isremote ? false : true); t = gmtime(&e->lastchange); strftime(tbuf, sizeof(tbuf), "%Y-%m-%dT%H:%M:%SZ", t);