]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pf-handler: Accept loopback interfaces as packet source
authorTobias Brunner <tobias@strongswan.org>
Mon, 27 Jan 2025 08:40:56 +0000 (09:40 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 31 Jan 2025 10:19:42 +0000 (11:19 +0100)
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")
src/libcharon/network/pf_handler.c

index 43ef432ba607974b9ca6697da0b4de6a33d4d3e4..ef55671c4b6121b56f8b5bc34b11406a3d53bb58 100644 (file)
@@ -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);