From owner-svn-src-all@FreeBSD.ORG Sat Dec 27 20:37:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9CC5106564A; Sat, 27 Dec 2008 20:37:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA4B28FC16; Sat, 27 Dec 2008 20:37:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBRKbr3S081838; Sat, 27 Dec 2008 20:37:53 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBRKbrNK081837; Sat, 27 Dec 2008 20:37:53 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200812272037.mBRKbrNK081837@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 27 Dec 2008 20:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186528 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2008 20:37:54 -0000 Author: bz Date: Sat Dec 27 20:37:53 2008 New Revision: 186528 URL: http://svn.freebsd.org/changeset/base/186528 Log: Rewrite ipsec6_setspidx_inpcb() to match the logic in the (now) equivalent IPv4 counterpart. MFC after: 4 weeks Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Sat Dec 27 19:42:59 2008 (r186527) +++ head/sys/netipsec/ipsec.c Sat Dec 27 20:37:53 2008 (r186528) @@ -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