From: Tobias Brunner Date: Mon, 27 Jan 2025 08:40:56 +0000 (+0100) Subject: pf-handler: Accept loopback interfaces as packet source X-Git-Tag: android-2.5.3~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=abbf9d28b0032cf80b79bcacea3146a60800a6dd;p=thirdparty%2Fstrongswan.git pf-handler: Accept loopback interfaces as packet source In some setups the responses from the DHCP server are sent via lo, which does not have an address of type `ARPHRD_ETHER` (the address length is the same, though, just all zeros, by default). Note that the dhcp plugin doesn't actually care for the MAC address or interface details, that's only used by the farp plugin. Fixes: 187c72d1afdc ("dhcp: Port the plugin to FreeBSD/macOS") --- diff --git a/src/libcharon/network/pf_handler.c b/src/libcharon/network/pf_handler.c index 43ef432ba6..ef55671c4b 100644 --- a/src/libcharon/network/pf_handler.c +++ b/src/libcharon/network/pf_handler.c @@ -176,7 +176,8 @@ static cached_iface_t *find_interface(private_pf_handler_t *this, int fd, if (ioctl(fd, SIOCGIFNAME, &req) == 0 && ioctl(fd, SIOCGIFHWADDR, &req) == 0 && - req.ifr_hwaddr.sa_family == ARPHRD_ETHER) + (req.ifr_hwaddr.sa_family == ARPHRD_ETHER || + req.ifr_hwaddr.sa_family == ARPHRD_LOOPBACK)) { idx = find_least_used_cache_entry(this);