fix auto_socket: handle_nl_link silently skipped on if_indextoname failure for deleted interfaces
When ip link del removes an interface, the kernel sends RTM_DELLINK after the interface is unregistered from the name table. if_indextoname fails and handle_nl_link silently returned without calling remove_iface_sockets, causing old ETCP sockets to accumulate indefinitely. Fix: fall through to remove_iface_sockets(ifindex) even when if_indextoname fails. Test: added diagnostics (diag_dump_state, per-category debug levels to file) to verify socket/links cleanup.
This commit is contained in:
1 parent
b503fa4418
commit
8583d4216f
2 files changed
+63
-2
No files matched your search
@@ -932,7 +932,12 @@ static void handle_nl_addr(struct AUTO_SOCKET* as, struct ifaddrmsg* ifa, int ms
|
||||
* - UP (новый или поднялся) → запускаем reconcile */
|
||||
static void handle_nl_link(struct AUTO_SOCKET* as, struct ifinfomsg* ifi, int msg_type) {
|
||||
char ifname[IFNAMSIZ];
|
||||
if (!if_indextoname(ifi->ifi_index, ifname)) return;
|
||||
if (!if_indextoname(ifi->ifi_index, ifname)) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_AS, "[as] handle_nl_link: if_indextoname(%u) failed, msg=%d — removing by index",
|
||||
ifi->ifi_index, msg_type);
|
||||
remove_iface_sockets(as, ifi->ifi_index);
|
||||
return;
|
||||
}
|
||||
if (ifi->ifi_flags & IFF_LOOPBACK) return;
|
||||
|
||||
int is_up = (ifi->ifi_flags & IFF_UP) != 0;
|
||||
|
||||
Reference in new issue
Block a user