Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Give proper prototype to ip_output.



details:   https://anonhg.NetBSD.org/src/rev/459d7766d75a
branches:  trunk
changeset: 813201:459d7766d75a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jan 21 15:27:48 2016 +0000

description:
Give proper prototype to ip_output.

diffstat:

 sys/net/if.c                |   12 +-
 sys/net/link_proto.c        |    8 +-
 sys/net/rtsock.c            |    9 +-
 sys/netatalk/at_proto.c     |   10 +-
 sys/netbt/bt_proto.c        |   16 ++--
 sys/netinet/if_arp.c        |   11 +-
 sys/netinet/in_proto.c      |  155 +++++++++++++++++++++++++++++++------------
 sys/netinet/in_proto.h      |    9 +-
 sys/netinet/ip_icmp.c       |    8 +-
 sys/netinet/ip_input.c      |   28 +++++--
 sys/netinet/raw_ip.c        |    6 +-
 sys/netinet6/icmp6.c        |    7 +-
 sys/netinet6/in6_proto.c    |  154 +++++++++++++++++++++++++++++++------------
 sys/netinet6/ip6protosw.h   |   30 +-------
 sys/netinet6/sctp6_usrreq.c |    6 +-
 sys/netipsec/ipsec_input.c  |    8 +-
 16 files changed, 300 insertions(+), 177 deletions(-)

diffs (truncated from 1234 to 300 lines):

diff -r f59f839cdf0f -r 459d7766d75a sys/net/if.c
--- a/sys/net/if.c      Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/net/if.c      Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.320 2016/01/04 09:08:38 ozaki-r Exp $ */
+/*     $NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.320 2016/01/04 09:08:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -745,7 +745,8 @@
 #endif
        struct domain *dp;
        const struct protosw *pr;
-       int s, i, family, purged;
+       size_t i;
+       int s, family, purged;
        uint64_t xc;
 
        /*
@@ -828,8 +829,9 @@
                 * ifp->if_addrlist.
                 */
                purged = 0;
-               for (pr = dp->dom_protosw;
-                    pr < dp->dom_protoswNPROTOSW; pr++) {
+               for (i = 0; i < dp->dom_nprotosw; i++) {
+                       pr = dp->dom_protosw[i];
+                       KASSERT(pr != NULL);
                        so.so_proto = pr;
                        if (pr->pr_usrreqs) {
                                (void) (*pr->pr_usrreqs->pr_purgeif)(&so, ifp);
diff -r f59f839cdf0f -r 459d7766d75a sys/net/link_proto.c
--- a/sys/net/link_proto.c      Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/net/link_proto.c      Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: link_proto.c,v 1.28 2015/05/02 17:18:03 rtr Exp $      */
+/*     $NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $        */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.28 2015/05/02 17:18:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -98,7 +98,7 @@
        .pr_purgeif     = link_purgeif,
 };
 
-const struct protosw linksw[] = {
+const struct protosw *const linksw[] = {
        {       .pr_type = SOCK_DGRAM,
                .pr_domain = &linkdomain,
                .pr_protocol = 0,       /* XXX */
@@ -117,7 +117,7 @@
        .dom_externalize = NULL,
        .dom_dispose = NULL,
        .dom_protosw = linksw,
-       .dom_protoswNPROTOSW = &linksw[__arraycount(linksw)],
+       .dom_nprotosw = __arraycount(linksw),
        .dom_sockaddr_cmp = sockaddr_dl_cmp
 };
 
diff -r f59f839cdf0f -r 459d7766d75a sys/net/rtsock.c
--- a/sys/net/rtsock.c  Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/net/rtsock.c  Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $   */
+/*     $NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1532,7 +1532,7 @@
        .pr_purgeif     = COMPATNAME(route_purgeif_wrapper),
 };
 
-static const struct protosw COMPATNAME(route_protosw)[] = {
+static const struct protosw *const COMPATNAME(route_protosw)[] = {
        {
                .pr_type = SOCK_RAW,
                .pr_domain = &COMPATNAME(routedomain),
@@ -1549,8 +1549,7 @@
        .dom_name = DOMAINNAME,
        .dom_init = COMPATNAME(route_init),
        .dom_protosw = COMPATNAME(route_protosw),
-       .dom_protoswNPROTOSW =
-           &COMPATNAME(route_protosw)[__arraycount(COMPATNAME(route_protosw))],
+       .dom_nprotosw = __arraycount(COMPATNAME(route_protosw)),
 };
 
 static void
diff -r f59f839cdf0f -r 459d7766d75a sys/netatalk/at_proto.c
--- a/sys/netatalk/at_proto.c   Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/netatalk/at_proto.c   Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_proto.c,v 1.19 2016/01/20 21:43:59 riastradh Exp $  */
+/*     $NetBSD: at_proto.c,v 1.20 2016/01/21 15:27:48 riastradh Exp $  */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.19 2016/01/20 21:43:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.20 2016/01/21 15:27:48 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,8 +49,8 @@
 
 DOMAIN_DEFINE(atalkdomain);    /* forward declare and add to link set */
 
-const struct protosw atalksw[] = {
-    {
+const struct protosw *const atalksw[] = {
+    &(const struct protosw) {
        .pr_type = SOCK_DGRAM,
        .pr_domain = &atalkdomain,
        .pr_protocol = ATPROTO_DDP,
@@ -67,7 +67,7 @@
        .dom_externalize = NULL,
        .dom_dispose = NULL,
        .dom_protosw = atalksw,
-       .dom_protoswNPROTOSW = &atalksw[__arraycount(atalksw)],
+       .dom_nprotosw = __arraycount(atalksw),
        .dom_rtattach = rt_inithead,
        .dom_rtoffset = 32,
        .dom_maxrtkey = sizeof(struct sockaddr_at),
diff -r f59f839cdf0f -r 459d7766d75a sys/netbt/bt_proto.c
--- a/sys/netbt/bt_proto.c      Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/netbt/bt_proto.c      Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt_proto.c,v 1.14 2014/05/19 02:51:24 rmind Exp $      */
+/*     $NetBSD: bt_proto.c,v 1.15 2016/01/21 15:27:48 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.14 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.15 2016/01/21 15:27:48 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/domain.h>
@@ -62,8 +62,8 @@
 #define        l2cap_ctloutput         l2cap_ctloutput_wrapper
 #define        rfcomm_ctloutput        rfcomm_ctloutput_wrapper
 
-static const struct protosw btsw[] = {
-       { /* raw HCI commands */
+static const struct protosw *const btsw[] = {
+       &(const struct protosw) { /* raw HCI commands */
                .pr_type = SOCK_RAW,
                .pr_domain = &btdomain,
                .pr_protocol = BTPROTO_HCI,
@@ -72,7 +72,7 @@
                .pr_ctloutput = hci_ctloutput,
                .pr_usrreqs = &hci_usrreqs,
        },
-       { /* HCI SCO data (audio) */
+       &(const struct protosw) { /* HCI SCO data (audio) */
                .pr_type = SOCK_SEQPACKET,
                .pr_domain = &btdomain,
                .pr_protocol = BTPROTO_SCO,
@@ -80,7 +80,7 @@
                .pr_ctloutput = sco_ctloutput,
                .pr_usrreqs = &sco_usrreqs,
        },
-       { /* L2CAP Connection Oriented */
+       &(const struct protosw) { /* L2CAP Connection Oriented */
                .pr_type = SOCK_SEQPACKET,
                .pr_domain = &btdomain,
                .pr_protocol = BTPROTO_L2CAP,
@@ -89,7 +89,7 @@
                .pr_usrreqs = &l2cap_usrreqs,
                .pr_init = l2cap_init,
        },
-       { /* RFCOMM */
+       &(const struct protosw) { /* RFCOMM */
                .pr_type = SOCK_STREAM,
                .pr_domain = &btdomain,
                .pr_protocol = BTPROTO_RFCOMM,
@@ -105,7 +105,7 @@
        .dom_name = "bluetooth",
        .dom_init = bt_init,
        .dom_protosw = btsw,
-       .dom_protoswNPROTOSW = &btsw[__arraycount(btsw)],
+       .dom_nprotosw = __arraycount(btsw),
 };
 
 kmutex_t *bt_lock;
diff -r f59f839cdf0f -r 459d7766d75a sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/netinet/if_arp.c      Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.200 2016/01/20 21:43:59 riastradh Exp $   */
+/*     $NetBSD: if_arp.c,v 1.201 2016/01/21 15:27:48 riastradh Exp $   */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.200 2016/01/20 21:43:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.201 2016/01/21 15:27:48 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -264,8 +264,9 @@
        }
 }
 
-const struct protosw arpsw[] = {
-       { .pr_type = 0,
+const struct protosw *const arpsw[] = {
+       &(const struct protosw) {
+         .pr_type = 0,
          .pr_domain = &arpdomain,
          .pr_protocol = 0,
          .pr_flags = 0,
@@ -284,7 +285,7 @@
        .dom_family = PF_ARP,
        .dom_name = "arp",
        .dom_protosw = arpsw,
-       .dom_protoswNPROTOSW = &arpsw[__arraycount(arpsw)],
+       .dom_nprotosw = __arraycount(arpsw),
 };
 
 static void sysctl_net_inet_arp_setup(struct sysctllog **);
diff -r f59f839cdf0f -r 459d7766d75a sys/netinet/in_proto.c
--- a/sys/netinet/in_proto.c    Thu Jan 21 04:55:40 2016 +0000
+++ b/sys/netinet/in_proto.c    Thu Jan 21 15:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_proto.c,v 1.116 2016/01/20 21:43:59 riastradh Exp $ */
+/*     $NetBSD: in_proto.c,v 1.117 2016/01/21 15:27:48 riastradh Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.116 2016/01/20 21:43:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.117 2016/01/21 15:27:48 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -196,214 +196,277 @@
 #define        esp4_ctlinput   esp4_ctlinput_wrapper
 #endif
 
-const struct protosw inetsw[] = {
-{      .pr_domain = &inetdomain,
+const struct ipprotosw inetsw[] = {
+{
+    .ippr_protosw = {
+       .pr_domain = &inetdomain,
        .pr_init = ip_init,
        .pr_fasttimo = ip_fasttimo,
        .pr_slowtimo = ip_slowtimo,
        .pr_drain = ip_drainstub,
+    },
 },
-{      .pr_type = SOCK_DGRAM,
+{
+    .ippr_protosw = {
+       .pr_type = SOCK_DGRAM,
        .pr_domain = &inetdomain,
        .pr_protocol = IPPROTO_UDP,
        .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
-       .pr_input = udp_input,
        .pr_ctlinput = udp_ctlinput,
        .pr_ctloutput = udp_ctloutput,
        .pr_usrreqs = &udp_usrreqs,



Home | Main Index | Thread Index | Old Index