Hi,

I would like to pass down the address family through the pr_input
calls.  There are functions like tcp_input() and udp_input() which
read the version from the IP header.  This layer violation could
be avoided if they know the af.  Functions like carp_proto_input
and carp6_proto_input could be unified.

This is only the machanical part that adds an af parameter.

ok?

bluhm

Index: net/if_etherip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_etherip.c,v
retrieving revision 1.16
diff -u -p -r1.16 if_etherip.c
--- net/if_etherip.c    27 Mar 2017 23:49:03 -0000      1.16
+++ net/if_etherip.c    12 Apr 2017 21:53:16 -0000
@@ -405,7 +405,7 @@ ip_etherip_output(struct ifnet *ifp, str
 }
 
 int
-ip_etherip_input(struct mbuf **mp, int *offp, int proto)
+ip_etherip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -453,7 +453,7 @@ ip_etherip_input(struct mbuf **mp, int *
                 * This is tricky but the path will be removed soon when
                 * implementation of etherip is removed from gif(4).
                 */
-               return etherip_input(mp, offp, proto);
+               return etherip_input(mp, offp, proto, af);
 #else
                etheripstat.etherips_noifdrops++;
                m_freem(m);
@@ -567,7 +567,7 @@ drop:
 }
 
 int
-ip6_etherip_input(struct mbuf **mp, int *offp, int proto)
+ip6_etherip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct mbuf_list ml = MBUF_LIST_INITIALIZER();
@@ -613,7 +613,7 @@ ip6_etherip_input(struct mbuf **mp, int 
                 * This is tricky but the path will be removed soon when
                 * implementation of etherip is removed from gif(4).
                 */
-               return etherip_input(mp, offp, proto);
+               return etherip_input(mp, offp, proto, af);
 #else
                etheripstat.etherips_noifdrops++;
                m_freem(m);
Index: net/if_etherip.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_etherip.h,v
retrieving revision 1.5
diff -u -p -r1.5 if_etherip.h
--- net/if_etherip.h    8 Mar 2017 06:50:38 -0000       1.5
+++ net/if_etherip.h    12 Apr 2017 21:53:27 -0000
@@ -73,11 +73,11 @@ struct etherip_header {
 
 int ip_etherip_sysctl(int *, uint, void *, size_t *, void *, size_t);
 int ip_etherip_output(struct ifnet *, struct mbuf *);
-int ip_etherip_input(struct mbuf **, int *, int);
+int ip_etherip_input(struct mbuf **, int *, int, int);
 
 #ifdef INET6
 int ip6_etherip_output(struct ifnet *, struct mbuf *);
-int ip6_etherip_input(struct mbuf **, int *, int);
+int ip6_etherip_input(struct mbuf **, int *, int, int);
 #endif /* INET6 */
 
 
Index: net/if_gif.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gif.c,v
retrieving revision 1.91
diff -u -p -r1.91 if_gif.c
--- net/if_gif.c        29 Jan 2017 19:58:47 -0000      1.91
+++ net/if_gif.c        12 Apr 2017 22:01:27 -0000
@@ -716,7 +716,7 @@ in_gif_output(struct ifnet *ifp, int fam
 }
 
 int
-in_gif_input(struct mbuf **mp, int *offp, int proto)
+in_gif_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct gif_softc *sc;
@@ -762,7 +762,7 @@ in_gif_input(struct mbuf **mp, int *offp
 
 inject:
        /* No GIF interface was configured */
-       return ip4_input(mp, offp, proto);
+       return ip4_input(mp, offp, proto, af);
 }
 
 #ifdef INET6
@@ -839,7 +839,7 @@ in6_gif_output(struct ifnet *ifp, int fa
        return 0;
 }
 
-int in6_gif_input(struct mbuf **mp, int *offp, int proto)
+int in6_gif_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct gif_softc *sc;
@@ -888,6 +888,6 @@ int in6_gif_input(struct mbuf **mp, int 
 
 inject:
        /* No GIF tunnel configured */
-       return ip4_input(mp, offp, proto);
+       return ip4_input(mp, offp, proto, af);
 }
 #endif /* INET6 */
Index: net/if_gif.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gif.h,v
retrieving revision 1.16
diff -u -p -r1.16 if_gif.h
--- net/if_gif.h        29 Jan 2017 19:58:47 -0000      1.16
+++ net/if_gif.h        12 Apr 2017 22:00:46 -0000
@@ -49,7 +49,7 @@ extern LIST_HEAD(gif_softc_head, gif_sof
 
 int gif_encap(struct ifnet *, struct mbuf **, sa_family_t);
 
-int in_gif_input(struct mbuf **, int *, int);
-int in6_gif_input(struct mbuf **, int *, int);
+int in_gif_input(struct mbuf **, int *, int, int);
+int in6_gif_input(struct mbuf **, int *, int, int);
 
 #endif /* _NET_IF_GIF_H_ */
Index: net/if_pfsync.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_pfsync.c,v
retrieving revision 1.248
diff -u -p -r1.248 if_pfsync.c
--- net/if_pfsync.c     9 Apr 2017 17:57:58 -0000       1.248
+++ net/if_pfsync.c     12 Apr 2017 22:17:18 -0000
@@ -649,7 +649,7 @@ pfsync_state_import(struct pfsync_state 
 }
 
 int
-pfsync_input(struct mbuf **mp, int *offp, int proto)
+pfsync_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *n, *m = *mp;
        struct pfsync_softc *sc = pfsyncif;
Index: net/if_pfsync.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_pfsync.h,v
retrieving revision 1.52
diff -u -p -r1.52 if_pfsync.h
--- net/if_pfsync.h     20 Feb 2017 06:30:39 -0000      1.52
+++ net/if_pfsync.h     12 Apr 2017 22:17:24 -0000
@@ -316,7 +316,7 @@ pfsyncstat_inc(enum pfsync_counters c)
 #define PFSYNC_S_DEFER 0xfe
 #define PFSYNC_S_NONE  0xff
 
-int                    pfsync_input(struct mbuf **, int *, int);
+int                    pfsync_input(struct mbuf **, int *, int, int);
 int                    pfsync_sysctl(int *, u_int,  void *, size_t *,
                            void *, size_t);
 
Index: netinet/icmp6.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/icmp6.h,v
retrieving revision 1.43
diff -u -p -r1.43 icmp6.h
--- netinet/icmp6.h     9 Feb 2017 15:23:35 -0000       1.43
+++ netinet/icmp6.h     12 Apr 2017 21:56:23 -0000
@@ -621,7 +621,7 @@ struct      in6_multi;
 void   icmp6_init(void);
 void   icmp6_paramerror(struct mbuf *, int);
 void   icmp6_error(struct mbuf *, int, int, int);
-int    icmp6_input(struct mbuf **, int *, int);
+int    icmp6_input(struct mbuf **, int *, int, int);
 void   icmp6_fasttimo(void);
 void   icmp6_reflect(struct mbuf *, size_t);
 void   icmp6_prepare(struct mbuf *);
Index: netinet/igmp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/igmp.c,v
retrieving revision 1.65
diff -u -p -r1.65 igmp.c
--- netinet/igmp.c      5 Apr 2017 13:35:18 -0000       1.65
+++ netinet/igmp.c      12 Apr 2017 22:18:13 -0000
@@ -107,7 +107,7 @@ void igmp_checktimer(struct ifnet *);
 void igmp_sendpkt(struct ifnet *, struct in_multi *, int, in_addr_t);
 int rti_fill(struct in_multi *);
 struct router_info * rti_find(struct ifnet *);
-int igmp_input_if(struct ifnet *, struct mbuf **, int *, int);
+int igmp_input_if(struct ifnet *, struct mbuf **, int *, int, int);
 int igmp_sysctl_igmpstat(void *, size_t *, void *);
 
 void
@@ -209,7 +209,7 @@ rti_delete(struct ifnet *ifp)
 }
 
 int
-igmp_input(struct mbuf **mp, int *offp, int proto)
+igmp_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct ifnet *ifp;
 
@@ -221,13 +221,13 @@ igmp_input(struct mbuf **mp, int *offp, 
                return IPPROTO_DONE;
        }
 
-       proto = igmp_input_if(ifp, mp, offp, proto);
+       proto = igmp_input_if(ifp, mp, offp, proto, af);
        if_put(ifp);
        return proto;
 }
 
 int
-igmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto)
+igmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto, int 
af)
 {
        struct mbuf *m = *mp;
        int iphlen = *offp;
@@ -490,7 +490,7 @@ igmp_input_if(struct ifnet *ifp, struct 
         * Pass all valid IGMP packets up to any process(es) listening
         * on a raw IGMP socket.
         */
-       return rip_input(mp, offp, proto);
+       return rip_input(mp, offp, proto, af);
 }
 
 void
Index: netinet/igmp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/igmp_var.h,v
retrieving revision 1.12
diff -u -p -r1.12 igmp_var.h
--- netinet/igmp_var.h  29 Jan 2017 19:58:47 -0000      1.12
+++ netinet/igmp_var.h  12 Apr 2017 22:08:36 -0000
@@ -110,7 +110,7 @@ igmpstat_inc(enum igmpstat_counters c)
 #define        IGMP_RANDOM_DELAY(X)    (arc4random_uniform(X) + 1)
 
 void   igmp_init(void);
-int    igmp_input(struct mbuf **, int *, int);
+int    igmp_input(struct mbuf **, int *, int, int);
 void   igmp_joingroup(struct in_multi *);
 void   igmp_leavegroup(struct in_multi *);
 void   igmp_fasttimo(void);
Index: netinet/ip_carp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.306
diff -u -p -r1.306 ip_carp.c
--- netinet/ip_carp.c   9 Apr 2017 17:57:58 -0000       1.306
+++ netinet/ip_carp.c   12 Apr 2017 21:36:40 -0000
@@ -415,7 +415,7 @@ carp_hmac_verify(struct carp_vhost_entry
 }
 
 int
-carp_proto_input(struct mbuf **mp, int *offp, int proto)
+carp_proto_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct ifnet *ifp;
 
@@ -511,7 +511,7 @@ carp_proto_input_if(struct ifnet *ifp, s
 
 #ifdef INET6
 int
-carp6_proto_input(struct mbuf **mp, int *offp, int proto)
+carp6_proto_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct ifnet *ifp;
 
Index: netinet/ip_carp.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_carp.h,v
retrieving revision 1.41
diff -u -p -r1.41 ip_carp.h
--- netinet/ip_carp.h   20 Feb 2017 06:29:42 -0000      1.41
+++ netinet/ip_carp.h   12 Apr 2017 21:37:02 -0000
@@ -194,10 +194,10 @@ carpstat_inc(enum carpstat_counters c)
 }
 
 void            carp_ifdetach (struct ifnet *);
-int             carp_proto_input(struct mbuf **, int *, int);
+int             carp_proto_input(struct mbuf **, int *, int, int);
 void            carp_carpdev_state(void *);
 void            carp_group_demote_adj(struct ifnet *, int, char *);
-int             carp6_proto_input(struct mbuf **, int *, int);
+int             carp6_proto_input(struct mbuf **, int *, int, int);
 int             carp_iamatch(struct ifnet *);
 int             carp_iamatch6(struct ifnet *);
 struct ifnet   *carp_ourether(void *, u_int8_t *);
Index: netinet/ip_divert.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_divert.h,v
retrieving revision 1.9
diff -u -p -r1.9 ip_divert.h
--- netinet/ip_divert.h 13 Mar 2017 20:18:21 -0000      1.9
+++ netinet/ip_divert.h 12 Apr 2017 22:34:01 -0000
@@ -73,7 +73,6 @@ divstat_inc(enum divstat_counters c)
 extern struct  inpcbtable      divbtable;
 
 void    divert_init(void);
-void    divert_input(struct mbuf *, int, int);
 int     divert_packet(struct mbuf *, int, u_int16_t);
 int     divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     divert_usrreq(struct socket *,
Index: netinet/ip_ether.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ether.c,v
retrieving revision 1.84
diff -u -p -r1.84 ip_ether.c
--- netinet/ip_ether.c  7 Mar 2017 23:35:06 -0000       1.84
+++ netinet/ip_ether.c  12 Apr 2017 21:53:54 -0000
@@ -88,7 +88,7 @@ struct etheripstat etheripstat;
  * etherip_input gets called when we receive an encapsulated packet.
  */
 int
-etherip_input(struct mbuf **mp, int *offp, int proto)
+etherip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        switch (proto) {
 #if NBRIDGE > 0
Index: netinet/ip_ether.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ether.h,v
retrieving revision 1.21
diff -u -p -r1.21 ip_ether.h
--- netinet/ip_ether.h  7 Mar 2017 23:35:06 -0000       1.21
+++ netinet/ip_ether.h  12 Apr 2017 21:54:09 -0000
@@ -72,7 +72,7 @@ struct etherip_header {
 struct tdb;
 
 int    etherip_output(struct mbuf *, struct tdb *, struct mbuf **, int);
-int    etherip_input(struct mbuf **, int *, int);
+int    etherip_input(struct mbuf **, int *, int, int);
 int    etherip_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
 extern int etherip_allow;
Index: netinet/ip_gre.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_gre.c,v
retrieving revision 1.62
diff -u -p -r1.62 ip_gre.c
--- netinet/ip_gre.c    29 Jan 2017 19:58:47 -0000      1.62
+++ netinet/ip_gre.c    12 Apr 2017 22:16:32 -0000
@@ -216,7 +216,7 @@ gre_input2(struct mbuf *m, int hlen, int
  * IPPROTO_GRE and a local destination address).
  */
 int
-gre_input(struct mbuf **mp, int *offp, int proto)
+gre_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        int hlen = *offp;
@@ -247,7 +247,7 @@ gre_input(struct mbuf **mp, int *offp, i
         * but we're not set to accept them.
         */
        if (!ret)
-               return rip_input(mp, offp, proto);
+               return rip_input(mp, offp, proto, af);
        return IPPROTO_DONE;
 }
 
@@ -259,7 +259,7 @@ gre_input(struct mbuf **mp, int *offp, i
  */
 
 int
-gre_mobile_input(struct mbuf **mp, int *offp, int proto)
+gre_mobile_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct ip *ip;
Index: netinet/ip_gre.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_gre.h,v
retrieving revision 1.11
diff -u -p -r1.11 ip_gre.h
--- netinet/ip_gre.h    29 Jan 2017 19:58:47 -0000      1.11
+++ netinet/ip_gre.h    12 Apr 2017 22:16:40 -0000
@@ -64,8 +64,8 @@
 }
 
 #ifdef _KERNEL
-int    gre_input(struct mbuf **, int *, int);
-int    gre_mobile_input(struct mbuf **, int *, int);
+int    gre_input(struct mbuf **, int *, int, int);
+int    gre_mobile_input(struct mbuf **, int *, int, int);
 int     ipmobile_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     gre_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     gre_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct 
mbuf *, struct proc *);
Index: netinet/ip_icmp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.164
diff -u -p -r1.164 ip_icmp.c
--- netinet/ip_icmp.c   5 Apr 2017 13:35:18 -0000       1.164
+++ netinet/ip_icmp.c   12 Apr 2017 22:06:30 -0000
@@ -128,7 +128,7 @@ int *icmpctl_vars[ICMPCTL_MAXID] = ICMPC
 void icmp_mtudisc_timeout(struct rtentry *, struct rttimer *);
 int icmp_ratelimit(const struct in_addr *, const int, const int);
 void icmp_redirect_timeout(struct rtentry *, struct rttimer *);
-int icmp_input_if(struct ifnet *, struct mbuf **, int *, int);
+int icmp_input_if(struct ifnet *, struct mbuf **, int *, int, int);
 int icmp_sysctl_icmpstat(void *, size_t *, void *);
 
 void
@@ -306,7 +306,7 @@ icmp_error(struct mbuf *n, int type, int
  * Process a received ICMP message.
  */
 int
-icmp_input(struct mbuf **mp, int *offp, int proto)
+icmp_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct ifnet *ifp;
 
@@ -316,13 +316,13 @@ icmp_input(struct mbuf **mp, int *offp, 
                return IPPROTO_DONE;
        }
 
-       proto = icmp_input_if(ifp, mp, offp, proto);
+       proto = icmp_input_if(ifp, mp, offp, proto, af);
        if_put(ifp);
        return proto;
 }
 
 int
-icmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto)
+icmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto, int 
af)
 {
        struct mbuf *m = *mp;
        int hlen = *offp;
@@ -685,7 +685,7 @@ reflect:
        }
 
 raw:
-       return rip_input(mp, offp, proto);
+       return rip_input(mp, offp, proto, af);
 
 freeit:
        m_freem(m);
Index: netinet/ip_icmp.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_icmp.h,v
retrieving revision 1.29
diff -u -p -r1.29 ip_icmp.h
--- netinet/ip_icmp.h   29 Jan 2017 19:58:47 -0000      1.29
+++ netinet/ip_icmp.h   12 Apr 2017 22:06:45 -0000
@@ -232,7 +232,7 @@ struct icmp_ext_obj_hdr {
 struct mbuf *
        icmp_do_error(struct mbuf *, int, int, u_int32_t, int);
 void   icmp_error(struct mbuf *, int, int, u_int32_t, int);
-int    icmp_input(struct mbuf **, int *, int);
+int    icmp_input(struct mbuf **, int *, int, int);
 void   icmp_init(void);
 int    icmp_reflect(struct mbuf *, struct mbuf **, struct in_ifaddr *);
 void   icmp_send(struct mbuf *, struct mbuf *);
Index: netinet/ip_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.296
diff -u -p -r1.296 ip_input.c
--- netinet/ip_input.c  5 Apr 2017 13:35:18 -0000       1.296
+++ netinet/ip_input.c  12 Apr 2017 21:34:05 -0000
@@ -584,7 +584,7 @@ found:
         * Switch out to protocol's input routine.
         */
        ipstat_inc(ips_delivered);
-       (*inetsw[ip_protox[ip->ip_p]].pr_input)(&m, &hlen, ip->ip_p);
+       (*inetsw[ip_protox[ip->ip_p]].pr_input)(&m, &hlen, ip->ip_p, AF_INET);
        return;
 bad:
        m_freem(m);
Index: netinet/ip_ipip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipip.c,v
retrieving revision 1.73
diff -u -p -r1.73 ip_ipip.c
--- netinet/ip_ipip.c   5 Apr 2017 13:35:18 -0000       1.73
+++ netinet/ip_ipip.c   12 Apr 2017 22:04:33 -0000
@@ -96,7 +96,7 @@ ipip_init(void)
  * Really only a wrapper for ipip_input(), for use with pr_input.
  */
 int
-ip4_input(struct mbuf **mp, int *offp, int proto)
+ip4_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        /* If we do not accept IP-in-IP explicitly, drop.  */
        if (!ipip_allow && ((*mp)->m_flags & (M_AUTH|M_CONF)) == 0) {
Index: netinet/ip_ipsp.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipsp.h,v
retrieving revision 1.178
diff -u -p -r1.178 ip_ipsp.h
--- netinet/ip_ipsp.h   7 Feb 2017 22:28:37 -0000       1.178
+++ netinet/ip_ipsp.h   12 Apr 2017 22:14:10 -0000
@@ -478,7 +478,7 @@ void        ipe4_input(struct mbuf *, int, int)
 int    ipip_input(struct mbuf **, int *, struct ifnet *, int);
 int    ipip_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
 
-int    ip4_input(struct mbuf **, int *, int);
+int    ip4_input(struct mbuf **, int *, int, int);
 
 /* XF_AH */
 int    ah_attach(void);
@@ -488,12 +488,12 @@ int       ah_input(struct mbuf *, struct tdb *
 int    ah_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
 int    ah_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
-int    ah4_input(struct mbuf **, int *, int);
+int    ah4_input(struct mbuf **, int *, int, int);
 void   ah4_ctlinput(int, struct sockaddr *, u_int, void *);
 void   udpencap_ctlinput(int, struct sockaddr *, u_int, void *);
 
 #ifdef INET6
-int    ah6_input(struct mbuf **, int *, int);
+int    ah6_input(struct mbuf **, int *, int, int);
 #endif /* INET6 */
 
 /* XF_ESP */
@@ -504,11 +504,11 @@ int       esp_input(struct mbuf *, struct tdb 
 int    esp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
 int    esp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
-int    esp4_input(struct mbuf **, int *, int);
+int    esp4_input(struct mbuf **, int *, int, int);
 void   esp4_ctlinput(int, struct sockaddr *, u_int, void *);
 
 #ifdef INET6
-int    esp6_input(struct mbuf **, int *, int);
+int    esp6_input(struct mbuf **, int *, int, int);
 #endif /* INET6 */
 
 /* XF_IPCOMP */
@@ -518,9 +518,9 @@ int ipcomp_zeroize(struct tdb *);
 int    ipcomp_input(struct mbuf *, struct tdb *, int, int);
 int    ipcomp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
 int    ipcomp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-int    ipcomp4_input(struct mbuf **, int *, int);
+int    ipcomp4_input(struct mbuf **, int *, int, int);
 #ifdef INET6
-int    ipcomp6_input(struct mbuf **, int *, int);
+int    ipcomp6_input(struct mbuf **, int *, int, int);
 #endif /* INET6 */
 
 /* XF_TCPSIGNATURE */
Index: netinet/ip_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_var.h,v
retrieving revision 1.70
diff -u -p -r1.70 ip_var.h
--- netinet/ip_var.h    13 Mar 2017 20:18:21 -0000      1.70
+++ netinet/ip_var.h    12 Apr 2017 21:55:26 -0000
@@ -252,7 +252,7 @@ void         ipv4_input(struct mbuf *);
 void    ip_forward(struct mbuf *, struct ifnet *, struct rtentry *, int);
 int     rip_ctloutput(int, struct socket *, int, int, struct mbuf *);
 void    rip_init(void);
-int     rip_input(struct mbuf **, int *, int);
+int     rip_input(struct mbuf **, int *, int, int);
 int     rip_output(struct mbuf *, struct socket *, struct sockaddr *,
            struct mbuf *);
 int     rip_usrreq(struct socket *,
Index: netinet/ipsec_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ipsec_input.c,v
retrieving revision 1.146
diff -u -p -r1.146 ipsec_input.c
--- netinet/ipsec_input.c       6 Apr 2017 14:25:18 -0000       1.146
+++ netinet/ipsec_input.c       12 Apr 2017 22:15:45 -0000
@@ -139,11 +139,11 @@ ipsec_common_input(struct mbuf *m, int s
            (sproto == IPPROTO_IPCOMP && !ipcomp_enable)) {
                switch (af) {
                case AF_INET:
-                       rip_input(&m, &skip, sproto);
+                       rip_input(&m, &skip, sproto, af);
                        break;
 #ifdef INET6
                case AF_INET6:
-                       rip6_input(&m, &skip, sproto);
+                       rip6_input(&m, &skip, sproto, af);
                        break;
 #endif /* INET6 */
                default:
@@ -671,7 +671,7 @@ ipcomp_sysctl(int *name, u_int namelen, 
 
 /* IPv4 AH wrapper. */
 int
-ah4_input(struct mbuf **mp, int *offp, int proto)
+ah4_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        ipsec_common_input(*mp, *offp, offsetof(struct ip, ip_p), AF_INET,
            proto, 0);
@@ -691,7 +691,7 @@ ah4_ctlinput(int cmd, struct sockaddr *s
 
 /* IPv4 ESP wrapper. */
 int
-esp4_input(struct mbuf **mp, int *offp, int proto)
+esp4_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        ipsec_common_input(*mp, *offp, offsetof(struct ip, ip_p), AF_INET,
            proto, 0);
@@ -700,7 +700,7 @@ esp4_input(struct mbuf **mp, int *offp, 
 
 /* IPv4 IPCOMP wrapper */
 int
-ipcomp4_input(struct mbuf **mp, int *offp, int proto)
+ipcomp4_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        ipsec_common_input(*mp, *offp, offsetof(struct ip, ip_p), AF_INET,
            proto, 0);
@@ -836,7 +836,7 @@ esp4_ctlinput(int cmd, struct sockaddr *
 #ifdef INET6
 /* IPv6 AH wrapper. */
 int
-ah6_input(struct mbuf **mp, int *offp, int proto)
+ah6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        int l = 0;
        int protoff, nxt;
@@ -888,7 +888,7 @@ ah6_input(struct mbuf **mp, int *offp, i
 
 /* IPv6 ESP wrapper. */
 int
-esp6_input(struct mbuf **mp, int *offp, int proto)
+esp6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        int l = 0;
        int protoff, nxt;
@@ -941,7 +941,7 @@ esp6_input(struct mbuf **mp, int *offp, 
 
 /* IPv6 IPcomp wrapper */
 int
-ipcomp6_input(struct mbuf **mp, int *offp, int proto)
+ipcomp6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        int l = 0;
        int protoff, nxt;
Index: netinet/raw_ip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.97
diff -u -p -r1.97 raw_ip.c
--- netinet/raw_ip.c    13 Mar 2017 20:18:21 -0000      1.97
+++ netinet/raw_ip.c    12 Apr 2017 21:55:40 -0000
@@ -116,7 +116,7 @@ rip_init(void)
 struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
 
 int
-rip_input(struct mbuf **mp, int *offp, int proto)
+rip_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct ip *ip = mtod(m, struct ip *);
Index: netinet/tcp_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.338
diff -u -p -r1.338 tcp_input.c
--- netinet/tcp_input.c 9 Feb 2017 15:19:32 -0000       1.338
+++ netinet/tcp_input.c 12 Apr 2017 22:20:50 -0000
@@ -355,7 +355,7 @@ tcp_flush_queue(struct tcpcb *tp)
  * protocol specification dated September, 1981 very closely.
  */
 int
-tcp_input(struct mbuf **mp, int *offp, int proto)
+tcp_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        int iphlen = *offp;
@@ -383,7 +383,6 @@ tcp_input(struct mbuf **mp, int *offp, i
        struct tdb *tdb;
        int error;
 #endif /* IPSEC */
-       int af;
 #ifdef TCP_ECN
        u_char iptos;
 #endif
Index: netinet/tcp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v
retrieving revision 1.123
diff -u -p -r1.123 tcp_var.h
--- netinet/tcp_var.h   13 Mar 2017 20:18:21 -0000      1.123
+++ netinet/tcp_var.h   12 Apr 2017 21:46:17 -0000
@@ -733,7 +733,7 @@ struct tcpcb *
 int     tcp_dooptions(struct tcpcb *, u_char *, int, struct tcphdr *,
                struct mbuf *, int, struct tcp_opt_info *, u_int);
 void    tcp_init(void);
-int     tcp_input(struct mbuf **, int *, int);
+int     tcp_input(struct mbuf **, int *, int, int);
 int     tcp_mss(struct tcpcb *, int);
 void    tcp_mss_update(struct tcpcb *);
 u_int   tcp_hdrsz(struct tcpcb *);
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.233
diff -u -p -r1.233 udp_usrreq.c
--- netinet/udp_usrreq.c        5 Apr 2017 13:35:18 -0000       1.233
+++ netinet/udp_usrreq.c        12 Apr 2017 21:44:56 -0000
@@ -148,7 +148,7 @@ udp_init(void)
 }
 
 int
-udp_input(struct mbuf **mp, int *offp, int proto)
+udp_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        int iphlen = *offp;
Index: netinet/udp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_var.h,v
retrieving revision 1.32
diff -u -p -r1.32 udp_var.h
--- netinet/udp_var.h   13 Mar 2017 20:18:21 -0000      1.32
+++ netinet/udp_var.h   12 Apr 2017 21:44:31 -0000
@@ -141,7 +141,7 @@ void        udp6_ctlinput(int, struct sockaddr 
 #endif /* INET6 */
 void    udp_ctlinput(int, struct sockaddr *, u_int, void *);
 void    udp_init(void);
-int     udp_input(struct mbuf **, int *, int);
+int     udp_input(struct mbuf **, int *, int, int);
 #ifdef INET6
 int     udp6_output(struct inpcb *, struct mbuf *, struct mbuf *,
        struct mbuf *);
Index: netinet6/dest6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/dest6.c,v
retrieving revision 1.16
diff -u -p -r1.16 dest6.c
--- netinet6/dest6.c    5 Feb 2017 16:04:14 -0000       1.16
+++ netinet6/dest6.c    12 Apr 2017 21:57:26 -0000
@@ -49,7 +49,7 @@
  * Destination options header processing.
  */
 int
-dest6_input(struct mbuf **mp, int *offp, int proto)
+dest6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        int off = *offp, dstoptlen, optlen;
Index: netinet6/frag6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/frag6.c,v
retrieving revision 1.72
diff -u -p -r1.72 frag6.c
--- netinet6/frag6.c    5 Feb 2017 16:04:14 -0000       1.72
+++ netinet6/frag6.c    12 Apr 2017 21:57:36 -0000
@@ -154,7 +154,7 @@ frag6_init(void)
  * Fragment input
  */
 int
-frag6_input(struct mbuf **mp, int *offp, int proto)
+frag6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp, *t;
        struct ip6_hdr *ip6;
Index: netinet6/icmp6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/icmp6.c,v
retrieving revision 1.204
diff -u -p -r1.204 icmp6.c
--- netinet6/icmp6.c    5 Apr 2017 13:35:18 -0000       1.204
+++ netinet6/icmp6.c    12 Apr 2017 21:58:03 -0000
@@ -378,7 +378,7 @@ icmp6_error(struct mbuf *m, int type, in
  * Process a received ICMP6 message.
  */
 int
-icmp6_input(struct mbuf **mp, int *offp, int proto)
+icmp6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
 #if NCARP > 0
        struct ifnet *ifp;
Index: netinet6/ip6_divert.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_divert.h,v
retrieving revision 1.7
diff -u -p -r1.7 ip6_divert.h
--- netinet6/ip6_divert.h       13 Mar 2017 20:18:21 -0000      1.7
+++ netinet6/ip6_divert.h       12 Apr 2017 22:33:59 -0000
@@ -73,7 +73,6 @@ div6stat_inc(enum div6stat_counters c)
 extern struct  inpcbtable      divb6table;
 
 void    divert6_init(void);
-int     divert6_input(struct mbuf **, int *, int);
 int     divert6_packet(struct mbuf *, int, u_int16_t);
 int     divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     divert6_usrreq(struct socket *,
Index: netinet6/ip6_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.182
diff -u -p -r1.182 ip6_input.c
--- netinet6/ip6_input.c        6 Apr 2017 02:11:08 -0000       1.182
+++ netinet6/ip6_input.c        12 Apr 2017 21:33:26 -0000
@@ -532,7 +532,8 @@ ip6_local(struct mbuf *m, int off, int n
                                goto bad;
                }
 
-               nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt);
+               nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt,
+                   AF_INET6);
        }
        return;
  bad:
Index: netinet6/ip6_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_var.h,v
retrieving revision 1.71
diff -u -p -r1.71 ip6_var.h
--- netinet6/ip6_var.h  13 Mar 2017 20:18:21 -0000      1.71
+++ netinet6/ip6_var.h  12 Apr 2017 21:59:21 -0000
@@ -333,16 +333,16 @@ void      ip6_randomid_init(void);
 u_int32_t ip6_randomid(void);
 void   ip6_send(struct mbuf *);
 
-int    route6_input(struct mbuf **, int *, int);
+int    route6_input(struct mbuf **, int *, int, int);
 
 void   frag6_init(void);
-int    frag6_input(struct mbuf **, int *, int);
+int    frag6_input(struct mbuf **, int *, int, int);
 int    frag6_deletefraghdr(struct mbuf *, int);
 void   frag6_slowtimo(void);
 void   frag6_drain(void);
 
 void   rip6_init(void);
-int    rip6_input(struct mbuf **mp, int *offp, int proto);
+int    rip6_input(struct mbuf **, int *, int, int);
 void   rip6_ctlinput(int, struct sockaddr *, u_int, void *);
 int    rip6_ctloutput(int, struct socket *, int, int, struct mbuf *);
 int    rip6_output(struct mbuf *, struct socket *, struct sockaddr *,
@@ -352,7 +352,7 @@ int rip6_usrreq(struct socket *,
 int    rip6_attach(struct socket *, int);
 int    rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
-int    dest6_input(struct mbuf **, int *, int);
+int    dest6_input(struct mbuf **, int *, int, int);
 int    none_input(struct mbuf **, int *, int);
 
 int    in6_pcbselsrc(struct in6_addr **, struct sockaddr_in6 *,
Index: netinet6/raw_ip6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.108
diff -u -p -r1.108 raw_ip6.c
--- netinet6/raw_ip6.c  13 Mar 2017 20:18:21 -0000      1.108
+++ netinet6/raw_ip6.c  12 Apr 2017 21:47:21 -0000
@@ -116,7 +116,7 @@ rip6_init(void)
 }
 
 int
-rip6_input(struct mbuf **mp, int *offp, int proto)
+rip6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct mbuf *m = *mp;
        struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
Index: netinet6/route6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/route6.c,v
retrieving revision 1.20
diff -u -p -r1.20 route6.c
--- netinet6/route6.c   5 Feb 2017 16:04:14 -0000       1.20
+++ netinet6/route6.c   12 Apr 2017 21:59:43 -0000
@@ -50,7 +50,7 @@
  */
 
 int
-route6_input(struct mbuf **mp, int *offp, int proto)
+route6_input(struct mbuf **mp, int *offp, int proto, int af)
 {
        struct ip6_hdr *ip6;
        struct mbuf *m = *mp;
Index: sys/protosw.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/protosw.h,v
retrieving revision 1.24
diff -u -p -r1.24 protosw.h
--- sys/protosw.h       13 Mar 2017 20:18:21 -0000      1.24
+++ sys/protosw.h       12 Apr 2017 21:35:15 -0000
@@ -69,7 +69,7 @@ struct protosw {
 
 /* protocol-protocol hooks */
                                        /* input to protocol (from below) */
-       int     (*pr_input)(struct mbuf **, int *, int);
+       int     (*pr_input)(struct mbuf **, int *, int, int);
                                        /* output to protocol (from above) */
        int     (*pr_output)(struct mbuf *, struct socket *, struct sockaddr *,
                    struct mbuf *);

Reply via email to