From owner-svn-src-projects@freebsd.org Sun Jan 1 20:05:20 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D85B5C9A6B5 for ; Sun, 1 Jan 2017 20:05:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A88111F41; Sun, 1 Jan 2017 20:05:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v01K5JbF071510; Sun, 1 Jan 2017 20:05:19 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v01K5JgY071509; Sun, 1 Jan 2017 20:05:19 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201701012005.v01K5JgY071509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 1 Jan 2017 20:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r311034 - projects/ipsec/sys/netipsec X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2017 20:05:20 -0000 Author: ae Date: Sun Jan 1 20:05:19 2017 New Revision: 311034 URL: https://svnweb.freebsd.org/changeset/base/311034 Log: Initialize address family and length fields in the source and destination addresses of security policy index based on the INPCB vflag. Modified: projects/ipsec/sys/netipsec/ipsec_pcb.c Modified: projects/ipsec/sys/netipsec/ipsec_pcb.c ============================================================================== --- projects/ipsec/sys/netipsec/ipsec_pcb.c Sun Jan 1 19:46:56 2017 (r311033) +++ projects/ipsec/sys/netipsec/ipsec_pcb.c Sun Jan 1 20:05:19 2017 (r311034) @@ -216,6 +216,24 @@ ipsec_set_pcbpolicy(struct inpcb *inp, s if (newsp == NULL) return (error); newsp->state = IPSEC_SPSTATE_PCB; +#ifdef INET + if (inp->inp_vflag & INP_IPV4) { + newsp->spidx.src.sin.sin_family = + newsp->spidx.dst.sin.sin_family = AF_INET; + newsp->spidx.src.sin.sin_len = + newsp->spidx.dst.sin.sin_len = + sizeof(struct sockaddr_in); + } +#endif +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) { + newsp->spidx.src.sin6.sin6_family = + newsp->spidx.dst.sin6.sin6_family = AF_INET6; + newsp->spidx.src.sin6.sin6_len = + newsp->spidx.dst.sin6.sin6_len = + sizeof(struct sockaddr_in6); + } +#endif break; case IPSEC_POLICY_ENTRUST: /* We just use NULL pointer for ENTRUST policy */