Tweak softnet_lock and NET_MPSAFE - Don't hold softnet_lock in some functions if NET_MPSAFE - Add softnet_lock to sysctl_net_inet_icmp_redirtimeout - Add softnet_lock to expire_upcalls of ip_mroute.c - Restore softnet_lock for in{,6}_pcbpurgeif{,0} if NET_MPSAFE - Mark some softnet_lock for future workdiff -r1.239 -r1.240 src/sys/netinet/if_arp.c
(ozaki-r)
--- src/sys/netinet/if_arp.c 2017/01/21 11:07:46 1.239
+++ src/sys/netinet/if_arp.c 2017/01/24 07:09:24 1.240
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_arp.c,v 1.239 2017/01/21 11:07:46 maxv Exp $ */ | 1 | /* $NetBSD: if_arp.c,v 1.240 2017/01/24 07:09:24 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2000, 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 Public Access Networks Corporation ("Panix"). It was developed under | 8 | * by Public Access Networks Corporation ("Panix"). It was developed under | |
9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. | 9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -58,27 +58,27 @@ | @@ -58,27 +58,27 @@ | |||
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 | 61 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | /* | 64 | /* | |
65 | * Ethernet address resolution protocol. | 65 | * Ethernet address resolution protocol. | |
66 | * TODO: | 66 | * TODO: | |
67 | * add "inuse/lock" bit (or ref. count) along with valid bit | 67 | * add "inuse/lock" bit (or ref. count) along with valid bit | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | #include <sys/cdefs.h> | 70 | #include <sys/cdefs.h> | |
71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.239 2017/01/21 11:07:46 maxv Exp $"); | 71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.240 2017/01/24 07:09:24 ozaki-r Exp $"); | |
72 | 72 | |||
73 | #ifdef _KERNEL_OPT | 73 | #ifdef _KERNEL_OPT | |
74 | #include "opt_ddb.h" | 74 | #include "opt_ddb.h" | |
75 | #include "opt_inet.h" | 75 | #include "opt_inet.h" | |
76 | #include "opt_net_mpsafe.h" | 76 | #include "opt_net_mpsafe.h" | |
77 | #endif | 77 | #endif | |
78 | 78 | |||
79 | #ifdef INET | 79 | #ifdef INET | |
80 | 80 | |||
81 | #include "arp.h" | 81 | #include "arp.h" | |
82 | #include "bridge.h" | 82 | #include "bridge.h" | |
83 | 83 | |||
84 | #include <sys/param.h> | 84 | #include <sys/param.h> | |
@@ -1666,28 +1666,30 @@ arp_dad_stop(struct ifaddr *ifa) | @@ -1666,28 +1666,30 @@ arp_dad_stop(struct ifaddr *ifa) | |||
1666 | 1666 | |||
1667 | free(dp, M_IPARP); | 1667 | free(dp, M_IPARP); | |
1668 | dp = NULL; | 1668 | dp = NULL; | |
1669 | ifafree(ifa); | 1669 | ifafree(ifa); | |
1670 | } | 1670 | } | |
1671 | 1671 | |||
1672 | static void | 1672 | static void | |
1673 | arp_dad_timer(struct ifaddr *ifa) | 1673 | arp_dad_timer(struct ifaddr *ifa) | |
1674 | { | 1674 | { | |
1675 | struct in_ifaddr *ia = (struct in_ifaddr *)ifa; | 1675 | struct in_ifaddr *ia = (struct in_ifaddr *)ifa; | |
1676 | struct dadq *dp; | 1676 | struct dadq *dp; | |
1677 | char ipbuf[INET_ADDRSTRLEN]; | 1677 | char ipbuf[INET_ADDRSTRLEN]; | |
1678 | 1678 | |||
1679 | #ifndef NET_MPSAFE | |||
1679 | mutex_enter(softnet_lock); | 1680 | mutex_enter(softnet_lock); | |
1680 | KERNEL_LOCK(1, NULL); | 1681 | KERNEL_LOCK(1, NULL); | |
1682 | #endif | |||
1681 | mutex_enter(&arp_dad_lock); | 1683 | mutex_enter(&arp_dad_lock); | |
1682 | 1684 | |||
1683 | /* Sanity check */ | 1685 | /* Sanity check */ | |
1684 | if (ia == NULL) { | 1686 | if (ia == NULL) { | |
1685 | log(LOG_ERR, "%s: called with null parameter\n", __func__); | 1687 | log(LOG_ERR, "%s: called with null parameter\n", __func__); | |
1686 | goto done; | 1688 | goto done; | |
1687 | } | 1689 | } | |
1688 | dp = arp_dad_find(ifa); | 1690 | dp = arp_dad_find(ifa); | |
1689 | if (dp == NULL) { | 1691 | if (dp == NULL) { | |
1690 | /* DAD seems to be stopping, so do nothing. */ | 1692 | /* DAD seems to be stopping, so do nothing. */ | |
1691 | goto done; | 1693 | goto done; | |
1692 | } | 1694 | } | |
1693 | if (ia->ia4_flags & IN_IFF_DUPLICATED) { | 1695 | if (ia->ia4_flags & IN_IFF_DUPLICATED) { | |
@@ -1757,28 +1759,30 @@ announce: | @@ -1757,28 +1759,30 @@ announce: | |||
1757 | } | 1759 | } | |
1758 | ARPLOG(LOG_DEBUG, | 1760 | ARPLOG(LOG_DEBUG, | |
1759 | "%s: ARP announcement complete for %s\n", | 1761 | "%s: ARP announcement complete for %s\n", | |
1760 | if_name(ifa->ifa_ifp), ARPLOGADDR(ia->ia_addr.sin_addr)); | 1762 | if_name(ifa->ifa_ifp), ARPLOGADDR(ia->ia_addr.sin_addr)); | |
1761 | } | 1763 | } | |
1762 | 1764 | |||
1763 | TAILQ_REMOVE(&dadq, dp, dad_list); | 1765 | TAILQ_REMOVE(&dadq, dp, dad_list); | |
1764 | free(dp, M_IPARP); | 1766 | free(dp, M_IPARP); | |
1765 | dp = NULL; | 1767 | dp = NULL; | |
1766 | ifafree(ifa); | 1768 | ifafree(ifa); | |
1767 | 1769 | |||
1768 | done: | 1770 | done: | |
1769 | mutex_exit(&arp_dad_lock); | 1771 | mutex_exit(&arp_dad_lock); | |
1772 | #ifndef NET_MPSAFE | |||
1770 | KERNEL_UNLOCK_ONE(NULL); | 1773 | KERNEL_UNLOCK_ONE(NULL); | |
1771 | mutex_exit(softnet_lock); | 1774 | mutex_exit(softnet_lock); | |
1775 | #endif | |||
1772 | } | 1776 | } | |
1773 | 1777 | |||
1774 | static void | 1778 | static void | |
1775 | arp_dad_duplicated(struct ifaddr *ifa, const char *sha) | 1779 | arp_dad_duplicated(struct ifaddr *ifa, const char *sha) | |
1776 | { | 1780 | { | |
1777 | struct in_ifaddr *ia = (struct in_ifaddr *)ifa; | 1781 | struct in_ifaddr *ia = (struct in_ifaddr *)ifa; | |
1778 | struct ifnet *ifp = ifa->ifa_ifp; | 1782 | struct ifnet *ifp = ifa->ifa_ifp; | |
1779 | char ipbuf[INET_ADDRSTRLEN]; | 1783 | char ipbuf[INET_ADDRSTRLEN]; | |
1780 | const char *iastr; | 1784 | const char *iastr; | |
1781 | 1785 | |||
1782 | iastr = in_fmtaddr(ipbuf, ia->ia_addr.sin_addr); | 1786 | iastr = in_fmtaddr(ipbuf, ia->ia_addr.sin_addr); | |
1783 | 1787 | |||
1784 | if (ia->ia4_flags & (IN_IFF_TENTATIVE|IN_IFF_DUPLICATED)) { | 1788 | if (ia->ia4_flags & (IN_IFF_TENTATIVE|IN_IFF_DUPLICATED)) { |
--- src/sys/netinet/igmp.c 2017/01/11 13:08:29 1.63
+++ src/sys/netinet/igmp.c 2017/01/24 07:09:24 1.64
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: igmp.c,v 1.63 2017/01/11 13:08:29 ozaki-r Exp $ */ | 1 | /* $NetBSD: igmp.c,v 1.64 2017/01/24 07:09:24 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. | |
@@ -30,30 +30,31 @@ | @@ -30,30 +30,31 @@ | |||
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Internet Group Management Protocol (IGMP) routines. | 33 | * Internet Group Management Protocol (IGMP) routines. | |
34 | * | 34 | * | |
35 | * Written by Steve Deering, Stanford, May 1988. | 35 | * Written by Steve Deering, Stanford, May 1988. | |
36 | * Modified by Rosen Sharma, Stanford, Aug 1994. | 36 | * Modified by Rosen Sharma, Stanford, Aug 1994. | |
37 | * Modified by Bill Fenner, Xerox PARC, Feb 1995. | 37 | * Modified by Bill Fenner, Xerox PARC, Feb 1995. | |
38 | * | 38 | * | |
39 | * MULTICAST Revision: 1.3 | 39 | * MULTICAST Revision: 1.3 | |
40 | */ | 40 | */ | |
41 | 41 | |||
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | __KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.63 2017/01/11 13:08:29 ozaki-r Exp $"); | 43 | __KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64 2017/01/24 07:09:24 ozaki-r Exp $"); | |
44 | 44 | |||
45 | #ifdef _KERNEL_OPT | 45 | #ifdef _KERNEL_OPT | |
46 | #include "opt_mrouting.h" | 46 | #include "opt_mrouting.h" | |
47 | #include "opt_net_mpsafe.h" | |||
47 | #endif | 48 | #endif | |
48 | 49 | |||
49 | #include <sys/param.h> | 50 | #include <sys/param.h> | |
50 | #include <sys/mbuf.h> | 51 | #include <sys/mbuf.h> | |
51 | #include <sys/socket.h> | 52 | #include <sys/socket.h> | |
52 | #include <sys/socketvar.h> | 53 | #include <sys/socketvar.h> | |
53 | #include <sys/systm.h> | 54 | #include <sys/systm.h> | |
54 | #include <sys/cprng.h> | 55 | #include <sys/cprng.h> | |
55 | #include <sys/sysctl.h> | 56 | #include <sys/sysctl.h> | |
56 | 57 | |||
57 | #include <net/if.h> | 58 | #include <net/if.h> | |
58 | #include <net/net_stats.h> | 59 | #include <net/net_stats.h> | |
59 | 60 | |||
@@ -531,52 +532,56 @@ void | @@ -531,52 +532,56 @@ void | |||
531 | igmp_fasttimo(void) | 532 | igmp_fasttimo(void) | |
532 | { | 533 | { | |
533 | struct in_multi *inm; | 534 | struct in_multi *inm; | |
534 | struct in_multistep step; | 535 | struct in_multistep step; | |
535 | 536 | |||
536 | /* | 537 | /* | |
537 | * Quick check to see if any work needs to be done, in order | 538 | * Quick check to see if any work needs to be done, in order | |
538 | * to minimize the overhead of fasttimo processing. | 539 | * to minimize the overhead of fasttimo processing. | |
539 | */ | 540 | */ | |
540 | if (!igmp_timers_on) { | 541 | if (!igmp_timers_on) { | |
541 | return; | 542 | return; | |
542 | } | 543 | } | |
543 | 544 | |||
545 | #ifndef NET_MPSAFE | |||
544 | /* XXX: Needed for ip_output(). */ | 546 | /* XXX: Needed for ip_output(). */ | |
545 | mutex_enter(softnet_lock); | 547 | mutex_enter(softnet_lock); | |
548 | #endif | |||
546 | 549 | |||
547 | in_multi_lock(RW_WRITER); | 550 | in_multi_lock(RW_WRITER); | |
548 | igmp_timers_on = false; | 551 | igmp_timers_on = false; | |
549 | inm = in_first_multi(&step); | 552 | inm = in_first_multi(&step); | |
550 | while (inm != NULL) { | 553 | while (inm != NULL) { | |
551 | if (inm->inm_timer == 0) { | 554 | if (inm->inm_timer == 0) { | |
552 | /* do nothing */ | 555 | /* do nothing */ | |
553 | } else if (--inm->inm_timer == 0) { | 556 | } else if (--inm->inm_timer == 0) { | |
554 | if (inm->inm_state == IGMP_DELAYING_MEMBER) { | 557 | if (inm->inm_state == IGMP_DELAYING_MEMBER) { | |
555 | if (inm->inm_rti->rti_type == IGMP_v1_ROUTER) | 558 | if (inm->inm_rti->rti_type == IGMP_v1_ROUTER) | |
556 | igmp_sendpkt(inm, | 559 | igmp_sendpkt(inm, | |
557 | IGMP_v1_HOST_MEMBERSHIP_REPORT); | 560 | IGMP_v1_HOST_MEMBERSHIP_REPORT); | |
558 | else | 561 | else | |
559 | igmp_sendpkt(inm, | 562 | igmp_sendpkt(inm, | |
560 | IGMP_v2_HOST_MEMBERSHIP_REPORT); | 563 | IGMP_v2_HOST_MEMBERSHIP_REPORT); | |
561 | inm->inm_state = IGMP_IDLE_MEMBER; | 564 | inm->inm_state = IGMP_IDLE_MEMBER; | |
562 | } | 565 | } | |
563 | } else { | 566 | } else { | |
564 | igmp_timers_on = true; | 567 | igmp_timers_on = true; | |
565 | } | 568 | } | |
566 | inm = in_next_multi(&step); | 569 | inm = in_next_multi(&step); | |
567 | } | 570 | } | |
568 | in_multi_unlock(); | 571 | in_multi_unlock(); | |
572 | #ifndef NET_MPSAFE | |||
569 | mutex_exit(softnet_lock); | 573 | mutex_exit(softnet_lock); | |
574 | #endif | |||
570 | } | 575 | } | |
571 | 576 | |||
572 | void | 577 | void | |
573 | igmp_slowtimo(void) | 578 | igmp_slowtimo(void) | |
574 | { | 579 | { | |
575 | router_info_t *rti; | 580 | router_info_t *rti; | |
576 | 581 | |||
577 | in_multi_lock(RW_WRITER); | 582 | in_multi_lock(RW_WRITER); | |
578 | LIST_FOREACH(rti, &rti_head, rti_link) { | 583 | LIST_FOREACH(rti, &rti_head, rti_link) { | |
579 | if (rti->rti_type == IGMP_v1_ROUTER && | 584 | if (rti->rti_type == IGMP_v1_ROUTER && | |
580 | ++rti->rti_age >= IGMP_AGE_THRESHOLD) { | 585 | ++rti->rti_age >= IGMP_AGE_THRESHOLD) { | |
581 | rti->rti_type = IGMP_v2_ROUTER; | 586 | rti->rti_type = IGMP_v2_ROUTER; | |
582 | } | 587 | } | |
@@ -639,27 +644,29 @@ igmp_sendpkt(struct in_multi *inm, int t | @@ -639,27 +644,29 @@ igmp_sendpkt(struct in_multi *inm, int t | |||
639 | * router, so that the process-level routing demon can hear it. | 644 | * router, so that the process-level routing demon can hear it. | |
640 | */ | 645 | */ | |
641 | #ifdef MROUTING | 646 | #ifdef MROUTING | |
642 | extern struct socket *ip_mrouter; | 647 | extern struct socket *ip_mrouter; | |
643 | imo.imo_multicast_loop = (ip_mrouter != NULL); | 648 | imo.imo_multicast_loop = (ip_mrouter != NULL); | |
644 | #else | 649 | #else | |
645 | imo.imo_multicast_loop = 0; | 650 | imo.imo_multicast_loop = 0; | |
646 | #endif | 651 | #endif | |
647 | 652 | |||
648 | /* | 653 | /* | |
649 | * Note: IP_IGMP_MCAST indicates that in_multilock is held. | 654 | * Note: IP_IGMP_MCAST indicates that in_multilock is held. | |
650 | * The caller must still acquire softnet_lock for ip_output(). | 655 | * The caller must still acquire softnet_lock for ip_output(). | |
651 | */ | 656 | */ | |
657 | #ifndef NET_MPSAFE | |||
652 | KASSERT(mutex_owned(softnet_lock)); | 658 | KASSERT(mutex_owned(softnet_lock)); | |
659 | #endif | |||
653 | ip_output(m, NULL, NULL, IP_IGMP_MCAST, &imo, NULL); | 660 | ip_output(m, NULL, NULL, IP_IGMP_MCAST, &imo, NULL); | |
654 | IGMP_STATINC(IGMP_STAT_SND_REPORTS); | 661 | IGMP_STATINC(IGMP_STAT_SND_REPORTS); | |
655 | } | 662 | } | |
656 | 663 | |||
657 | void | 664 | void | |
658 | igmp_purgeif(ifnet_t *ifp) | 665 | igmp_purgeif(ifnet_t *ifp) | |
659 | { | 666 | { | |
660 | in_multi_lock(RW_WRITER); | 667 | in_multi_lock(RW_WRITER); | |
661 | rti_delete(ifp); | 668 | rti_delete(ifp); | |
662 | in_multi_unlock(); | 669 | in_multi_unlock(); | |
663 | } | 670 | } | |
664 | 671 | |||
665 | static int | 672 | static int |
--- src/sys/netinet/ip_icmp.c 2016/12/12 03:55:57 1.154
+++ src/sys/netinet/ip_icmp.c 2017/01/24 07:09:24 1.155
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_icmp.c,v 1.154 2016/12/12 03:55:57 ozaki-r Exp $ */ | 1 | /* $NetBSD: ip_icmp.c,v 1.155 2017/01/24 07:09:24 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. | |
@@ -84,37 +84,38 @@ | @@ -84,37 +84,38 @@ | |||
84 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 84 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
85 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 85 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
86 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 86 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
87 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 87 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
88 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 88 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
89 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 89 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
90 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 90 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
91 | * SUCH DAMAGE. | 91 | * SUCH DAMAGE. | |
92 | * | 92 | * | |
93 | * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 | 93 | * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 | |
94 | */ | 94 | */ | |
95 | 95 | |||
96 | #include <sys/cdefs.h> | 96 | #include <sys/cdefs.h> | |
97 | __KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.154 2016/12/12 03:55:57 ozaki-r Exp $"); | 97 | __KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.155 2017/01/24 07:09:24 ozaki-r Exp $"); | |
98 | 98 | |||
99 | #ifdef _KERNEL_OPT | 99 | #ifdef _KERNEL_OPT | |
100 | #include "opt_ipsec.h" | 100 | #include "opt_ipsec.h" | |
101 | #endif | 101 | #endif | |
102 | 102 | |||
103 | #include <sys/param.h> | 103 | #include <sys/param.h> | |
104 | #include <sys/systm.h> | 104 | #include <sys/systm.h> | |
105 | #include <sys/mbuf.h> | 105 | #include <sys/mbuf.h> | |
106 | #include <sys/protosw.h> | 106 | #include <sys/protosw.h> | |
107 | #include <sys/socket.h> | 107 | #include <sys/socket.h> | |
108 | #include <sys/socketvar.h> /* For softnet_lock */ | |||
108 | #include <sys/kmem.h> | 109 | #include <sys/kmem.h> | |
109 | #include <sys/time.h> | 110 | #include <sys/time.h> | |
110 | #include <sys/kernel.h> | 111 | #include <sys/kernel.h> | |
111 | #include <sys/syslog.h> | 112 | #include <sys/syslog.h> | |
112 | #include <sys/sysctl.h> | 113 | #include <sys/sysctl.h> | |
113 | 114 | |||
114 | #include <net/if.h> | 115 | #include <net/if.h> | |
115 | #include <net/route.h> | 116 | #include <net/route.h> | |
116 | 117 | |||
117 | #include <netinet/in.h> | 118 | #include <netinet/in.h> | |
118 | #include <netinet/in_systm.h> | 119 | #include <netinet/in_systm.h> | |
119 | #include <netinet/in_var.h> | 120 | #include <netinet/in_var.h> | |
120 | #include <netinet/ip.h> | 121 | #include <netinet/ip.h> | |
@@ -1002,43 +1003,48 @@ sysctl_net_inet_icmp_redirtimeout(SYSCTL | @@ -1002,43 +1003,48 @@ sysctl_net_inet_icmp_redirtimeout(SYSCTL | |||
1002 | int error, tmp; | 1003 | int error, tmp; | |
1003 | struct sysctlnode node; | 1004 | struct sysctlnode node; | |
1004 | 1005 | |||
1005 | node = *rnode; | 1006 | node = *rnode; | |
1006 | node.sysctl_data = &tmp; | 1007 | node.sysctl_data = &tmp; | |
1007 | tmp = icmp_redirtimeout; | 1008 | tmp = icmp_redirtimeout; | |
1008 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | 1009 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |
1009 | if (error || newp == NULL) | 1010 | if (error || newp == NULL) | |
1010 | return (error); | 1011 | return (error); | |
1011 | if (tmp < 0) | 1012 | if (tmp < 0) | |
1012 | return (EINVAL); | 1013 | return (EINVAL); | |
1013 | icmp_redirtimeout = tmp; | 1014 | icmp_redirtimeout = tmp; | |
1014 | 1015 | |||
1016 | /* XXX NOMPSAFE still need softnet_lock */ | |||
1017 | mutex_enter(softnet_lock); | |||
1018 | ||||
1015 | /* | 1019 | /* | |
1016 | * was it a *defined* side-effect that anyone even *reading* | 1020 | * was it a *defined* side-effect that anyone even *reading* | |
1017 | * this value causes these things to happen? | 1021 | * this value causes these things to happen? | |
1018 | */ | 1022 | */ | |
1019 | if (icmp_redirect_timeout_q != NULL) { | 1023 | if (icmp_redirect_timeout_q != NULL) { | |
1020 | if (icmp_redirtimeout == 0) { | 1024 | if (icmp_redirtimeout == 0) { | |
1021 | rt_timer_queue_destroy(icmp_redirect_timeout_q); | 1025 | rt_timer_queue_destroy(icmp_redirect_timeout_q); | |
1022 | icmp_redirect_timeout_q = NULL; | 1026 | icmp_redirect_timeout_q = NULL; | |
1023 | } else { | 1027 | } else { | |
1024 | rt_timer_queue_change(icmp_redirect_timeout_q, | 1028 | rt_timer_queue_change(icmp_redirect_timeout_q, | |
1025 | icmp_redirtimeout); | 1029 | icmp_redirtimeout); | |
1026 | } | 1030 | } | |
1027 | } else if (icmp_redirtimeout > 0) { | 1031 | } else if (icmp_redirtimeout > 0) { | |
1028 | icmp_redirect_timeout_q = | 1032 | icmp_redirect_timeout_q = | |
1029 | rt_timer_queue_create(icmp_redirtimeout); | 1033 | rt_timer_queue_create(icmp_redirtimeout); | |
1030 | } | 1034 | } | |
1031 | 1035 | |||
1036 | mutex_exit(softnet_lock); | |||
1037 | ||||
1032 | return (0); | 1038 | return (0); | |
1033 | } | 1039 | } | |
1034 | 1040 | |||
1035 | static int | 1041 | static int | |
1036 | sysctl_net_inet_icmp_stats(SYSCTLFN_ARGS) | 1042 | sysctl_net_inet_icmp_stats(SYSCTLFN_ARGS) | |
1037 | { | 1043 | { | |
1038 | 1044 | |||
1039 | return (NETSTAT_SYSCTL(icmpstat_percpu, ICMP_NSTATS)); | 1045 | return (NETSTAT_SYSCTL(icmpstat_percpu, ICMP_NSTATS)); | |
1040 | } | 1046 | } | |
1041 | 1047 | |||
1042 | static void | 1048 | static void | |
1043 | sysctl_netinet_icmp_setup(struct sysctllog **clog) | 1049 | sysctl_netinet_icmp_setup(struct sysctllog **clog) | |
1044 | { | 1050 | { |
--- src/sys/netinet/ip_input.c 2016/12/12 03:55:57 1.347
+++ src/sys/netinet/ip_input.c 2017/01/24 07:09:24 1.348
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_input.c,v 1.347 2016/12/12 03:55:57 ozaki-r Exp $ */ | 1 | /* $NetBSD: ip_input.c,v 1.348 2017/01/24 07:09:24 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_input.c 8.2 (Berkeley) 1/4/94 | 90 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | |
91 | */ | 91 | */ | |
92 | 92 | |||
93 | #include <sys/cdefs.h> | 93 | #include <sys/cdefs.h> | |
94 | __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.347 2016/12/12 03:55:57 ozaki-r Exp $"); | 94 | __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.348 2017/01/24 07:09:24 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_compat_netbsd.h" | 98 | #include "opt_compat_netbsd.h" | |
99 | #include "opt_gateway.h" | 99 | #include "opt_gateway.h" | |
100 | #include "opt_ipsec.h" | 100 | #include "opt_ipsec.h" | |
101 | #include "opt_mrouting.h" | 101 | #include "opt_mrouting.h" | |
102 | #include "opt_mbuftrace.h" | 102 | #include "opt_mbuftrace.h" | |
103 | #include "opt_inet_csum.h" | 103 | #include "opt_inet_csum.h" | |
104 | #include "opt_net_mpsafe.h" | 104 | #include "opt_net_mpsafe.h" | |
105 | #endif | 105 | #endif | |
106 | 106 | |||
107 | #include "arp.h" | 107 | #include "arp.h" | |
@@ -856,33 +856,37 @@ ours: | @@ -856,33 +856,37 @@ ours: | |||
856 | out: | 856 | out: | |
857 | m_put_rcvif_psref(ifp, &psref); | 857 | m_put_rcvif_psref(ifp, &psref); | |
858 | if (m != NULL) | 858 | if (m != NULL) | |
859 | m_freem(m); | 859 | m_freem(m); | |
860 | } | 860 | } | |
861 | 861 | |||
862 | /* | 862 | /* | |
863 | * IP timer processing. | 863 | * IP timer processing. | |
864 | */ | 864 | */ | |
865 | void | 865 | void | |
866 | ip_slowtimo(void) | 866 | ip_slowtimo(void) | |
867 | { | 867 | { | |
868 | 868 | |||
869 | #ifndef NET_MPSAFE | |||
869 | mutex_enter(softnet_lock); | 870 | mutex_enter(softnet_lock); | |
870 | KERNEL_LOCK(1, NULL); | 871 | KERNEL_LOCK(1, NULL); | |
872 | #endif | |||
871 | 873 | |||
872 | ip_reass_slowtimo(); | 874 | ip_reass_slowtimo(); | |
873 | 875 | |||
876 | #ifndef NET_MPSAFE | |||
874 | KERNEL_UNLOCK_ONE(NULL); | 877 | KERNEL_UNLOCK_ONE(NULL); | |
875 | mutex_exit(softnet_lock); | 878 | mutex_exit(softnet_lock); | |
879 | #endif | |||
876 | } | 880 | } | |
877 | 881 | |||
878 | /* | 882 | /* | |
879 | * IP drain processing. | 883 | * IP drain processing. | |
880 | */ | 884 | */ | |
881 | void | 885 | void | |
882 | ip_drain(void) | 886 | ip_drain(void) | |
883 | { | 887 | { | |
884 | 888 | |||
885 | KERNEL_LOCK(1, NULL); | 889 | KERNEL_LOCK(1, NULL); | |
886 | ip_reass_drain(); | 890 | ip_reass_drain(); | |
887 | KERNEL_UNLOCK_ONE(NULL); | 891 | KERNEL_UNLOCK_ONE(NULL); | |
888 | } | 892 | } | |
@@ -1593,26 +1597,27 @@ sysctl_net_inet_ip_pmtudto(SYSCTLFN_ARGS | @@ -1593,26 +1597,27 @@ sysctl_net_inet_ip_pmtudto(SYSCTLFN_ARGS | |||
1593 | { | 1597 | { | |
1594 | int error, tmp; | 1598 | int error, tmp; | |
1595 | struct sysctlnode node; | 1599 | struct sysctlnode node; | |
1596 | 1600 | |||
1597 | node = *rnode; | 1601 | node = *rnode; | |
1598 | tmp = ip_mtudisc_timeout; | 1602 | tmp = ip_mtudisc_timeout; | |
1599 | node.sysctl_data = &tmp; | 1603 | node.sysctl_data = &tmp; | |
1600 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | 1604 | error = sysctl_lookup(SYSCTLFN_CALL(&node)); | |
1601 | if (error || newp == NULL) | 1605 | if (error || newp == NULL) | |
1602 | return (error); | 1606 | return (error); | |
1603 | if (tmp < 0) | 1607 | if (tmp < 0) | |
1604 | return (EINVAL); | 1608 | return (EINVAL); | |
1605 | 1609 | |||
1610 | /* XXX NOMPSAFE still need softnet_lock */ | |||
1606 | mutex_enter(softnet_lock); | 1611 | mutex_enter(softnet_lock); | |
1607 | 1612 | |||
1608 | ip_mtudisc_timeout = tmp; | 1613 | ip_mtudisc_timeout = tmp; | |
1609 | rt_timer_queue_change(ip_mtudisc_timeout_q, ip_mtudisc_timeout); | 1614 | rt_timer_queue_change(ip_mtudisc_timeout_q, ip_mtudisc_timeout); | |
1610 | 1615 | |||
1611 | mutex_exit(softnet_lock); | 1616 | mutex_exit(softnet_lock); | |
1612 | 1617 | |||
1613 | return (0); | 1618 | return (0); | |
1614 | } | 1619 | } | |
1615 | 1620 | |||
1616 | static int | 1621 | static int | |
1617 | sysctl_net_inet_ip_stats(SYSCTLFN_ARGS) | 1622 | sysctl_net_inet_ip_stats(SYSCTLFN_ARGS) | |
1618 | { | 1623 | { |
--- src/sys/netinet/ip_mroute.c 2017/01/11 13:08:29 1.145
+++ src/sys/netinet/ip_mroute.c 2017/01/24 07:09:24 1.146
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_mroute.c,v 1.145 2017/01/11 13:08:29 ozaki-r Exp $ */ | 1 | /* $NetBSD: ip_mroute.c,v 1.146 2017/01/24 07:09:24 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1992, 1993 | 4 | * Copyright (c) 1992, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Stephen Deering of Stanford University. | 8 | * Stephen Deering of Stanford University. | |
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. | |
@@ -83,27 +83,27 @@ | @@ -83,27 +83,27 @@ | |||
83 | * Modified by Charles M. Hannum, NetBSD, May 1995. | 83 | * Modified by Charles M. Hannum, NetBSD, May 1995. | |
84 | * Modified by Ahmed Helmy, SGI, June 1996 | 84 | * Modified by Ahmed Helmy, SGI, June 1996 | |
85 | * Modified by George Edmond Eddy (Rusty), ISI, February 1998 | 85 | * Modified by George Edmond Eddy (Rusty), ISI, February 1998 | |
86 | * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 | 86 | * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 | |
87 | * Modified by Hitoshi Asaeda, WIDE, August 2000 | 87 | * Modified by Hitoshi Asaeda, WIDE, August 2000 | |
88 | * Modified by Pavlin Radoslavov, ICSI, October 2002 | 88 | * Modified by Pavlin Radoslavov, ICSI, October 2002 | |
89 | * | 89 | * | |
90 | * MROUTING Revision: 1.2 | 90 | * MROUTING Revision: 1.2 | |
91 | * and PIM-SMv2 and PIM-DM support, advanced API support, | 91 | * and PIM-SMv2 and PIM-DM support, advanced API support, | |
92 | * bandwidth metering and signaling | 92 | * bandwidth metering and signaling | |
93 | */ | 93 | */ | |
94 | 94 | |||
95 | #include <sys/cdefs.h> | 95 | #include <sys/cdefs.h> | |
96 | __KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.145 2017/01/11 13:08:29 ozaki-r Exp $"); | 96 | __KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.146 2017/01/24 07:09:24 ozaki-r Exp $"); | |
97 | 97 | |||
98 | #ifdef _KERNEL_OPT | 98 | #ifdef _KERNEL_OPT | |
99 | #include "opt_inet.h" | 99 | #include "opt_inet.h" | |
100 | #include "opt_ipsec.h" | 100 | #include "opt_ipsec.h" | |
101 | #include "opt_pim.h" | 101 | #include "opt_pim.h" | |
102 | #endif | 102 | #endif | |
103 | 103 | |||
104 | #ifdef PIM | 104 | #ifdef PIM | |
105 | #define _PIM_VT 1 | 105 | #define _PIM_VT 1 | |
106 | #endif | 106 | #endif | |
107 | 107 | |||
108 | #include <sys/param.h> | 108 | #include <sys/param.h> | |
109 | #include <sys/systm.h> | 109 | #include <sys/systm.h> | |
@@ -1551,29 +1551,30 @@ ip_mforward(struct mbuf *m, struct ifnet | @@ -1551,29 +1551,30 @@ ip_mforward(struct mbuf *m, struct ifnet | |||
1551 | 1551 | |||
1552 | splx(s); | 1552 | splx(s); | |
1553 | 1553 | |||
1554 | return (0); | 1554 | return (0); | |
1555 | } | 1555 | } | |
1556 | } | 1556 | } | |
1557 | 1557 | |||
1558 | 1558 | |||
1559 | /*ARGSUSED*/ | 1559 | /*ARGSUSED*/ | |
1560 | static void | 1560 | static void | |
1561 | expire_upcalls(void *v) | 1561 | expire_upcalls(void *v) | |
1562 | { | 1562 | { | |
1563 | int i; | 1563 | int i; | |
1564 | int s; | |||
1565 | 1564 | |||
1566 | s = splsoftnet(); | 1565 | /* XXX NOMPSAFE still need softnet_lock */ | |
1566 | mutex_enter(softnet_lock); | |||
1567 | KERNEL_LOCK(1, NULL); | |||
1567 | 1568 | |||
1568 | for (i = 0; i < MFCTBLSIZ; i++) { | 1569 | for (i = 0; i < MFCTBLSIZ; i++) { | |
1569 | struct mfc *rt, *nrt; | 1570 | struct mfc *rt, *nrt; | |
1570 | 1571 | |||
1571 | if (nexpire[i] == 0) | 1572 | if (nexpire[i] == 0) | |
1572 | continue; | 1573 | continue; | |
1573 | 1574 | |||
1574 | for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { | 1575 | for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { | |
1575 | nrt = LIST_NEXT(rt, mfc_hash); | 1576 | nrt = LIST_NEXT(rt, mfc_hash); | |
1576 | 1577 | |||
1577 | if (rt->mfc_expire == 0 || --rt->mfc_expire > 0) | 1578 | if (rt->mfc_expire == 0 || --rt->mfc_expire > 0) | |
1578 | continue; | 1579 | continue; | |
1579 | nexpire[i]--; | 1580 | nexpire[i]--; | |
@@ -1589,29 +1590,31 @@ expire_upcalls(void *v) | @@ -1589,29 +1590,31 @@ expire_upcalls(void *v) | |||
1589 | } | 1590 | } | |
1590 | 1591 | |||
1591 | ++mrtstat.mrts_cache_cleanups; | 1592 | ++mrtstat.mrts_cache_cleanups; | |
1592 | if (mrtdebug & DEBUG_EXPIRE) | 1593 | if (mrtdebug & DEBUG_EXPIRE) | |
1593 | log(LOG_DEBUG, | 1594 | log(LOG_DEBUG, | |
1594 | "expire_upcalls: expiring (%x %x)\n", | 1595 | "expire_upcalls: expiring (%x %x)\n", | |
1595 | ntohl(rt->mfc_origin.s_addr), | 1596 | ntohl(rt->mfc_origin.s_addr), | |
1596 | ntohl(rt->mfc_mcastgrp.s_addr)); | 1597 | ntohl(rt->mfc_mcastgrp.s_addr)); | |
1597 | 1598 | |||
1598 | expire_mfc(rt); | 1599 | expire_mfc(rt); | |
1599 | } | 1600 | } | |
1600 | } | 1601 | } | |
1601 | 1602 | |||
1602 | splx(s); | |||
1603 | callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, | 1603 | callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, | |
1604 | expire_upcalls, NULL); | 1604 | expire_upcalls, NULL); | |
1605 | ||||
1606 | KERNEL_UNLOCK_ONE(NULL); | |||
1607 | mutex_exit(softnet_lock); | |||
1605 | } | 1608 | } | |
1606 | 1609 | |||
1607 | /* | 1610 | /* | |
1608 | * Packet forwarding routine once entry in the cache is made | 1611 | * Packet forwarding routine once entry in the cache is made | |
1609 | */ | 1612 | */ | |
1610 | static int | 1613 | static int | |
1611 | #ifdef RSVP_ISI | 1614 | #ifdef RSVP_ISI | |
1612 | ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) | 1615 | ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) | |
1613 | #else | 1616 | #else | |
1614 | ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt) | 1617 | ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt) | |
1615 | #endif /* RSVP_ISI */ | 1618 | #endif /* RSVP_ISI */ | |
1616 | { | 1619 | { | |
1617 | struct ip *ip = mtod(m, struct ip *); | 1620 | struct ip *ip = mtod(m, struct ip *); |
--- src/sys/netinet/raw_ip.c 2016/09/29 12:19:47 1.161
+++ src/sys/netinet/raw_ip.c 2017/01/24 07:09:24 1.162
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: raw_ip.c,v 1.161 2016/09/29 12:19:47 roy Exp $ */ | 1 | /* $NetBSD: raw_ip.c,v 1.162 2017/01/24 07:09:24 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. | |
@@ -55,33 +55,34 @@ | @@ -55,33 +55,34 @@ | |||
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | 58 | * SUCH DAMAGE. | |
59 | * | 59 | * | |
60 | * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 | 60 | * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | /* | 63 | /* | |
64 | * Raw interface to IP protocol. | 64 | * Raw interface to IP protocol. | |
65 | */ | 65 | */ | |
66 | 66 | |||
67 | #include <sys/cdefs.h> | 67 | #include <sys/cdefs.h> | |
68 | __KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.161 2016/09/29 12:19:47 roy Exp $"); | 68 | __KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.162 2017/01/24 07:09:24 ozaki-r Exp $"); | |
69 | 69 | |||
70 | #ifdef _KERNEL_OPT | 70 | #ifdef _KERNEL_OPT | |
71 | #include "opt_inet.h" | 71 | #include "opt_inet.h" | |
72 | #include "opt_compat_netbsd.h" | 72 | #include "opt_compat_netbsd.h" | |
73 | #include "opt_ipsec.h" | 73 | #include "opt_ipsec.h" | |
74 | #include "opt_mrouting.h" | 74 | #include "opt_mrouting.h" | |
75 | #include "opt_net_mpsafe.h" | |||
75 | #endif | 76 | #endif | |
76 | 77 | |||
77 | #include <sys/param.h> | 78 | #include <sys/param.h> | |
78 | #include <sys/sysctl.h> | 79 | #include <sys/sysctl.h> | |
79 | #include <sys/mbuf.h> | 80 | #include <sys/mbuf.h> | |
80 | #include <sys/socket.h> | 81 | #include <sys/socket.h> | |
81 | #include <sys/protosw.h> | 82 | #include <sys/protosw.h> | |
82 | #include <sys/socketvar.h> | 83 | #include <sys/socketvar.h> | |
83 | #include <sys/errno.h> | 84 | #include <sys/errno.h> | |
84 | #include <sys/systm.h> | 85 | #include <sys/systm.h> | |
85 | #include <sys/proc.h> | 86 | #include <sys/proc.h> | |
86 | #include <sys/kauth.h> | 87 | #include <sys/kauth.h> | |
87 | 88 | |||
@@ -796,27 +797,33 @@ rip_sendoob(struct socket *so, struct mb | @@ -796,27 +797,33 @@ rip_sendoob(struct socket *so, struct mb | |||
796 | m_freem(control); | 797 | m_freem(control); | |
797 | 798 | |||
798 | return EOPNOTSUPP; | 799 | return EOPNOTSUPP; | |
799 | } | 800 | } | |
800 | 801 | |||
801 | static int | 802 | static int | |
802 | rip_purgeif(struct socket *so, struct ifnet *ifp) | 803 | rip_purgeif(struct socket *so, struct ifnet *ifp) | |
803 | { | 804 | { | |
804 | int s; | 805 | int s; | |
805 | 806 | |||
806 | s = splsoftnet(); | 807 | s = splsoftnet(); | |
807 | mutex_enter(softnet_lock); | 808 | mutex_enter(softnet_lock); | |
808 | in_pcbpurgeif0(&rawcbtable, ifp); | 809 | in_pcbpurgeif0(&rawcbtable, ifp); | |
810 | #ifdef NET_MPSAFE | |||
811 | mutex_exit(softnet_lock); | |||
812 | #endif | |||
809 | in_purgeif(ifp); | 813 | in_purgeif(ifp); | |
814 | #ifdef NET_MPSAFE | |||
815 | mutex_enter(softnet_lock); | |||
816 | #endif | |||
810 | in_pcbpurgeif(&rawcbtable, ifp); | 817 | in_pcbpurgeif(&rawcbtable, ifp); | |
811 | mutex_exit(softnet_lock); | 818 | mutex_exit(softnet_lock); | |
812 | splx(s); | 819 | splx(s); | |
813 | 820 | |||
814 | return 0; | 821 | return 0; | |
815 | } | 822 | } | |
816 | 823 | |||
817 | PR_WRAP_USRREQS(rip) | 824 | PR_WRAP_USRREQS(rip) | |
818 | #define rip_attach rip_attach_wrapper | 825 | #define rip_attach rip_attach_wrapper | |
819 | #define rip_detach rip_detach_wrapper | 826 | #define rip_detach rip_detach_wrapper | |
820 | #define rip_accept rip_accept_wrapper | 827 | #define rip_accept rip_accept_wrapper | |
821 | #define rip_bind rip_bind_wrapper | 828 | #define rip_bind rip_bind_wrapper | |
822 | #define rip_listen rip_listen_wrapper | 829 | #define rip_listen rip_listen_wrapper |
--- src/sys/netinet/tcp_usrreq.c 2016/11/18 06:50:04 1.213
+++ src/sys/netinet/tcp_usrreq.c 2017/01/24 07:09:24 1.214
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: tcp_usrreq.c,v 1.213 2016/11/18 06:50:04 knakahara Exp $ */ | 1 | /* $NetBSD: tcp_usrreq.c,v 1.214 2017/01/24 07:09:24 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. | |
@@ -89,27 +89,27 @@ | @@ -89,27 +89,27 @@ | |||
89 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 89 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
90 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 90 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
91 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 91 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
92 | * SUCH DAMAGE. | 92 | * SUCH DAMAGE. | |
93 | * | 93 | * | |
94 | * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95 | 94 | * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95 | |
95 | */ | 95 | */ | |
96 | 96 | |||
97 | /* | 97 | /* | |
98 | * TCP protocol interface to socket abstraction. | 98 | * TCP protocol interface to socket abstraction. | |
99 | */ | 99 | */ | |
100 | 100 | |||
101 | #include <sys/cdefs.h> | 101 | #include <sys/cdefs.h> | |
102 | __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.213 2016/11/18 06:50:04 knakahara Exp $"); | 102 | __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.214 2017/01/24 07:09:24 ozaki-r Exp $"); | |
103 | 103 | |||
104 | #ifdef _KERNEL_OPT | 104 | #ifdef _KERNEL_OPT | |
105 | #include "opt_inet.h" | 105 | #include "opt_inet.h" | |
106 | #include "opt_tcp_debug.h" | 106 | #include "opt_tcp_debug.h" | |
107 | #include "opt_mbuftrace.h" | 107 | #include "opt_mbuftrace.h" | |
108 | #include "opt_tcp_space.h" | 108 | #include "opt_tcp_space.h" | |
109 | #include "opt_net_mpsafe.h" | 109 | #include "opt_net_mpsafe.h" | |
110 | #endif | 110 | #endif | |
111 | 111 | |||
112 | #include <sys/param.h> | 112 | #include <sys/param.h> | |
113 | #include <sys/systm.h> | 113 | #include <sys/systm.h> | |
114 | #include <sys/kernel.h> | 114 | #include <sys/kernel.h> | |
115 | #include <sys/mbuf.h> | 115 | #include <sys/mbuf.h> | |
@@ -1200,51 +1200,59 @@ tcp_sendoob(struct socket *so, struct mb | @@ -1200,51 +1200,59 @@ tcp_sendoob(struct socket *so, struct mb | |||
1200 | splx(s); | 1200 | splx(s); | |
1201 | 1201 | |||
1202 | return error; | 1202 | return error; | |
1203 | } | 1203 | } | |
1204 | 1204 | |||
1205 | static int | 1205 | static int | |
1206 | tcp_purgeif(struct socket *so, struct ifnet *ifp) | 1206 | tcp_purgeif(struct socket *so, struct ifnet *ifp) | |
1207 | { | 1207 | { | |
1208 | int s; | 1208 | int s; | |
1209 | int error = 0; | 1209 | int error = 0; | |
1210 | 1210 | |||
1211 | s = splsoftnet(); | 1211 | s = splsoftnet(); | |
1212 | 1212 | |||
1213 | #ifndef NET_MPSAFE | |||
1214 | mutex_enter(softnet_lock); | 1213 | mutex_enter(softnet_lock); | |
1215 | #endif | |||
1216 | switch (so->so_proto->pr_domain->dom_family) { | 1214 | switch (so->so_proto->pr_domain->dom_family) { | |
1217 | #ifdef INET | 1215 | #ifdef INET | |
1218 | case PF_INET: | 1216 | case PF_INET: | |
1219 | in_pcbpurgeif0(&tcbtable, ifp); | 1217 | in_pcbpurgeif0(&tcbtable, ifp); | |
1218 | #ifdef NET_MPSAFE | |||
1219 | mutex_exit(softnet_lock); | |||
1220 | #endif | |||
1220 | in_purgeif(ifp); | 1221 | in_purgeif(ifp); | |
1222 | #ifdef NET_MPSAFE | |||
1223 | mutex_enter(softnet_lock); | |||
1224 | #endif | |||
1221 | in_pcbpurgeif(&tcbtable, ifp); | 1225 | in_pcbpurgeif(&tcbtable, ifp); | |
1222 | break; | 1226 | break; | |
1223 | #endif | 1227 | #endif | |
1224 | #ifdef INET6 | 1228 | #ifdef INET6 | |
1225 | case PF_INET6: | 1229 | case PF_INET6: | |
1226 | in6_pcbpurgeif0(&tcbtable, ifp); | 1230 | in6_pcbpurgeif0(&tcbtable, ifp); | |
1231 | #ifdef NET_MPSAFE | |||
1232 | mutex_exit(softnet_lock); | |||
1233 | #endif | |||
1227 | in6_purgeif(ifp); | 1234 | in6_purgeif(ifp); | |
1235 | #ifdef NET_MPSAFE | |||
1236 | mutex_enter(softnet_lock); | |||
1237 | #endif | |||
1228 | in6_pcbpurgeif(&tcbtable, ifp); | 1238 | in6_pcbpurgeif(&tcbtable, ifp); | |
1229 | break; | 1239 | break; | |
1230 | #endif | 1240 | #endif | |
1231 | default: | 1241 | default: | |
1232 | error = EAFNOSUPPORT; | 1242 | error = EAFNOSUPPORT; | |
1233 | break; | 1243 | break; | |
1234 | } | 1244 | } | |
1235 | #ifndef NET_MPSAFE | |||
1236 | mutex_exit(softnet_lock); | 1245 | mutex_exit(softnet_lock); | |
1237 | #endif | |||
1238 | splx(s); | 1246 | splx(s); | |
1239 | 1247 | |||
1240 | return error; | 1248 | return error; | |
1241 | } | 1249 | } | |
1242 | 1250 | |||
1243 | /* | 1251 | /* | |
1244 | * Initiate (or continue) disconnect. | 1252 | * Initiate (or continue) disconnect. | |
1245 | * If embryonic state, just send reset (once). | 1253 | * If embryonic state, just send reset (once). | |
1246 | * If in ``let data drain'' option and linger null, just drop. | 1254 | * If in ``let data drain'' option and linger null, just drop. | |
1247 | * Otherwise (hard), mark socket disconnecting and drop | 1255 | * Otherwise (hard), mark socket disconnecting and drop | |
1248 | * current input data; switch states based on user close, and | 1256 | * current input data; switch states based on user close, and | |
1249 | * send segment to peer (with FIN). | 1257 | * send segment to peer (with FIN). | |
1250 | */ | 1258 | */ |
--- src/sys/netinet/udp_usrreq.c 2016/11/18 06:50:04 1.229
+++ src/sys/netinet/udp_usrreq.c 2017/01/24 07:09:24 1.230
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: udp_usrreq.c,v 1.229 2016/11/18 06:50:04 knakahara Exp $ */ | 1 | /* $NetBSD: udp_usrreq.c,v 1.230 2017/01/24 07:09:24 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. | |
@@ -56,27 +56,27 @@ | @@ -56,27 +56,27 @@ | |||
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | 58 | * SUCH DAMAGE. | |
59 | * | 59 | * | |
60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 | 60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | /* | 63 | /* | |
64 | * UDP protocol implementation. | 64 | * UDP protocol implementation. | |
65 | * Per RFC 768, August, 1980. | 65 | * Per RFC 768, August, 1980. | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | #include <sys/cdefs.h> | 68 | #include <sys/cdefs.h> | |
69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.229 2016/11/18 06:50:04 knakahara Exp $"); | 69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.230 2017/01/24 07:09:24 ozaki-r Exp $"); | |
70 | 70 | |||
71 | #ifdef _KERNEL_OPT | 71 | #ifdef _KERNEL_OPT | |
72 | #include "opt_inet.h" | 72 | #include "opt_inet.h" | |
73 | #include "opt_compat_netbsd.h" | 73 | #include "opt_compat_netbsd.h" | |
74 | #include "opt_ipsec.h" | 74 | #include "opt_ipsec.h" | |
75 | #include "opt_inet_csum.h" | 75 | #include "opt_inet_csum.h" | |
76 | #include "opt_ipkdb.h" | 76 | #include "opt_ipkdb.h" | |
77 | #include "opt_mbuftrace.h" | 77 | #include "opt_mbuftrace.h" | |
78 | #include "opt_net_mpsafe.h" | 78 | #include "opt_net_mpsafe.h" | |
79 | #endif | 79 | #endif | |
80 | 80 | |||
81 | #include <sys/param.h> | 81 | #include <sys/param.h> | |
82 | #include <sys/mbuf.h> | 82 | #include <sys/mbuf.h> | |
@@ -1130,35 +1130,37 @@ udp_sendoob(struct socket *so, struct mb | @@ -1130,35 +1130,37 @@ udp_sendoob(struct socket *so, struct mb | |||
1130 | 1130 | |||
1131 | m_freem(m); | 1131 | m_freem(m); | |
1132 | m_freem(control); | 1132 | m_freem(control); | |
1133 | 1133 | |||
1134 | return EOPNOTSUPP; | 1134 | return EOPNOTSUPP; | |
1135 | } | 1135 | } | |
1136 | 1136 | |||
1137 | static int | 1137 | static int | |
1138 | udp_purgeif(struct socket *so, struct ifnet *ifp) | 1138 | udp_purgeif(struct socket *so, struct ifnet *ifp) | |
1139 | { | 1139 | { | |
1140 | int s; | 1140 | int s; | |
1141 | 1141 | |||
1142 | s = splsoftnet(); | 1142 | s = splsoftnet(); | |
1143 | #ifndef NET_MPSAFE | |||
1144 | mutex_enter(softnet_lock); | 1143 | mutex_enter(softnet_lock); | |
1145 | #endif | |||
1146 | in_pcbpurgeif0(&udbtable, ifp); | 1144 | in_pcbpurgeif0(&udbtable, ifp); | |
1145 | #ifdef NET_MPSAFE | |||
1146 | mutex_exit(softnet_lock); | |||
1147 | #endif | |||
1147 | in_purgeif(ifp); | 1148 | in_purgeif(ifp); | |
1149 | #ifdef NET_MPSAFE | |||
1150 | mutex_enter(softnet_lock); | |||
1151 | #endif | |||
1148 | in_pcbpurgeif(&udbtable, ifp); | 1152 | in_pcbpurgeif(&udbtable, ifp); | |
1149 | #ifndef NET_MPSAFE | |||
1150 | mutex_exit(softnet_lock); | 1153 | mutex_exit(softnet_lock); | |
1151 | #endif | |||
1152 | splx(s); | 1154 | splx(s); | |
1153 | 1155 | |||
1154 | return 0; | 1156 | return 0; | |
1155 | } | 1157 | } | |
1156 | 1158 | |||
1157 | static int | 1159 | static int | |
1158 | sysctl_net_inet_udp_stats(SYSCTLFN_ARGS) | 1160 | sysctl_net_inet_udp_stats(SYSCTLFN_ARGS) | |
1159 | { | 1161 | { | |
1160 | 1162 | |||
1161 | return (NETSTAT_SYSCTL(udpstat_percpu, UDP_NSTATS)); | 1163 | return (NETSTAT_SYSCTL(udpstat_percpu, UDP_NSTATS)); | |
1162 | } | 1164 | } | |
1163 | 1165 | |||
1164 | /* | 1166 | /* |
--- src/sys/netinet6/dccp6_usrreq.c 2016/12/13 08:29:03 1.10
+++ src/sys/netinet6/dccp6_usrreq.c 2017/01/24 07:09:25 1.11
@@ -1,15 +1,15 @@ | @@ -1,15 +1,15 @@ | |||
1 | /* $KAME: dccp6_usrreq.c,v 1.13 2005/07/27 08:42:56 nishida Exp $ */ | 1 | /* $KAME: dccp6_usrreq.c,v 1.13 2005/07/27 08:42:56 nishida Exp $ */ | |
2 | /* $NetBSD: dccp6_usrreq.c,v 1.10 2016/12/13 08:29:03 ozaki-r Exp $ */ | 2 | /* $NetBSD: dccp6_usrreq.c,v 1.11 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 2003 WIDE Project. | 5 | * Copyright (C) 2003 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: dccp6_usrreq.c,v 1.10 2016/12/13 08:29:03 ozaki-r Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: dccp6_usrreq.c,v 1.11 2017/01/24 07:09:25 ozaki-r Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #include "opt_dccp.h" | 38 | #include "opt_dccp.h" | |
39 | #include "opt_net_mpsafe.h" | 39 | #include "opt_net_mpsafe.h" | |
40 | #endif | 40 | #endif | |
41 | 41 | |||
42 | #include <sys/param.h> | 42 | #include <sys/param.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | #include <sys/domain.h> | 44 | #include <sys/domain.h> | |
45 | #include <sys/kernel.h> | 45 | #include <sys/kernel.h> | |
46 | #include <sys/pool.h> | 46 | #include <sys/pool.h> | |
47 | #include <sys/lock.h> | 47 | #include <sys/lock.h> | |
@@ -308,35 +308,37 @@ dccp6_ioctl(struct socket *so, u_long cm | @@ -308,35 +308,37 @@ dccp6_ioctl(struct socket *so, u_long cm | |||
308 | 308 | |||
309 | static int | 309 | static int | |
310 | dccp6_stat(struct socket *so, struct stat *ub) | 310 | dccp6_stat(struct socket *so, struct stat *ub) | |
311 | { | 311 | { | |
312 | return 0; | 312 | return 0; | |
313 | } | 313 | } | |
314 | 314 | |||
315 | static int | 315 | static int | |
316 | dccp6_purgeif(struct socket *so, struct ifnet *ifp) | 316 | dccp6_purgeif(struct socket *so, struct ifnet *ifp) | |
317 | { | 317 | { | |
318 | int s; | 318 | int s; | |
319 | 319 | |||
320 | s = splsoftnet(); | 320 | s = splsoftnet(); | |
321 | #ifndef NET_MPSAFE | |||
322 | mutex_enter(softnet_lock); | 321 | mutex_enter(softnet_lock); | |
323 | #endif | |||
324 | in6_pcbpurgeif0(&dccpbtable, ifp); | 322 | in6_pcbpurgeif0(&dccpbtable, ifp); | |
323 | #ifdef NET_MPSAFE | |||
324 | mutex_exit(softnet_lock); | |||
325 | #endif | |||
325 | in6_purgeif(ifp); | 326 | in6_purgeif(ifp); | |
327 | #ifdef NET_MPSAFE | |||
328 | mutex_enter(softnet_lock); | |||
329 | #endif | |||
326 | in6_pcbpurgeif(&dccpbtable, ifp); | 330 | in6_pcbpurgeif(&dccpbtable, ifp); | |
327 | #ifndef NET_MPSAFE | |||
328 | mutex_exit(softnet_lock); | 331 | mutex_exit(softnet_lock); | |
329 | #endif | |||
330 | splx(s); | 332 | splx(s); | |
331 | 333 | |||
332 | return 0; | 334 | return 0; | |
333 | } | 335 | } | |
334 | 336 | |||
335 | static int | 337 | static int | |
336 | dccp6_attach(struct socket *so, int proto) | 338 | dccp6_attach(struct socket *so, int proto) | |
337 | { | 339 | { | |
338 | return dccp_attach(so, proto); | 340 | return dccp_attach(so, proto); | |
339 | } | 341 | } | |
340 | 342 | |||
341 | static int | 343 | static int | |
342 | dccp6_detach(struct socket *so) | 344 | dccp6_detach(struct socket *so) |
--- src/sys/netinet6/frag6.c 2017/01/11 13:08:29 1.59
+++ src/sys/netinet6/frag6.c 2017/01/24 07:09:25 1.60
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: frag6.c,v 1.59 2017/01/11 13:08:29 ozaki-r Exp $ */ | 1 | /* $NetBSD: frag6.c,v 1.60 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ | 2 | /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -21,27 +21,31 @@ | @@ -21,27 +21,31 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.59 2017/01/11 13:08:29 ozaki-r Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.60 2017/01/24 07:09:25 ozaki-r Exp $"); | |
35 | ||||
36 | #ifdef _KERNEL_OPT | |||
37 | #include "opt_net_mpsafe.h" | |||
38 | #endif | |||
35 | 39 | |||
36 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
38 | #include <sys/mbuf.h> | 42 | #include <sys/mbuf.h> | |
39 | #include <sys/errno.h> | 43 | #include <sys/errno.h> | |
40 | #include <sys/time.h> | 44 | #include <sys/time.h> | |
41 | #include <sys/kmem.h> | 45 | #include <sys/kmem.h> | |
42 | #include <sys/kernel.h> | 46 | #include <sys/kernel.h> | |
43 | #include <sys/syslog.h> | 47 | #include <sys/syslog.h> | |
44 | 48 | |||
45 | #include <net/if.h> | 49 | #include <net/if.h> | |
46 | #include <net/route.h> | 50 | #include <net/route.h> | |
47 | 51 | |||
@@ -582,78 +586,87 @@ frag6_insque(struct ip6q *newq, struct i | @@ -582,78 +586,87 @@ frag6_insque(struct ip6q *newq, struct i | |||
582 | void | 586 | void | |
583 | frag6_remque(struct ip6q *p6) | 587 | frag6_remque(struct ip6q *p6) | |
584 | { | 588 | { | |
585 | 589 | |||
586 | KASSERT(mutex_owned(&frag6_lock)); | 590 | KASSERT(mutex_owned(&frag6_lock)); | |
587 | 591 | |||
588 | p6->ip6q_prev->ip6q_next = p6->ip6q_next; | 592 | p6->ip6q_prev->ip6q_next = p6->ip6q_next; | |
589 | p6->ip6q_next->ip6q_prev = p6->ip6q_prev; | 593 | p6->ip6q_next->ip6q_prev = p6->ip6q_prev; | |
590 | } | 594 | } | |
591 | 595 | |||
592 | void | 596 | void | |
593 | frag6_fasttimo(void) | 597 | frag6_fasttimo(void) | |
594 | { | 598 | { | |
599 | ||||
600 | #ifndef NET_MPSAFE | |||
595 | mutex_enter(softnet_lock); | 601 | mutex_enter(softnet_lock); | |
596 | KERNEL_LOCK(1, NULL); | 602 | KERNEL_LOCK(1, NULL); | |
603 | #endif | |||
597 | 604 | |||
598 | if (frag6_drainwanted) { | 605 | if (frag6_drainwanted) { | |
599 | frag6_drain(); | 606 | frag6_drain(); | |
600 | frag6_drainwanted = 0; | 607 | frag6_drainwanted = 0; | |
601 | } | 608 | } | |
602 | 609 | |||
610 | #ifndef NET_MPSAFE | |||
603 | KERNEL_UNLOCK_ONE(NULL); | 611 | KERNEL_UNLOCK_ONE(NULL); | |
604 | mutex_exit(softnet_lock); | 612 | mutex_exit(softnet_lock); | |
613 | #endif | |||
605 | } | 614 | } | |
606 | 615 | |||
607 | /* | 616 | /* | |
608 | * IPv6 reassembling timer processing; | 617 | * IPv6 reassembling timer processing; | |
609 | * if a timer expires on a reassembly | 618 | * if a timer expires on a reassembly | |
610 | * queue, discard it. | 619 | * queue, discard it. | |
611 | */ | 620 | */ | |
612 | void | 621 | void | |
613 | frag6_slowtimo(void) | 622 | frag6_slowtimo(void) | |
614 | { | 623 | { | |
615 | struct ip6q *q6; | 624 | struct ip6q *q6; | |
616 | 625 | |||
626 | #ifndef NET_MPSAFE | |||
617 | mutex_enter(softnet_lock); | 627 | mutex_enter(softnet_lock); | |
618 | KERNEL_LOCK(1, NULL); | 628 | KERNEL_LOCK(1, NULL); | |
629 | #endif | |||
619 | 630 | |||
620 | mutex_enter(&frag6_lock); | 631 | mutex_enter(&frag6_lock); | |
621 | q6 = ip6q.ip6q_next; | 632 | q6 = ip6q.ip6q_next; | |
622 | if (q6) | 633 | if (q6) | |
623 | while (q6 != &ip6q) { | 634 | while (q6 != &ip6q) { | |
624 | --q6->ip6q_ttl; | 635 | --q6->ip6q_ttl; | |
625 | q6 = q6->ip6q_next; | 636 | q6 = q6->ip6q_next; | |
626 | if (q6->ip6q_prev->ip6q_ttl == 0) { | 637 | if (q6->ip6q_prev->ip6q_ttl == 0) { | |
627 | IP6_STATINC(IP6_STAT_FRAGTIMEOUT); | 638 | IP6_STATINC(IP6_STAT_FRAGTIMEOUT); | |
628 | /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ | 639 | /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ | |
629 | frag6_freef(q6->ip6q_prev); | 640 | frag6_freef(q6->ip6q_prev); | |
630 | } | 641 | } | |
631 | } | 642 | } | |
632 | /* | 643 | /* | |
633 | * If we are over the maximum number of fragments | 644 | * If we are over the maximum number of fragments | |
634 | * (due to the limit being lowered), drain off | 645 | * (due to the limit being lowered), drain off | |
635 | * enough to get down to the new limit. | 646 | * enough to get down to the new limit. | |
636 | */ | 647 | */ | |
637 | while (frag6_nfragpackets > (u_int)ip6_maxfragpackets && | 648 | while (frag6_nfragpackets > (u_int)ip6_maxfragpackets && | |
638 | ip6q.ip6q_prev) { | 649 | ip6q.ip6q_prev) { | |
639 | IP6_STATINC(IP6_STAT_FRAGOVERFLOW); | 650 | IP6_STATINC(IP6_STAT_FRAGOVERFLOW); | |
640 | /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ | 651 | /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ | |
641 | frag6_freef(ip6q.ip6q_prev); | 652 | frag6_freef(ip6q.ip6q_prev); | |
642 | } | 653 | } | |
643 | mutex_exit(&frag6_lock); | 654 | mutex_exit(&frag6_lock); | |
644 | 655 | |||
656 | #ifndef NET_MPSAFE | |||
645 | KERNEL_UNLOCK_ONE(NULL); | 657 | KERNEL_UNLOCK_ONE(NULL); | |
646 | mutex_exit(softnet_lock); | 658 | mutex_exit(softnet_lock); | |
659 | #endif | |||
647 | 660 | |||
648 | #if 0 | 661 | #if 0 | |
649 | /* | 662 | /* | |
650 | * Routing changes might produce a better route than we last used; | 663 | * Routing changes might produce a better route than we last used; | |
651 | * make sure we notice eventually, even if forwarding only for one | 664 | * make sure we notice eventually, even if forwarding only for one | |
652 | * destination and the cache is never replaced. | 665 | * destination and the cache is never replaced. | |
653 | */ | 666 | */ | |
654 | rtcache_free(&ip6_forward_rt); | 667 | rtcache_free(&ip6_forward_rt); | |
655 | rtcache_free(&ipsrcchk_rt); | 668 | rtcache_free(&ipsrcchk_rt); | |
656 | #endif | 669 | #endif | |
657 | 670 | |||
658 | } | 671 | } | |
659 | 672 |
--- src/sys/netinet6/in6_ifattach.c 2017/01/04 19:37:14 1.109
+++ src/sys/netinet6/in6_ifattach.c 2017/01/24 07:09:25 1.110
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: in6_ifattach.c,v 1.109 2017/01/04 19:37:14 christos Exp $ */ | 1 | /* $NetBSD: in6_ifattach.c,v 1.110 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ | 2 | /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.109 2017/01/04 19:37:14 christos Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.110 2017/01/24 07:09:25 ozaki-r Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/kmem.h> | 38 | #include <sys/kmem.h> | |
39 | #include <sys/socket.h> | 39 | #include <sys/socket.h> | |
40 | #include <sys/sockio.h> | 40 | #include <sys/sockio.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/syslog.h> | 42 | #include <sys/syslog.h> | |
43 | #include <sys/md5.h> | 43 | #include <sys/md5.h> | |
44 | #include <sys/socketvar.h> | 44 | #include <sys/socketvar.h> | |
45 | #include <sys/cprng.h> | 45 | #include <sys/cprng.h> | |
46 | 46 | |||
47 | #include <net/if.h> | 47 | #include <net/if.h> | |
@@ -850,26 +850,27 @@ in6_get_tmpifid(struct ifnet *ifp, u_int | @@ -850,26 +850,27 @@ in6_get_tmpifid(struct ifnet *ifp, u_int | |||
850 | } | 850 | } | |
851 | 851 | |||
852 | return 0; | 852 | return 0; | |
853 | } | 853 | } | |
854 | 854 | |||
855 | void | 855 | void | |
856 | in6_tmpaddrtimer(void *ignored_arg) | 856 | in6_tmpaddrtimer(void *ignored_arg) | |
857 | { | 857 | { | |
858 | struct nd_ifinfo *ndi; | 858 | struct nd_ifinfo *ndi; | |
859 | u_int8_t nullbuf[8]; | 859 | u_int8_t nullbuf[8]; | |
860 | struct ifnet *ifp; | 860 | struct ifnet *ifp; | |
861 | int s; | 861 | int s; | |
862 | 862 | |||
863 | /* XXX NOMPSAFE still need softnet_lock */ | |||
863 | mutex_enter(softnet_lock); | 864 | mutex_enter(softnet_lock); | |
864 | KERNEL_LOCK(1, NULL); | 865 | KERNEL_LOCK(1, NULL); | |
865 | 866 | |||
866 | callout_reset(&in6_tmpaddrtimer_ch, | 867 | callout_reset(&in6_tmpaddrtimer_ch, | |
867 | (ip6_temp_preferred_lifetime - ip6_desync_factor - | 868 | (ip6_temp_preferred_lifetime - ip6_desync_factor - | |
868 | ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); | 869 | ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL); | |
869 | 870 | |||
870 | memset(nullbuf, 0, sizeof(nullbuf)); | 871 | memset(nullbuf, 0, sizeof(nullbuf)); | |
871 | s = pserialize_read_enter(); | 872 | s = pserialize_read_enter(); | |
872 | IFNET_READER_FOREACH(ifp) { | 873 | IFNET_READER_FOREACH(ifp) { | |
873 | ndi = ND_IFINFO(ifp); | 874 | ndi = ND_IFINFO(ifp); | |
874 | if (memcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) { | 875 | if (memcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) { | |
875 | /* | 876 | /* |
--- src/sys/netinet6/ip6_mroute.c 2017/01/16 15:44:47 1.115
+++ src/sys/netinet6/ip6_mroute.c 2017/01/24 07:09:25 1.116
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip6_mroute.c,v 1.115 2017/01/16 15:44:47 christos Exp $ */ | 1 | /* $NetBSD: ip6_mroute.c,v 1.116 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */ | 2 | /* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1998 WIDE Project. | 5 | * Copyright (C) 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -107,27 +107,27 @@ | @@ -107,27 +107,27 @@ | |||
107 | * IP multicast forwarding procedures | 107 | * IP multicast forwarding procedures | |
108 | * | 108 | * | |
109 | * Written by David Waitzman, BBN Labs, August 1988. | 109 | * Written by David Waitzman, BBN Labs, August 1988. | |
110 | * Modified by Steve Deering, Stanford, February 1989. | 110 | * Modified by Steve Deering, Stanford, February 1989. | |
111 | * Modified by Mark J. Steiglitz, Stanford, May, 1991 | 111 | * Modified by Mark J. Steiglitz, Stanford, May, 1991 | |
112 | * Modified by Van Jacobson, LBL, January 1993 | 112 | * Modified by Van Jacobson, LBL, January 1993 | |
113 | * Modified by Ajit Thyagarajan, PARC, August 1993 | 113 | * Modified by Ajit Thyagarajan, PARC, August 1993 | |
114 | * Modified by Bill Fenner, PARC, April 1994 | 114 | * Modified by Bill Fenner, PARC, April 1994 | |
115 | * | 115 | * | |
116 | * MROUTING Revision: 3.5.1.2 + PIM-SMv2 (pimd) Support | 116 | * MROUTING Revision: 3.5.1.2 + PIM-SMv2 (pimd) Support | |
117 | */ | 117 | */ | |
118 | 118 | |||
119 | #include <sys/cdefs.h> | 119 | #include <sys/cdefs.h> | |
120 | __KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.115 2017/01/16 15:44:47 christos Exp $"); | 120 | __KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.116 2017/01/24 07:09:25 ozaki-r Exp $"); | |
121 | 121 | |||
122 | #ifdef _KERNEL_OPT | 122 | #ifdef _KERNEL_OPT | |
123 | #include "opt_inet.h" | 123 | #include "opt_inet.h" | |
124 | #include "opt_mrouting.h" | 124 | #include "opt_mrouting.h" | |
125 | #endif | 125 | #endif | |
126 | 126 | |||
127 | #include <sys/param.h> | 127 | #include <sys/param.h> | |
128 | #include <sys/systm.h> | 128 | #include <sys/systm.h> | |
129 | #include <sys/callout.h> | 129 | #include <sys/callout.h> | |
130 | #include <sys/mbuf.h> | 130 | #include <sys/mbuf.h> | |
131 | #include <sys/socket.h> | 131 | #include <sys/socket.h> | |
132 | #include <sys/socketvar.h> | 132 | #include <sys/socketvar.h> | |
133 | #include <sys/sockio.h> | 133 | #include <sys/sockio.h> | |
@@ -1300,26 +1300,27 @@ ip6_mforward(struct ip6_hdr *ip6, struct | @@ -1300,26 +1300,27 @@ ip6_mforward(struct ip6_hdr *ip6, struct | |||
1300 | } | 1300 | } | |
1301 | 1301 | |||
1302 | /* | 1302 | /* | |
1303 | * Clean up cache entries if upcalls are not serviced | 1303 | * Clean up cache entries if upcalls are not serviced | |
1304 | * Call from the Slow Timeout mechanism, every 0.25 seconds. | 1304 | * Call from the Slow Timeout mechanism, every 0.25 seconds. | |
1305 | */ | 1305 | */ | |
1306 | static void | 1306 | static void | |
1307 | expire_upcalls(void *unused) | 1307 | expire_upcalls(void *unused) | |
1308 | { | 1308 | { | |
1309 | struct rtdetq *rte; | 1309 | struct rtdetq *rte; | |
1310 | struct mf6c *mfc, **nptr; | 1310 | struct mf6c *mfc, **nptr; | |
1311 | int i; | 1311 | int i; | |
1312 | 1312 | |||
1313 | /* XXX NOMPSAFE still need softnet_lock */ | |||
1313 | mutex_enter(softnet_lock); | 1314 | mutex_enter(softnet_lock); | |
1314 | KERNEL_LOCK(1, NULL); | 1315 | KERNEL_LOCK(1, NULL); | |
1315 | 1316 | |||
1316 | for (i = 0; i < MF6CTBLSIZ; i++) { | 1317 | for (i = 0; i < MF6CTBLSIZ; i++) { | |
1317 | if (n6expire[i] == 0) | 1318 | if (n6expire[i] == 0) | |
1318 | continue; | 1319 | continue; | |
1319 | nptr = &mf6ctable[i]; | 1320 | nptr = &mf6ctable[i]; | |
1320 | while ((mfc = *nptr) != NULL) { | 1321 | while ((mfc = *nptr) != NULL) { | |
1321 | rte = mfc->mf6c_stall; | 1322 | rte = mfc->mf6c_stall; | |
1322 | /* | 1323 | /* | |
1323 | * Skip real cache entries | 1324 | * Skip real cache entries | |
1324 | * Make sure it wasn't marked to not expire (shouldn't happen) | 1325 | * Make sure it wasn't marked to not expire (shouldn't happen) | |
1325 | * If it expires now | 1326 | * If it expires now |
--- src/sys/netinet6/mld6.c 2017/01/16 15:44:47 1.79
+++ src/sys/netinet6/mld6.c 2017/01/24 07:09:25 1.80
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mld6.c,v 1.79 2017/01/16 15:44:47 christos Exp $ */ | 1 | /* $NetBSD: mld6.c,v 1.80 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */ | 2 | /* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1998 WIDE Project. | 5 | * Copyright (C) 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -92,27 +92,27 @@ | @@ -92,27 +92,27 @@ | |||
92 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 92 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
93 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 93 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
94 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 94 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
95 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 95 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
96 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 96 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
97 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 97 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
98 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 98 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
99 | * SUCH DAMAGE. | 99 | * SUCH DAMAGE. | |
100 | * | 100 | * | |
101 | * @(#)igmp.c 8.1 (Berkeley) 7/19/93 | 101 | * @(#)igmp.c 8.1 (Berkeley) 7/19/93 | |
102 | */ | 102 | */ | |
103 | 103 | |||
104 | #include <sys/cdefs.h> | 104 | #include <sys/cdefs.h> | |
105 | __KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.79 2017/01/16 15:44:47 christos Exp $"); | 105 | __KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.80 2017/01/24 07:09:25 ozaki-r Exp $"); | |
106 | 106 | |||
107 | #ifdef _KERNEL_OPT | 107 | #ifdef _KERNEL_OPT | |
108 | #include "opt_inet.h" | 108 | #include "opt_inet.h" | |
109 | #include "opt_net_mpsafe.h" | 109 | #include "opt_net_mpsafe.h" | |
110 | #endif | 110 | #endif | |
111 | 111 | |||
112 | #include <sys/param.h> | 112 | #include <sys/param.h> | |
113 | #include <sys/systm.h> | 113 | #include <sys/systm.h> | |
114 | #include <sys/mbuf.h> | 114 | #include <sys/mbuf.h> | |
115 | #include <sys/socket.h> | 115 | #include <sys/socket.h> | |
116 | #include <sys/socketvar.h> | 116 | #include <sys/socketvar.h> | |
117 | #include <sys/syslog.h> | 117 | #include <sys/syslog.h> | |
118 | #include <sys/sysctl.h> | 118 | #include <sys/sysctl.h> | |
@@ -219,26 +219,27 @@ mld_stoptimer(struct in6_multi *in6m) | @@ -219,26 +219,27 @@ mld_stoptimer(struct in6_multi *in6m) | |||
219 | if (in6m->in6m_timer == IN6M_TIMER_UNDEF) | 219 | if (in6m->in6m_timer == IN6M_TIMER_UNDEF) | |
220 | return; | 220 | return; | |
221 | 221 | |||
222 | callout_stop(&in6m->in6m_timer_ch); | 222 | callout_stop(&in6m->in6m_timer_ch); | |
223 | 223 | |||
224 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | 224 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | |
225 | } | 225 | } | |
226 | 226 | |||
227 | static void | 227 | static void | |
228 | mld_timeo(void *arg) | 228 | mld_timeo(void *arg) | |
229 | { | 229 | { | |
230 | struct in6_multi *in6m = arg; | 230 | struct in6_multi *in6m = arg; | |
231 | 231 | |||
232 | /* XXX NOMPSAFE still need softnet_lock */ | |||
232 | mutex_enter(softnet_lock); | 233 | mutex_enter(softnet_lock); | |
233 | KERNEL_LOCK(1, NULL); | 234 | KERNEL_LOCK(1, NULL); | |
234 | 235 | |||
235 | if (in6m->in6m_timer == IN6M_TIMER_UNDEF) | 236 | if (in6m->in6m_timer == IN6M_TIMER_UNDEF) | |
236 | goto out; | 237 | goto out; | |
237 | 238 | |||
238 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | 239 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | |
239 | 240 | |||
240 | switch (in6m->in6m_state) { | 241 | switch (in6m->in6m_state) { | |
241 | case MLD_REPORTPENDING: | 242 | case MLD_REPORTPENDING: | |
242 | mld_start_listening(in6m); | 243 | mld_start_listening(in6m); | |
243 | break; | 244 | break; | |
244 | default: | 245 | default: | |
@@ -782,31 +783,30 @@ in6_delmulti(struct in6_multi *in6m) | @@ -782,31 +783,30 @@ in6_delmulti(struct in6_multi *in6m) | |||
782 | } | 783 | } | |
783 | } | 784 | } | |
784 | pserialize_read_exit(_s); | 785 | pserialize_read_exit(_s); | |
785 | 786 | |||
786 | /* | 787 | /* | |
787 | * Notify the network driver to update its multicast | 788 | * Notify the network driver to update its multicast | |
788 | * reception filter. | 789 | * reception filter. | |
789 | */ | 790 | */ | |
790 | sockaddr_in6_init(&sin6, &in6m->in6m_addr, 0, 0, 0); | 791 | sockaddr_in6_init(&sin6, &in6m->in6m_addr, 0, 0, 0); | |
791 | if_mcast_op(in6m->in6m_ifp, SIOCDELMULTI, sin6tosa(&sin6)); | 792 | if_mcast_op(in6m->in6m_ifp, SIOCDELMULTI, sin6tosa(&sin6)); | |
792 | 793 | |||
793 | /* Tell mld_timeo we're halting the timer */ | 794 | /* Tell mld_timeo we're halting the timer */ | |
794 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | 795 | in6m->in6m_timer = IN6M_TIMER_UNDEF; | |
795 | #ifdef NET_MPSAFE | 796 | if (mutex_owned(softnet_lock)) | |
796 | callout_halt(&in6m->in6m_timer_ch, NULL); | 797 | callout_halt(&in6m->in6m_timer_ch, softnet_lock); | |
797 | #else | 798 | else | |
798 | callout_halt(&in6m->in6m_timer_ch, softnet_lock); | 799 | callout_halt(&in6m->in6m_timer_ch, NULL); | |
799 | #endif | |||
800 | callout_destroy(&in6m->in6m_timer_ch); | 800 | callout_destroy(&in6m->in6m_timer_ch); | |
801 | 801 | |||
802 | free(in6m, M_IPMADDR); | 802 | free(in6m, M_IPMADDR); | |
803 | } | 803 | } | |
804 | splx(s); | 804 | splx(s); | |
805 | } | 805 | } | |
806 | 806 | |||
807 | 807 | |||
808 | struct in6_multi_mship * | 808 | struct in6_multi_mship * | |
809 | in6_joingroup(struct ifnet *ifp, struct in6_addr *addr, | 809 | in6_joingroup(struct ifnet *ifp, struct in6_addr *addr, | |
810 | int *errorp, int timer) | 810 | int *errorp, int timer) | |
811 | { | 811 | { | |
812 | struct in6_multi_mship *imm; | 812 | struct in6_multi_mship *imm; |
--- src/sys/netinet6/raw_ip6.c 2016/12/13 08:29:03 1.154
+++ src/sys/netinet6/raw_ip6.c 2017/01/24 07:09:25 1.155
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: raw_ip6.c,v 1.154 2016/12/13 08:29:03 ozaki-r Exp $ */ | 1 | /* $NetBSD: raw_ip6.c,v 1.155 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */ | 2 | /* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94 | 61 | * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.154 2016/12/13 08:29:03 ozaki-r Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.155 2017/01/24 07:09:25 ozaki-r Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_ipsec.h" | 68 | #include "opt_ipsec.h" | |
69 | #include "opt_net_mpsafe.h" | 69 | #include "opt_net_mpsafe.h" | |
70 | #endif | 70 | #endif | |
71 | 71 | |||
72 | #include <sys/param.h> | 72 | #include <sys/param.h> | |
73 | #include <sys/sysctl.h> | 73 | #include <sys/sysctl.h> | |
74 | #include <sys/mbuf.h> | 74 | #include <sys/mbuf.h> | |
75 | #include <sys/socket.h> | 75 | #include <sys/socket.h> | |
76 | #include <sys/protosw.h> | 76 | #include <sys/protosw.h> | |
77 | #include <sys/socketvar.h> | 77 | #include <sys/socketvar.h> | |
78 | #include <sys/systm.h> | 78 | #include <sys/systm.h> | |
@@ -925,35 +925,37 @@ rip6_sendoob(struct socket *so, struct m | @@ -925,35 +925,37 @@ rip6_sendoob(struct socket *so, struct m | |||
925 | { | 925 | { | |
926 | KASSERT(solocked(so)); | 926 | KASSERT(solocked(so)); | |
927 | 927 | |||
928 | if (m) | 928 | if (m) | |
929 | m_freem(m); | 929 | m_freem(m); | |
930 | 930 | |||
931 | return EOPNOTSUPP; | 931 | return EOPNOTSUPP; | |
932 | } | 932 | } | |
933 | 933 | |||
934 | static int | 934 | static int | |
935 | rip6_purgeif(struct socket *so, struct ifnet *ifp) | 935 | rip6_purgeif(struct socket *so, struct ifnet *ifp) | |
936 | { | 936 | { | |
937 | 937 | |||
938 | #ifndef NET_MPSAFE | |||
939 | mutex_enter(softnet_lock); | 938 | mutex_enter(softnet_lock); | |
940 | #endif | |||
941 | in6_pcbpurgeif0(&raw6cbtable, ifp); | 939 | in6_pcbpurgeif0(&raw6cbtable, ifp); | |
940 | #ifdef NET_MPSAFE | |||
941 | mutex_exit(softnet_lock); | |||
942 | #endif | |||
942 | in6_purgeif(ifp); | 943 | in6_purgeif(ifp); | |
944 | #ifdef NET_MPSAFE | |||
945 | mutex_enter(softnet_lock); | |||
946 | #endif | |||
943 | in6_pcbpurgeif(&raw6cbtable, ifp); | 947 | in6_pcbpurgeif(&raw6cbtable, ifp); | |
944 | #ifndef NET_MPSAFE | |||
945 | mutex_exit(softnet_lock); | 948 | mutex_exit(softnet_lock); | |
946 | #endif | |||
947 | 949 | |||
948 | return 0; | 950 | return 0; | |
949 | } | 951 | } | |
950 | 952 | |||
951 | static int | 953 | static int | |
952 | sysctl_net_inet6_raw6_stats(SYSCTLFN_ARGS) | 954 | sysctl_net_inet6_raw6_stats(SYSCTLFN_ARGS) | |
953 | { | 955 | { | |
954 | 956 | |||
955 | return (NETSTAT_SYSCTL(rip6stat_percpu, RIP6_NSTATS)); | 957 | return (NETSTAT_SYSCTL(rip6stat_percpu, RIP6_NSTATS)); | |
956 | } | 958 | } | |
957 | 959 | |||
958 | static void | 960 | static void | |
959 | sysctl_net_inet6_raw6_setup(struct sysctllog **clog) | 961 | sysctl_net_inet6_raw6_setup(struct sysctllog **clog) |
--- src/sys/netinet6/udp6_usrreq.c 2016/11/18 06:50:04 1.126
+++ src/sys/netinet6/udp6_usrreq.c 2017/01/24 07:09:25 1.127
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: udp6_usrreq.c,v 1.126 2016/11/18 06:50:04 knakahara Exp $ */ | 1 | /* $NetBSD: udp6_usrreq.c,v 1.127 2017/01/24 07:09:25 ozaki-r Exp $ */ | |
2 | /* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */ | 2 | /* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 | 61 | * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.126 2016/11/18 06:50:04 knakahara Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.127 2017/01/24 07:09:25 ozaki-r Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_inet.h" | 68 | #include "opt_inet.h" | |
69 | #include "opt_inet_csum.h" | 69 | #include "opt_inet_csum.h" | |
70 | #include "opt_ipsec.h" | 70 | #include "opt_ipsec.h" | |
71 | #include "opt_net_mpsafe.h" | 71 | #include "opt_net_mpsafe.h" | |
72 | #endif | 72 | #endif | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/mbuf.h> | 75 | #include <sys/mbuf.h> | |
76 | #include <sys/protosw.h> | 76 | #include <sys/protosw.h> | |
77 | #include <sys/socket.h> | 77 | #include <sys/socket.h> | |
78 | #include <sys/socketvar.h> | 78 | #include <sys/socketvar.h> | |
@@ -902,35 +902,37 @@ udp6_sendoob(struct socket *so, struct m | @@ -902,35 +902,37 @@ udp6_sendoob(struct socket *so, struct m | |||
902 | 902 | |||
903 | if (m) | 903 | if (m) | |
904 | m_freem(m); | 904 | m_freem(m); | |
905 | if (control) | 905 | if (control) | |
906 | m_freem(control); | 906 | m_freem(control); | |
907 | 907 | |||
908 | return EOPNOTSUPP; | 908 | return EOPNOTSUPP; | |
909 | } | 909 | } | |
910 | 910 | |||
911 | static int | 911 | static int | |
912 | udp6_purgeif(struct socket *so, struct ifnet *ifp) | 912 | udp6_purgeif(struct socket *so, struct ifnet *ifp) | |
913 | { | 913 | { | |
914 | 914 | |||
915 | #ifndef NET_MPSAFE | |||
916 | mutex_enter(softnet_lock); | 915 | mutex_enter(softnet_lock); | |
917 | #endif | |||
918 | in6_pcbpurgeif0(&udbtable, ifp); | 916 | in6_pcbpurgeif0(&udbtable, ifp); | |
917 | #ifdef NET_MPSAFE | |||
918 | mutex_exit(softnet_lock); | |||
919 | #endif | |||
919 | in6_purgeif(ifp); | 920 | in6_purgeif(ifp); | |
921 | #ifdef NET_MPSAFE | |||
922 | mutex_enter(softnet_lock); | |||
923 | #endif | |||
920 | in6_pcbpurgeif(&udbtable, ifp); | 924 | in6_pcbpurgeif(&udbtable, ifp); | |
921 | #ifndef NET_MPSAFE | |||
922 | mutex_exit(softnet_lock); | 925 | mutex_exit(softnet_lock); | |
923 | #endif | |||
924 | 926 | |||
925 | return 0; | 927 | return 0; | |
926 | } | 928 | } | |
927 | 929 | |||
928 | static int | 930 | static int | |
929 | sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS) | 931 | sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS) | |
930 | { | 932 | { | |
931 | 933 | |||
932 | return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS)); | 934 | return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS)); | |
933 | } | 935 | } | |
934 | 936 | |||
935 | static void | 937 | static void | |
936 | sysctl_net_inet6_udp6_setup(struct sysctllog **clog) | 938 | sysctl_net_inet6_udp6_setup(struct sysctllog **clog) |