svn commit: r360097 - head/sbin/pfctl

Kristof Provost kp at FreeBSD.org
Sun Apr 19 15:37:14 UTC 2020


Author: kp
Date: Sun Apr 19 15:37:13 2020
New Revision: 360097
URL: https://svnweb.freebsd.org/changeset/base/360097

Log:
  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

Modified:
  head/sbin/pfctl/pfctl_parser.c

Modified: head/sbin/pfctl/pfctl_parser.c
==============================================================================
--- head/sbin/pfctl/pfctl_parser.c	Sun Apr 19 15:32:14 2020	(r360096)
+++ head/sbin/pfctl/pfctl_parser.c	Sun Apr 19 15:37:13 2020	(r360097)
@@ -1436,14 +1436,15 @@ 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))


More information about the svn-src-head mailing list