diff options
author | bz <bz@FreeBSD.org> | 2008-12-27 20:37:53 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-12-27 20:37:53 +0000 |
commit | 9d1d3ec9fe7a5e4a6cd69ef2288fe4792ac7adb9 (patch) | |
tree | adc579eb74054444b78496e4e799cdf6eae4e449 /sys/netipsec | |
parent | 95679d033548eecfbf3e08956df5742b68594c9f (diff) | |
download | FreeBSD-src-9d1d3ec9fe7a5e4a6cd69ef2288fe4792ac7adb9.zip FreeBSD-src-9d1d3ec9fe7a5e4a6cd69ef2288fe4792ac7adb9.tar.gz |
Rewrite ipsec6_setspidx_inpcb() to match the logic in the
(now) equivalent IPv4 counterpart.
MFC after: 4 weeks
Diffstat (limited to 'sys/netipsec')
-rw-r--r-- | sys/netipsec/ipsec.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c index cb7de54..1bd9854 100644 --- a/sys/netipsec/ipsec.c +++ b/sys/netipsec/ipsec.c @@ -576,8 +576,6 @@ ipsec6_setspidx_inpcb(m, pcb) struct mbuf *m; struct inpcb *pcb; { - //INIT_VNET_IPSEC(curvnet); - struct secpolicyindex *spidx; int error; IPSEC_ASSERT(pcb != NULL, ("null pcb")); @@ -585,26 +583,18 @@ ipsec6_setspidx_inpcb(m, pcb) IPSEC_ASSERT(pcb->inp_sp->sp_out != NULL && pcb->inp_sp->sp_in != NULL, ("null sp_in || sp_out")); - bzero(&pcb->inp_sp->sp_in->spidx, sizeof(*spidx)); - bzero(&pcb->inp_sp->sp_out->spidx, sizeof(*spidx)); - - spidx = &pcb->inp_sp->sp_in->spidx; - error = ipsec_setspidx(m, spidx, 1); - if (error) - goto bad; - spidx->dir = IPSEC_DIR_INBOUND; - - spidx = &pcb->inp_sp->sp_out->spidx; - error = ipsec_setspidx(m, spidx, 1); - if (error) - goto bad; - spidx->dir = IPSEC_DIR_OUTBOUND; - - return 0; + error = ipsec_setspidx(m, &pcb->inp_sp->sp_in->spidx, 1); + if (error == 0) { + pcb->inp_sp->sp_in->spidx.dir = IPSEC_DIR_INBOUND; + pcb->inp_sp->sp_out->spidx = pcb->inp_sp->sp_in->spidx; + pcb->inp_sp->sp_out->spidx.dir = IPSEC_DIR_OUTBOUND; + } else { + bzero(&pcb->inp_sp->sp_in->spidx, + sizeof(pcb->inp_sp->sp_in->spidx)); + bzero(&pcb->inp_sp->sp_out->spidx, + sizeof(pcb->inp_sp->sp_in->spidx)); + } -bad: - bzero(&pcb->inp_sp->sp_in->spidx, sizeof(*spidx)); - bzero(&pcb->inp_sp->sp_out->spidx, sizeof(*spidx)); return error; } #endif |