pfctl: Call ifa_load() before ifa_grouplookup()

ifa_grouplookup() uses the data loaded in ifa_load() (through is_a_group()), so
we must call ifa_load() before we can rely on any of the data it populates.

Submitted by:	Nick Rogers
MFC after:	1 week
Sponsored by:	RG Nets
This commit is contained in:
Kristof Provost 2020-04-19 15:37:13 +00:00
parent 681652667a
commit 8fd675d8a0

View File

@ -1436,15 +1436,16 @@ ifa_lookup(char *ifa_name, int flags)
int got4 = 0, got6 = 0;
const char *last_if = NULL;
/* first load iftab and isgroup_map */
if (iftab == NULL)
ifa_load();
if ((h = ifa_grouplookup(ifa_name, flags)) != NULL)
return (h);
if (!strncmp(ifa_name, "self", IFNAMSIZ))
ifa_name = NULL;
if (iftab == NULL)
ifa_load();
for (p = iftab; p; p = p->next) {
if (ifa_skip_if(ifa_name, p))
continue;