diff options
Diffstat (limited to 'sbin/pfctl/pfctl.c')
| -rw-r--r-- | sbin/pfctl/pfctl.c | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index ed317495c2e0..02d6c9c84a32 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -2618,6 +2618,8 @@ pfctl_apply_limit(struct pfctl *pf, const char *opt, unsigned int limit)  int  pfctl_load_limit(struct pfctl *pf, unsigned int index, unsigned int limit)  { +	static int restore_limit_handler_armed = 0; +  	if (pfctl_set_limit(pf->h, index, limit)) {  		if (errno == EBUSY)  			warnx("Current pool size exceeds requested %s limit %u", @@ -2626,6 +2628,9 @@ pfctl_load_limit(struct pfctl *pf, unsigned int index, unsigned int limit)  			warnx("Cannot set %s limit to %u",  			    pf_limits[index].name, limit);  		return (1); +	} else if (restore_limit_handler_armed == 0) { +		atexit(pfctl_restore_limits); +		restore_limit_handler_armed = 1;  	}  	return (0);  } @@ -3167,10 +3172,7 @@ pfctl_show_eth_anchors(int dev, int opts, char *anchorname)  	int ret;  	if ((ret = pfctl_get_eth_rulesets_info(dev, &ri, anchorname)) != 0) { -		if (ret == ENOENT) -			fprintf(stderr, "Anchor '%s' not found.\n", -			    anchorname); -		else +		if (ret != ENOENT)  			errc(1, ret, "DIOCGETETHRULESETS");  		return (-1);  	} @@ -3477,7 +3479,6 @@ main(int argc, char *argv[])  	if ((opts & PF_OPT_NOACTION) == 0) {  		pfctl_read_limits(pfh); -		atexit(pfctl_restore_limits);  	}  	if (opts & PF_OPT_DISABLE) | 
