svn commit: r269300 - projects/ipfw/sys/netpfil/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Wed Jul 30 09:17:41 UTC 2014


Author: melifaro
Date: Wed Jul 30 09:17:40 2014
New Revision: 269300
URL: http://svnweb.freebsd.org/changeset/base/269300

Log:
  Fix "flush" cmd for algorithms wih non-default parameters.

Modified:
  projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c

Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c
==============================================================================
--- projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c	Wed Jul 30 08:36:48 2014	(r269299)
+++ projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c	Wed Jul 30 09:17:40 2014	(r269300)
@@ -648,6 +648,7 @@ flush_table(struct ip_fw_chain *ch, stru
 	struct table_algo *ta;
 	struct table_info ti_old, ti_new, *tablestate;
 	void *astate_old, *astate_new;
+	char algostate[32], *pstate;
 	int error;
 	uint16_t kidx;
 
@@ -663,14 +664,20 @@ flush_table(struct ip_fw_chain *ch, stru
 	}
 	ta = tc->ta;
 	tc->no.refcnt++;
+	/* Save statup algo parameters */
+	if (ta->print_config != NULL) {
+		ta->print_config(tc->astate, KIDX_TO_TI(ch, tc->no.kidx),
+		    algostate, sizeof(algostate));
+		pstate = algostate;
+	} else
+		pstate = NULL;
 	IPFW_UH_WUNLOCK(ch);
 
 	/*
 	 * Stage 2: allocate new table instance using same algo.
-	 * TODO: pass startup parametes somehow.
 	 */
 	memset(&ti_new, 0, sizeof(struct table_info));
-	if ((error = ta->init(ch, &astate_new, &ti_new, NULL)) != 0) {
+	if ((error = ta->init(ch, &astate_new, &ti_new, pstate)) != 0) {
 		IPFW_UH_WLOCK(ch);
 		tc->no.refcnt--;
 		IPFW_UH_WUNLOCK(ch);


More information about the svn-src-projects mailing list