Date: Thu, 14 Jan 2021 10:52:08 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: f9b0587dc2f9 - stable/12 - pfctl: Another set skip <group> fix Message-ID: <202101141052.10EAq85M068457@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f9b0587dc2f98800f9f72944fd66a695200c554b commit f9b0587dc2f98800f9f72944fd66a695200c554b Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-01-11 13:09:08 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2021-01-14 08:39:57 +0000 pfctl: Another set skip <group> fix When retrieving the list of group members we cannot simply use ifa_lookup(), because it expects the interface to have an IP (v4 or v6) address. This means that interfaces with no address are not found. This presents as interfacing being alternately marked as skip and not whenever the rules are re-loaded. Happily we only need to fix ifa_grouplookup(). Teach it to also accept AF_LINK (i.e. interface) node_hosts. PR: 250994 MFC after: 3 days (cherry picked from commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a) --- sbin/pfctl/pfctl_parser.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index f9a60253da44..120178c50087 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1392,6 +1392,26 @@ ifa_exists(char *ifa_name) return (NULL); } +static struct node_host * +if_lookup(char *if_name) +{ + struct node_host *p, *n; + + for (p = iftab; p; p = p->next) { + if (! strcmp(if_name, p->ifname)) { + n = calloc(1, sizeof(struct node_host)); + bcopy(p, n, sizeof(struct node_host)); + + n->next = NULL; + n->tail = n; + + return (n); + } + } + + return (NULL); +} + struct node_host * ifa_grouplookup(char *ifa_name, int flags) { @@ -1415,7 +1435,7 @@ ifa_grouplookup(char *ifa_name, int flags) for (ifg = ifgr.ifgr_groups; ifg && len >= sizeof(struct ifg_req); ifg++) { len -= sizeof(struct ifg_req); - if ((n = ifa_lookup(ifg->ifgrq_member, flags)) == NULL) + if ((n = if_lookup(ifg->ifgrq_member)) == NULL) continue; if (h == NULL) h = n;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101141052.10EAq85M068457>