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

(cherry picked from commit 8fd675d8a0)
This commit is contained in:
Kristof Provost 2020-04-19 15:37:13 +00:00 committed by Franco Fichtner
parent 9d703a3b6e
commit a1c99ca9e8
1 changed files with 4 additions and 3 deletions

View File

@ -1456,15 +1456,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;