| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if.c,v 1.394.2.10 2018/05/15 13:48:37 martin Exp $ */ | | 1 | /* $NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by William Studenmund and Jason R. Thorpe. | | 8 | * by William Studenmund and Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -80,27 +80,27 @@ | | | @@ -80,27 +80,27 @@ |
80 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 80 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
81 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 81 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
82 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 82 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
83 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 83 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
84 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 84 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
85 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 85 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
86 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 86 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
87 | * SUCH DAMAGE. | | 87 | * SUCH DAMAGE. |
88 | * | | 88 | * |
89 | * @(#)if.c 8.5 (Berkeley) 1/9/95 | | 89 | * @(#)if.c 8.5 (Berkeley) 1/9/95 |
90 | */ | | 90 | */ |
91 | | | 91 | |
92 | #include <sys/cdefs.h> | | 92 | #include <sys/cdefs.h> |
93 | __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.10 2018/05/15 13:48:37 martin Exp $"); | | 93 | __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $"); |
94 | | | 94 | |
95 | #if defined(_KERNEL_OPT) | | 95 | #if defined(_KERNEL_OPT) |
96 | #include "opt_inet.h" | | 96 | #include "opt_inet.h" |
97 | #include "opt_ipsec.h" | | 97 | #include "opt_ipsec.h" |
98 | #include "opt_atalk.h" | | 98 | #include "opt_atalk.h" |
99 | #include "opt_natm.h" | | 99 | #include "opt_natm.h" |
100 | #include "opt_wlan.h" | | 100 | #include "opt_wlan.h" |
101 | #include "opt_net_mpsafe.h" | | 101 | #include "opt_net_mpsafe.h" |
102 | #include "opt_mrouting.h" | | 102 | #include "opt_mrouting.h" |
103 | #endif | | 103 | #endif |
104 | | | 104 | |
105 | #include <sys/param.h> | | 105 | #include <sys/param.h> |
106 | #include <sys/mbuf.h> | | 106 | #include <sys/mbuf.h> |
| @@ -3591,30 +3591,33 @@ if_flags_set(ifnet_t *ifp, const short f | | | @@ -3591,30 +3591,33 @@ if_flags_set(ifnet_t *ifp, const short f |
3591 | if (rc != 0 && cantflags != 0) | | 3591 | if (rc != 0 && cantflags != 0) |
3592 | ifp->if_flags ^= cantflags; | | 3592 | ifp->if_flags ^= cantflags; |
3593 | } | | 3593 | } |
3594 | | | 3594 | |
3595 | return rc; | | 3595 | return rc; |
3596 | } | | 3596 | } |
3597 | | | 3597 | |
3598 | int | | 3598 | int |
3599 | if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa) | | 3599 | if_mcast_op(ifnet_t *ifp, const unsigned long cmd, const struct sockaddr *sa) |
3600 | { | | 3600 | { |
3601 | int rc; | | 3601 | int rc; |
3602 | struct ifreq ifr; | | 3602 | struct ifreq ifr; |
3603 | | | 3603 | |
| | | 3604 | /* There remain some paths that don't hold IFNET_LOCK yet */ |
| | | 3605 | #ifdef NET_MPSAFE |
3604 | /* CARP and MROUTING still don't deal with the lock yet */ | | 3606 | /* CARP and MROUTING still don't deal with the lock yet */ |
3605 | #if (!defined(NCARP) || (NCARP == 0)) && !defined(MROUTING) | | 3607 | #if (!defined(NCARP) || (NCARP == 0)) && !defined(MROUTING) |
3606 | KASSERT(IFNET_LOCKED(ifp)); | | 3608 | KASSERT(IFNET_LOCKED(ifp)); |
3607 | #endif | | 3609 | #endif |
| | | 3610 | #endif |
3608 | if (ifp->if_mcastop != NULL) | | 3611 | if (ifp->if_mcastop != NULL) |
3609 | rc = (*ifp->if_mcastop)(ifp, cmd, sa); | | 3612 | rc = (*ifp->if_mcastop)(ifp, cmd, sa); |
3610 | else { | | 3613 | else { |
3611 | ifreq_setaddr(cmd, &ifr, sa); | | 3614 | ifreq_setaddr(cmd, &ifr, sa); |
3612 | rc = (*ifp->if_ioctl)(ifp, cmd, &ifr); | | 3615 | rc = (*ifp->if_ioctl)(ifp, cmd, &ifr); |
3613 | } | | 3616 | } |
3614 | | | 3617 | |
3615 | return rc; | | 3618 | return rc; |
3616 | } | | 3619 | } |
3617 | | | 3620 | |
3618 | static void | | 3621 | static void |
3619 | sysctl_sndq_setup(struct sysctllog **clog, const char *ifname, | | 3622 | sysctl_sndq_setup(struct sysctllog **clog, const char *ifname, |
3620 | struct ifaltq *ifq) | | 3623 | struct ifaltq *ifq) |