summaryrefslogtreecommitdiff
path: root/server/NetlinkHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/NetlinkHandler.cpp')
-rw-r--r--server/NetlinkHandler.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/NetlinkHandler.cpp b/server/NetlinkHandler.cpp
index 7fb34379..525bb2d6 100644
--- a/server/NetlinkHandler.cpp
+++ b/server/NetlinkHandler.cpp
@@ -155,7 +155,11 @@ void NetlinkHandler::onEvent(NetlinkEvent *evt) {
if (shouldDestroy) {
SockDiag sd;
if (sd.open()) {
- int ret = sd.destroySockets(addrstr);
+ // Pass the interface index iff. destroying sockets on a link-local address.
+ // This cannot use an interface name as the interface might no longer exist.
+ int destroyIfaceIndex =
+ std::string_view(addrstr).starts_with("fe80:") ? ifaceIndex : 0;
+ int ret = sd.destroySockets(addrstr, destroyIfaceIndex);
if (ret < 0) {
ALOGE("Error destroying sockets: %s", strerror(-ret));
}