summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-09-28 03:01:24 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-09-28 03:01:24 +0000
commit689e8fa8071e82e647a61f006649760f9331ac87 (patch)
tree74d5896781422a37f294f02f17fa10998568ebe6 /sys
parent522e3abc0a24d401c05ca2eb4e9c7e7af4bb7376 (diff)
when inserting a state, turn the error that pf_state_insert returns
into something usable by ioctl. makes DIOCADDSTATE on /dev/pf cope when inserting an already existing state.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pfsync.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index e7a379aa942..c5a212dbd31 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.128 2009/08/16 13:01:57 jsg Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.129 2009/09/28 03:01:23 dlg Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -570,9 +570,10 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags)
if (!ISSET(flags, PFSYNC_SI_IOCTL))
SET(st->state_flags, PFSTATE_NOSYNC);
- if ((error = pf_state_insert(kif, skw, sks, st)) != 0) {
+ if (pf_state_insert(kif, skw, sks, st) != 0) {
/* XXX when we have nat_rule/anchors, use STATE_DEC_COUNTERS */
r->states_cur--;
+ error = EEXIST;
goto cleanup_state;
}