diff options
author | glebius <glebius@FreeBSD.org> | 2013-05-11 18:06:51 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2013-05-11 18:06:51 +0000 |
commit | 35ec1b4a110cad5eb51175c8cba9e210c99a6e72 (patch) | |
tree | 5a25f43fdf2c9622b386179c85802b5a137f4af2 /sys/netpfil/pf | |
parent | 3a8ddef6a9574acfc6f246d397f2d1395179b976 (diff) | |
download | FreeBSD-src-35ec1b4a110cad5eb51175c8cba9e210c99a6e72.zip FreeBSD-src-35ec1b4a110cad5eb51175c8cba9e210c99a6e72.tar.gz |
Return meaningful error code from pf_state_key_attach() and
pf_state_insert().
Diffstat (limited to 'sys/netpfil/pf')
-rw-r--r-- | sys/netpfil/pf/pf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index af81d39..dd64610 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -915,7 +915,7 @@ keyattach: uma_zfree(V_pf_state_key_z, sk); if (idx == PF_SK_STACK) pf_detach_state(s); - return (-1); /* collision! */ + return (EEXIST); /* collision! */ } } PF_HASHROW_UNLOCK(ih); @@ -1072,6 +1072,7 @@ pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, { struct pf_idhash *ih; struct pf_state *cur; + int error; KASSERT(TAILQ_EMPTY(&sks->states[0]) && TAILQ_EMPTY(&sks->states[1]), ("%s: sks not pristine", __func__)); @@ -1090,8 +1091,8 @@ pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, s->creatorid = V_pf_status.hostid; } - if (pf_state_key_attach(skw, sks, s)) - return (-1); + if ((error = pf_state_key_attach(skw, sks, s)) != 0) + return (error); ih = &V_pf_idhash[PF_IDHASH(s)]; PF_HASHROW_LOCK(ih); @@ -1108,7 +1109,7 @@ pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, ntohl(s->creatorid)); } pf_detach_state(s); - return (-1); + return (EEXIST); } LIST_INSERT_HEAD(&ih->states, s, entry); /* One for keys, one for ID hash. */ |