Source-Changes-HG archive

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

[src/trunk]: src/sys Use non-variadic function pointer in protosw::pr_input.



details:   https://anonhg.NetBSD.org/src/rev/2b31674f8295
branches:  trunk
changeset: 433417:2b31674f8295
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Sep 14 05:09:51 2018 +0000

description:
Use non-variadic function pointer in protosw::pr_input.

diffstat:

 sys/dist/pf/net/if_pfsync.c |   6 +++---
 sys/dist/pf/net/if_pfsync.h |   4 ++--
 sys/netinet/dccp_usrreq.c   |  13 ++++---------
 sys/netinet/dccp_var.h      |   4 ++--
 sys/netinet/igmp.c          |  14 +++++---------
 sys/netinet/igmp_var.h      |   4 ++--
 sys/netinet/in_proto.c      |  15 ++++-----------
 sys/netinet/ip_carp.c       |   6 +++---
 sys/netinet/ip_carp.h       |   4 ++--
 sys/netinet/ip_encap.c      |  13 +++----------
 sys/netinet/ip_encap.h      |   4 ++--
 sys/netinet/ip_icmp.c       |  16 ++++------------
 sys/netinet/ip_icmp.h       |   4 ++--
 sys/netinet/ip_mroute.c     |  16 +++++-----------
 sys/netinet/ip_var.h        |   4 ++--
 sys/netinet/pim_var.h       |   4 ++--
 sys/netinet/raw_ip.c        |  14 ++++----------
 sys/netinet/sctp_input.c    |  13 ++++---------
 sys/netinet/sctp_var.h      |   4 ++--
 sys/netinet/tcp_input.c     |  13 ++++---------
 sys/netinet/tcp_var.h       |   4 ++--
 sys/netinet/udp_usrreq.c    |  14 ++++----------
 sys/netinet/udp_var.h       |   4 ++--
 sys/netipsec/ipsec.h        |   4 ++--
 sys/netipsec/ipsec_input.c  |  16 ++++------------
 sys/sys/protosw.h           |  15 ++++-----------
 26 files changed, 79 insertions(+), 153 deletions(-)

diffs (truncated from 777 to 300 lines):

diff -r 826d5ba242b0 -r 2b31674f8295 sys/dist/pf/net/if_pfsync.c
--- a/sys/dist/pf/net/if_pfsync.c       Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/dist/pf/net/if_pfsync.c       Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_pfsync.c,v 1.17 2018/06/27 03:31:44 msaitoh Exp $   */
+/*     $NetBSD: if_pfsync.c,v 1.18 2018/09/14 05:09:51 maxv Exp $      */
 /*     $OpenBSD: if_pfsync.c,v 1.83 2007/06/26 14:44:12 mcbride Exp $  */
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.17 2018/06/27 03:31:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.18 2018/09/14 05:09:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -348,7 +348,7 @@
 }
 
 void
-pfsync_input(struct mbuf *m, ...)
+pfsync_input(struct mbuf *m, int off, int proto)
 {
        struct ip *ip = mtod(m, struct ip *);
        struct pfsync_header *ph;
diff -r 826d5ba242b0 -r 2b31674f8295 sys/dist/pf/net/if_pfsync.h
--- a/sys/dist/pf/net/if_pfsync.h       Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/dist/pf/net/if_pfsync.h       Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_pfsync.h,v 1.3 2009/09/14 10:36:49 degroote Exp $   */
+/*     $NetBSD: if_pfsync.h,v 1.4 2018/09/14 05:09:51 maxv Exp $       */
 /*     $OpenBSD: if_pfsync.h,v 1.31 2007/05/31 04:11:42 mcbride Exp $  */
 
 /*
@@ -253,7 +253,7 @@
 } while (0)
 
 #ifdef _KERNEL
-void pfsync_input(struct mbuf *, ...);
+void pfsync_input(struct mbuf *, int, int);
 int pfsync_clear_states(u_int32_t, char *);
 int pfsync_pack_state(u_int8_t, struct pf_state *, int);
 #define pfsync_insert_state(st)        do {                            \
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/dccp_usrreq.c
--- a/sys/netinet/dccp_usrreq.c Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/dccp_usrreq.c Fri Sep 14 05:09:51 2018 +0000
@@ -1,5 +1,5 @@
 /*     $KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $   */
-/*     $NetBSD: dccp_usrreq.c,v 1.19 2018/05/18 18:58:51 maxv Exp $ */
+/*     $NetBSD: dccp_usrreq.c,v 1.20 2018/09/14 05:09:51 maxv Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.19 2018/05/18 18:58:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.20 2018/09/14 05:09:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -181,7 +181,7 @@
 }
 
 void
-dccp_input(struct mbuf *m, ...)
+dccp_input(struct mbuf *m, int off, int proto)
 {
        int iphlen;
        struct ip *ip = NULL;
@@ -210,12 +210,7 @@
        struct ip6_hdr *ip6 = NULL;
 #endif
 
-       int off;
-       va_list ap;
-       
-       va_start(ap, m);
-       iphlen = off = va_arg(ap, int);
-       va_end(ap);
+       iphlen = off;
 
        DCCP_DEBUG((LOG_INFO, "Got DCCP packet!\n"));
 
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/dccp_var.h
--- a/sys/netinet/dccp_var.h    Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/dccp_var.h    Fri Sep 14 05:09:51 2018 +0000
@@ -1,5 +1,5 @@
 /*     $KAME: dccp_var.h,v 1.29 2005/11/03 14:59:28 nishida Exp $      */
-/*     $NetBSD: dccp_var.h,v 1.4 2018/08/22 01:05:24 msaitoh Exp $ */
+/*     $NetBSD: dccp_var.h,v 1.5 2018/09/14 05:09:51 maxv Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -287,7 +287,7 @@
 /* These four functions are called from inetsw (in_proto.c) */
 void   dccp_init(void);
 void   dccp_log(int, const char *, ...);
-void   dccp_input(struct mbuf *, ...);
+void   dccp_input(struct mbuf *, int, int);
 void*  dccp_ctlinput(int, const struct sockaddr *, void *);
 int    dccp_ctloutput(int , struct socket *, struct sockopt *);
 int    dccp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/igmp.c
--- a/sys/netinet/igmp.c        Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/igmp.c        Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igmp.c,v 1.68 2018/06/21 10:37:50 knakahara Exp $      */
+/*     $NetBSD: igmp.c,v 1.69 2018/09/14 05:09:51 maxv Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.68 2018/06/21 10:37:50 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.69 2018/09/14 05:09:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -182,7 +182,7 @@
 }
 
 void
-igmp_input(struct mbuf *m, ...)
+igmp_input(struct mbuf *m, int off, int proto)
 {
        ifnet_t *ifp;
        struct ip *ip = mtod(m, struct ip *);
@@ -190,14 +190,10 @@
        u_int minlen, timer;
        struct in_multi *inm;
        struct in_ifaddr *ia;
-       int proto, ip_len, iphlen;
-       va_list ap;
+       int ip_len, iphlen;
        struct psref psref;
 
-       va_start(ap, m);
-       iphlen = va_arg(ap, int);
-       proto = va_arg(ap, int);
-       va_end(ap);
+       iphlen = off;
 
        IGMP_STATINC(IGMP_STAT_RCV_TOTAL);
 
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/igmp_var.h
--- a/sys/netinet/igmp_var.h    Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/igmp_var.h    Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igmp_var.h,v 1.24 2014/05/29 23:02:48 rmind Exp $      */
+/*     $NetBSD: igmp_var.h,v 1.25 2018/09/14 05:09:51 maxv Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -112,7 +112,7 @@
 #endif
 
 void   igmp_init(void);
-void   igmp_input(struct mbuf *, ...);
+void   igmp_input(struct mbuf *, int, int);
 int    igmp_joingroup(struct in_multi *);
 void   igmp_leavegroup(struct in_multi *);
 void   igmp_fasttimo(void);
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/in_proto.c
--- a/sys/netinet/in_proto.c    Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/in_proto.c    Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_proto.c,v 1.129 2018/08/14 14:49:14 maxv Exp $      */
+/*     $NetBSD: in_proto.c,v 1.130 2018/09/14 05:09:51 maxv 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.129 2018/08/14 14:49:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.130 2018/09/14 05:09:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -216,18 +216,11 @@
  * the ipsec shared library. We need a wrapper anyway.
  */
 static void
-ipsec4_common_input_wrapper(struct mbuf *m, ...)
+ipsec4_common_input_wrapper(struct mbuf *m, int off, int proto)
 {
 
        if (ipsec_enabled) {
-               int off, nxt;
-               va_list args;
-               /* XXX just passing args to ipsec4_common_input doesn't work */
-               va_start(args, m);
-               off = va_arg(args, int);
-               nxt = va_arg(args, int);
-               va_end(args);
-               ipsec4_common_input(m, off, nxt);
+               ipsec4_common_input(m, off, proto);
        } else {
                m_freem(m);
        }
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/ip_carp.c     Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.99 2018/06/26 06:48:03 msaitoh Exp $     */
+/*     $NetBSD: ip_carp.c,v 1.100 2018/09/14 05:09:51 maxv Exp $       */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.99 2018/06/26 06:48:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.100 2018/09/14 05:09:51 maxv Exp $");
 
 /*
  * TODO:
@@ -569,7 +569,7 @@
 }
 
 void
-carp_proto_input(struct mbuf *m, ...)
+carp_proto_input(struct mbuf *m, int off, int proto)
 {
 
        wqinput_input(carp_wqinput, m, 0, 0);
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/ip_carp.h
--- a/sys/netinet/ip_carp.h     Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/ip_carp.h     Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.h,v 1.9 2018/08/22 01:05:24 msaitoh Exp $      */
+/*     $NetBSD: ip_carp.h,v 1.10 2018/09/14 05:09:51 maxv Exp $        */
 /*     $OpenBSD: ip_carp.h,v 1.18 2005/04/20 23:00:41 mpf Exp $        */
 
 /*
@@ -146,7 +146,7 @@
 #ifdef _KERNEL
 void            carp_init(void);
 void            carp_ifdetach(struct ifnet *);
-void            carp_proto_input(struct mbuf *, ...);
+void            carp_proto_input(struct mbuf *, int, int);
 void            carp_carpdev_state(void *);
 int             carp6_proto_input(struct mbuf **, int *, int);
 int             carp_iamatch(struct in_ifaddr *, u_char *,
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/ip_encap.c
--- a/sys/netinet/ip_encap.c    Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/ip_encap.c    Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_encap.c,v 1.69 2018/06/21 10:37:50 knakahara Exp $  */
+/*     $NetBSD: ip_encap.c,v 1.70 2018/09/14 05:09:51 maxv Exp $       */
 /*     $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $       */
 
 /*
@@ -68,7 +68,7 @@
 #define USE_RADIX
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.69 2018/06/21 10:37:50 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.70 2018/09/14 05:09:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -342,19 +342,12 @@
 }
 
 void
-encap4_input(struct mbuf *m, ...)
+encap4_input(struct mbuf *m, int off, int proto)
 {
-       int off, proto;
-       va_list ap;
        const struct encapsw *esw;
        struct encaptab *match;
        struct psref match_psref;
 
-       va_start(ap, m);
-       off = va_arg(ap, int);
-       proto = va_arg(ap, int);
-       va_end(ap);
-
        match = encap4_lookup(m, off, proto, INBOUND, &match_psref);
        if (match) {
                /* found a match, "match" has the best one */
diff -r 826d5ba242b0 -r 2b31674f8295 sys/netinet/ip_encap.h
--- a/sys/netinet/ip_encap.h    Fri Sep 14 04:29:46 2018 +0000
+++ b/sys/netinet/ip_encap.h    Fri Sep 14 05:09:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_encap.h,v 1.24 2018/02/28 10:30:20 maxv Exp $       */
+/*     $NetBSD: ip_encap.h,v 1.25 2018/09/14 05:09:51 maxv Exp $       */
 /*     $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $      */
 
 /*



Home | Main Index | Thread Index | Old Index