Date: Mon, 11 Jan 2021 22:32:13 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 0c156a3c32cd - main - pfctl: Another set skip <group> fix Message-ID: <202101112232.10BMWDjA068046@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c156a3c32cd0d9168570da5686ddc96abcbbc5a commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-01-11 13:09:08 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2021-01-11 21:30:44 +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 --- 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 47a3992da128..1fd26711ea86 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?202101112232.10BMWDjA068046>