Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2017 05:02:12 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317666 - head/sbin/ipfw
Message-ID:  <201705020502.v4252ClR061390@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue May  2 05:02:12 2017
New Revision: 317666
URL: https://svnweb.freebsd.org/changeset/base/317666

Log:
  Add sets support for ipfw table info/list/flush commands.
  
  PR:		212668
  MFC after:	1 week

Modified:
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/tables.c
==============================================================================
--- head/sbin/ipfw/tables.c	Tue May  2 02:32:10 2017	(r317665)
+++ head/sbin/ipfw/tables.c	Tue May  2 05:02:12 2017	(r317666)
@@ -1628,18 +1628,19 @@ tables_foreach(table_cb_t *f, void *arg,
 		}
 
 		if (sort != 0)
-			qsort(olh + 1, olh->count, olh->objsize, tablename_cmp);
+			qsort(olh + 1, olh->count, olh->objsize,
+			    tablename_cmp);
 
 		info = (ipfw_xtable_info *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(info, arg); /* Ignore errors for now */
-			info = (ipfw_xtable_info *)((caddr_t)info + olh->objsize);
+			if (co.use_set == 0 || info->set == co.use_set - 1)
+				error = f(info, arg);
+			info = (ipfw_xtable_info *)((caddr_t)info +
+			    olh->objsize);
 		}
-
 		free(olh);
 		break;
 	}
-
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705020502.v4252ClR061390>