Sun Mar 5 11:07:46 2017 UTC ()
Fix the position of curlwp_bindx; it should be after if_put


(ozaki-r)
diff -r1.275 -r1.276 src/sys/netinet/ip_output.c

cvs diff -r1.275 -r1.276 src/sys/netinet/ip_output.c (expand / switch to unified diff)

--- src/sys/netinet/ip_output.c 2017/03/03 07:13:06 1.275
+++ src/sys/netinet/ip_output.c 2017/03/05 11:07:46 1.276
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ip_output.c,v 1.275 2017/03/03 07:13:06 ozaki-r Exp $ */ 1/* $NetBSD: ip_output.c,v 1.276 2017/03/05 11:07:46 ozaki-r Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -81,27 +81,27 @@ @@ -81,27 +81,27 @@
81 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 81 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
82 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 82 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
88 * SUCH DAMAGE. 88 * SUCH DAMAGE.
89 * 89 *
90 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 90 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
91 */ 91 */
92 92
93#include <sys/cdefs.h> 93#include <sys/cdefs.h>
94__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.275 2017/03/03 07:13:06 ozaki-r Exp $"); 94__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.276 2017/03/05 11:07:46 ozaki-r Exp $");
95 95
96#ifdef _KERNEL_OPT 96#ifdef _KERNEL_OPT
97#include "opt_inet.h" 97#include "opt_inet.h"
98#include "opt_ipsec.h" 98#include "opt_ipsec.h"
99#include "opt_mrouting.h" 99#include "opt_mrouting.h"
100#include "opt_net_mpsafe.h" 100#include "opt_net_mpsafe.h"
101#include "opt_mpls.h" 101#include "opt_mpls.h"
102#endif 102#endif
103 103
104#include "arp.h" 104#include "arp.h"
105 105
106#include <sys/param.h> 106#include <sys/param.h>
107#include <sys/kmem.h> 107#include <sys/kmem.h>
@@ -1691,28 +1691,28 @@ ip_drop_membership(struct ip_moptions *i @@ -1691,28 +1691,28 @@ ip_drop_membership(struct ip_moptions *i
1691 * Give up the multicast address record to which the 1691 * Give up the multicast address record to which the
1692 * membership points. 1692 * membership points.
1693 */ 1693 */
1694 in_delmulti(imo->imo_membership[i]); 1694 in_delmulti(imo->imo_membership[i]);
1695 1695
1696 /* 1696 /*
1697 * Remove the gap in the membership array. 1697 * Remove the gap in the membership array.
1698 */ 1698 */
1699 for (++i; i < imo->imo_num_memberships; ++i) 1699 for (++i; i < imo->imo_num_memberships; ++i)
1700 imo->imo_membership[i-1] = imo->imo_membership[i]; 1700 imo->imo_membership[i-1] = imo->imo_membership[i];
1701 --imo->imo_num_memberships; 1701 --imo->imo_num_memberships;
1702 error = 0; 1702 error = 0;
1703out: 1703out:
1704 curlwp_bindx(bound); 
1705 if_put(ifp, &psref); 1704 if_put(ifp, &psref);
 1705 curlwp_bindx(bound);
1706 return error; 1706 return error;
1707} 1707}
1708 1708
1709/* 1709/*
1710 * Set the IP multicast options in response to user setsockopt(). 1710 * Set the IP multicast options in response to user setsockopt().
1711 */ 1711 */
1712int 1712int
1713ip_setmoptions(struct ip_moptions **pimo, const struct sockopt *sopt) 1713ip_setmoptions(struct ip_moptions **pimo, const struct sockopt *sopt)
1714{ 1714{
1715 struct ip_moptions *imo = *pimo; 1715 struct ip_moptions *imo = *pimo;
1716 struct in_addr addr; 1716 struct in_addr addr;
1717 struct ifnet *ifp; 1717 struct ifnet *ifp;
1718 int ifindex, error = 0; 1718 int ifindex, error = 0;