diff options
Diffstat (limited to 'sbin/ipf/libipf')
| -rw-r--r-- | sbin/ipf/libipf/printdstl_live.c | 3 | ||||
| -rw-r--r-- | sbin/ipf/libipf/printdstlist.c | 2 | ||||
| -rw-r--r-- | sbin/ipf/libipf/printdstlistdata.c | 5 | ||||
| -rw-r--r-- | sbin/ipf/libipf/printhash_live.c | 8 | ||||
| -rw-r--r-- | sbin/ipf/libipf/printhashdata.c | 19 | ||||
| -rw-r--r-- | sbin/ipf/libipf/printpooldata.c | 2 | 
6 files changed, 32 insertions, 7 deletions
| diff --git a/sbin/ipf/libipf/printdstl_live.c b/sbin/ipf/libipf/printdstl_live.c index 088448e6656d..72cb75a832c9 100644 --- a/sbin/ipf/libipf/printdstl_live.c +++ b/sbin/ipf/libipf/printdstl_live.c @@ -40,6 +40,9 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts,  	if ((d->ipld_flags & IPHASH_DELETE) != 0)  		PRINTF("# "); +	if (opts & OPT_SAVEOUT) +		PRINTF("{\n"); +  	if ((opts & OPT_DEBUG) == 0)  		PRINTF("\t{"); diff --git a/sbin/ipf/libipf/printdstlist.c b/sbin/ipf/libipf/printdstlist.c index 2cf41ffe414c..497d7004c94c 100644 --- a/sbin/ipf/libipf/printdstlist.c +++ b/sbin/ipf/libipf/printdstlist.c @@ -42,6 +42,8 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,  				return (NULL);  			} +			if (opts & OPT_SAVEOUT) +				PRINTF("\t");  			node = printdstlistnode(n, bcopywrap, opts, fields);  			free(n); diff --git a/sbin/ipf/libipf/printdstlistdata.c b/sbin/ipf/libipf/printdstlistdata.c index 7940d2ae021b..546bf35cabf6 100644 --- a/sbin/ipf/libipf/printdstlistdata.c +++ b/sbin/ipf/libipf/printdstlistdata.c @@ -11,8 +11,7 @@  void  printdstlistdata( ippool_dst_t *pool, int opts)  { - -	if ((opts & OPT_DEBUG) == 0) { +	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {  		if ((pool->ipld_flags & IPDST_DELETE) != 0)  			PRINTF("# ");  		PRINTF("pool "); @@ -24,7 +23,7 @@ printdstlistdata( ippool_dst_t *pool, int opts)  	printunit(pool->ipld_unit); -	if ((opts & OPT_DEBUG) == 0) { +	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {  		PRINTF("/dstlist (name %s;", pool->ipld_name);  		if (pool->ipld_policy != IPLDP_NONE) {  			PRINTF(" policy "); diff --git a/sbin/ipf/libipf/printhash_live.c b/sbin/ipf/libipf/printhash_live.c index b8ee31b27597..427daa18316b 100644 --- a/sbin/ipf/libipf/printhash_live.c +++ b/sbin/ipf/libipf/printhash_live.c @@ -26,7 +26,9 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)  	if ((hp->iph_flags & IPHASH_DELETE) != 0)  		PRINTF("# "); -	if ((opts & OPT_DEBUG) == 0) +	if (opts & OPT_SAVEOUT) +		PRINTF("{\n"); +	else if ((opts & OPT_DEBUG) == 0)  		PRINTF("\t{");  	obj.ipfo_rev = IPFILTER_VERSION; @@ -50,6 +52,8 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)  			last = 1;  		if (bcmp(&zero, &entry, sizeof(zero)) == 0)  			break; +		if (opts & OPT_SAVEOUT) +			PRINTF("\t");  		(void) printhashnode(hp, &entry, bcopywrap, opts, fields);  		printed++;  	} @@ -59,7 +63,7 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)  	if (printed == 0)  		putchar(';'); -	if ((opts & OPT_DEBUG) == 0) +	if ((opts & OPT_DEBUG) == 0 || (opts & OPT_SAVEOUT))  		PRINTF(" };\n");  	(void) ioctl(fd,SIOCIPFDELTOK, &iter.ili_key); diff --git a/sbin/ipf/libipf/printhashdata.c b/sbin/ipf/libipf/printhashdata.c index 690243d63f1e..6fa62e67556d 100644 --- a/sbin/ipf/libipf/printhashdata.c +++ b/sbin/ipf/libipf/printhashdata.c @@ -12,7 +12,11 @@ void  printhashdata(iphtable_t *hp, int opts)  { -	if ((opts & OPT_DEBUG) == 0) { +	if (opts & OPT_SAVEOUT) { +		if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE) +			PRINTF("# "); +		PRINTF("pool "); +	} else if ((opts & OPT_DEBUG) == 0) {  		if ((hp->iph_type & IPHASH_ANON) == IPHASH_ANON)  			PRINTF("# 'anonymous' table refs %d\n", hp->iph_ref);  		if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE) @@ -37,6 +41,8 @@ printhashdata(iphtable_t *hp, int opts)  		}  		PRINTF(" role=");  	} else { +		if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE) +			PRINTF("# ");  		PRINTF("Hash Table %s: %s",  			ISDIGIT(*hp->iph_name) ? "Number" : "Name",  			hp->iph_name); @@ -48,7 +54,16 @@ printhashdata(iphtable_t *hp, int opts)  	printunit(hp->iph_unit); -	if ((opts & OPT_DEBUG) == 0) { +	if ((opts & OPT_SAVEOUT)) { +		if ((hp->iph_type & ~IPHASH_ANON) == IPHASH_LOOKUP) +			PRINTF("/hash"); +		PRINTF("(%s \"%s\"; size %lu;", +			ISDIGIT(*hp->iph_name) ? "number" : "name", +			hp->iph_name, (u_long)hp->iph_size); +		if (hp->iph_seed != 0) +			PRINTF(" seed %lu;", hp->iph_seed); +		PRINTF(")\n", hp->iph_seed); +	} else if ((opts & OPT_DEBUG) == 0) {  		if ((hp->iph_type & ~IPHASH_ANON) == IPHASH_LOOKUP)  			PRINTF(" type=hash");  		PRINTF(" %s=%s size=%lu", diff --git a/sbin/ipf/libipf/printpooldata.c b/sbin/ipf/libipf/printpooldata.c index bd5af316eb19..b203522734be 100644 --- a/sbin/ipf/libipf/printpooldata.c +++ b/sbin/ipf/libipf/printpooldata.c @@ -13,6 +13,8 @@ printpooldata(ip_pool_t *pool, int opts)  {  	if (opts & OPT_SAVEOUT) { +		if ((pool->ipo_flags & IPOOL_DELETE) != 0) +			PRINTF("# ");  		PRINTF("pool ");  	} else if ((opts & OPT_DEBUG) == 0) {  		if ((pool->ipo_flags & IPOOL_ANON) != 0) | 
