Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 2014 09:17:41 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r269300 - projects/ipfw/sys/netpfil/ipfw
Message-ID:  <201407300917.s6U9Hf7D009737@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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