Wed Jun 28 14:38:18 2017 UTC ()
Put back some commented out code.


(rjs)
diff -r1.10 -r1.11 src/sys/netinet/sctp_asconf.c

cvs diff -r1.10 -r1.11 src/sys/netinet/sctp_asconf.c (expand / switch to unified diff)

--- src/sys/netinet/sctp_asconf.c 2017/01/17 01:24:44 1.10
+++ src/sys/netinet/sctp_asconf.c 2017/06/28 14:38:18 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sctp_asconf.c,v 1.10 2017/01/17 01:24:44 ozaki-r Exp $ */ 1/* $NetBSD: sctp_asconf.c,v 1.11 2017/06/28 14:38:18 rjs Exp $ */
2/* $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $ */ 2/* $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. 5 * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
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
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND 20 * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
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 CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE 23 * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS 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#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.10 2017/01/17 01:24:44 ozaki-r Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.11 2017/06/28 14:38:18 rjs Exp $");
34 34
35#ifdef _KERNEL_OPT 35#ifdef _KERNEL_OPT
36#include "opt_ipsec.h" 36#include "opt_ipsec.h"
37#include "opt_inet.h" 37#include "opt_inet.h"
38#include "opt_sctp.h" 38#include "opt_sctp.h"
39#endif /* _KERNEL_OPT */ 39#endif /* _KERNEL_OPT */
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/malloc.h> 43#include <sys/malloc.h>
44#include <sys/mbuf.h> 44#include <sys/mbuf.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#include <sys/socketvar.h> 46#include <sys/socketvar.h>
@@ -53,26 +53,27 @@ __KERNEL_RCSID(0, "$NetBSD: sctp_asconf. @@ -53,26 +53,27 @@ __KERNEL_RCSID(0, "$NetBSD: sctp_asconf.
53 53
54#include <netinet/in.h> 54#include <netinet/in.h>
55#include <netinet/in_systm.h> 55#include <netinet/in_systm.h>
56#include <netinet/ip.h> 56#include <netinet/ip.h>
57#include <netinet/in_pcb.h> 57#include <netinet/in_pcb.h>
58#include <netinet/in_var.h> 58#include <netinet/in_var.h>
59#include <netinet/ip_var.h> 59#include <netinet/ip_var.h>
60 60
61#ifdef INET6 61#ifdef INET6
62#include <netinet/ip6.h> 62#include <netinet/ip6.h>
63#include <netinet6/ip6_var.h> 63#include <netinet6/ip6_var.h>
64#include <netinet6/in6_pcb.h> 64#include <netinet6/in6_pcb.h>
65#include <netinet/icmp6.h> 65#include <netinet/icmp6.h>
 66#include <netinet6/nd6.h>
66#include <netinet6/scope6_var.h> 67#include <netinet6/scope6_var.h>
67#include <netinet6/nd6.h> 68#include <netinet6/nd6.h>
68#endif /* INET6 */ 69#endif /* INET6 */
69 70
70#include <netinet/in_pcb.h> 71#include <netinet/in_pcb.h>
71 72
72#include <netinet/sctp_var.h> 73#include <netinet/sctp_var.h>
73#include <netinet/sctp_pcb.h> 74#include <netinet/sctp_pcb.h>
74#include <netinet/sctp_header.h> 75#include <netinet/sctp_header.h>
75#include <netinet/sctputil.h> 76#include <netinet/sctputil.h>
76#include <netinet/sctp_output.h> 77#include <netinet/sctp_output.h>
77#include <netinet/sctp_asconf.h> 78#include <netinet/sctp_asconf.h>
78 79
@@ -1546,54 +1547,53 @@ sctp_is_desired_interface_type(struct if @@ -1546,54 +1547,53 @@ sctp_is_desired_interface_type(struct if
1546 printf("ignoring interface type = %u\n", 1547 printf("ignoring interface type = %u\n",
1547 ifa->ifa_ifp->if_type); 1548 ifa->ifa_ifp->if_type);
1548 } 1549 }
1549#endif /* SCTP_DEBUG */ 1550#endif /* SCTP_DEBUG */
1550 result = 0; 1551 result = 0;
1551 } /* end switch */ 1552 } /* end switch */
1552 1553
1553 return (result); 1554 return (result);
1554} 1555}
1555 1556
1556static uint32_t 1557static uint32_t
1557sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa) 1558sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa)
1558{ 1559{
1559 struct sockaddr_in6 *sin6 /* , *net6 */ ; 1560 struct sockaddr_in6 *sin6;
1560 /*struct sctp_nets *net;*/ 1561 const struct sockaddr_in6 *net6;
 1562 struct sctp_nets *net;
1561 1563
1562 if (sa->sa_family != AF_INET6) { 1564 if (sa->sa_family != AF_INET6) {
1563 /* wrong family */ 1565 /* wrong family */
1564 return (0); 1566 return (0);
1565 } 1567 }
1566 1568
1567 sin6 = (struct sockaddr_in6 *)sa; 1569 sin6 = (struct sockaddr_in6 *)sa;
1568 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) == 0) { 1570 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) == 0) {
1569 /* not link local address */ 1571 /* not link local address */
1570 return (0); 1572 return (0);
1571 } 1573 }
1572#if 0 
1573 /* hunt through our destination nets list for this scope_id */ 1574 /* hunt through our destination nets list for this scope_id */
1574 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 1575 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1575 if ((rtcache_getdst(&net->ro))->sa_family != 1576 if ((rtcache_getdst(&net->ro))->sa_family !=
1576 AF_INET6) 1577 AF_INET6)
1577 continue; 1578 continue;
1578 net6 = (struct sockaddr_in6 *)rtcache_getdst(&net->ro); 1579 net6 = (const struct sockaddr_in6 *)rtcache_getdst(&net->ro);
1579 if (IN6_IS_ADDR_LINKLOCAL(&net6->sin6_addr) == 0) 1580 if (IN6_IS_ADDR_LINKLOCAL(&net6->sin6_addr) == 0)
1580 continue; 1581 continue;
1581 if (sctp_is_same_scope(sin6, net6)) { 1582 if (sctp_is_same_scope(sin6, net6)) {
1582 /* found one */ 1583 /* found one */
1583 return (1); 1584 return (1);
1584 } 1585 }
1585 } 1586 }
1586#endif 
1587 /* didn't find one */ 1587 /* didn't find one */
1588 return (0); 1588 return (0);
1589} 1589}
1590 1590
1591/* 1591/*
1592 * address management functions 1592 * address management functions
1593 */ 1593 */
1594static void 1594static void
1595sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, 1595sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
1596 struct ifaddr *ifa, uint16_t type) 1596 struct ifaddr *ifa, uint16_t type)
1597{ 1597{
1598 int status; 1598 int status;
1599#ifdef SCTP_DEBUG 1599#ifdef SCTP_DEBUG