Hi,

On my test machine I have added a vether0 with a /32 IPv4 address.
Since then the regress/sbin/pfctl pfi2 test fails.

vether0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ...
        inet 10.188.80.21 netmask 0xffffffff

The test basically does this:
        echo "pass in from self:broadcast" | pfctl -o none -nvf-
The result contains this rule:
        pass in inet from 0.0.0.0 to any flags S/SA

The kernel view of (self:broadcast) does not contain the line with
0.0.0.0 so the test fails.

ifconfig checks wether a broadcast address is 0 before printing it.
I think pfctl should do the same check to find valid broadcast
addresses.

ok?

bluhm

Index: sbin/pfctl/pfctl_parser.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sbin/pfctl/pfctl_parser.c,v
retrieving revision 1.308
diff -u -p -r1.308 pfctl_parser.c
--- sbin/pfctl/pfctl_parser.c   3 Sep 2016 17:11:40 -0000       1.308
+++ sbin/pfctl/pfctl_parser.c   25 Oct 2016 17:01:36 -0000
@@ -1518,6 +1518,8 @@ ifa_lookup(const char *ifa_name, int fla
                if ((flags & PFI_AFLAG_BROADCAST) &&
                    !(p->ifa_flags & IFF_BROADCAST))
                        continue;
+               if ((flags & PFI_AFLAG_BROADCAST) && p->bcast.v4.s_addr == 0)
+                       continue;
                if ((flags & PFI_AFLAG_PEER) &&
                    !(p->ifa_flags & IFF_POINTOPOINT))
                        continue;

Reply via email to