From: bluhm Date: Fri, 14 Apr 2017 20:46:31 +0000 (+0000) Subject: Pass down the address family through the pr_input calls. This X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=459fa0feb1e08ab4109b4bff330f1f74c94429d3;p=openbsd Pass down the address family through the pr_input calls. This allows to simplify code used for both IPv4 and IPv6. OK mikeb@ deraadt@ --- diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c index 1173234c09a..7abc0af80b8 100644 --- a/sys/net/if_etherip.c +++ b/sys/net/if_etherip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_etherip.c,v 1.16 2017/03/27 23:49:03 jca Exp $ */ +/* $OpenBSD: if_etherip.c,v 1.17 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2015 Kazuya GODA * @@ -405,7 +405,7 @@ ip_etherip_output(struct ifnet *ifp, struct mbuf *m) } 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 *offp, int proto) * 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 *offp, int proto) * 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); diff --git a/sys/net/if_etherip.h b/sys/net/if_etherip.h index 666f26fdbef..f4c205632ed 100644 --- a/sys/net/if_etherip.h +++ b/sys/net/if_etherip.h @@ -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 */ diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index db617bda88b..b89b5317f87 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.91 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: if_gif.c,v 1.92 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -716,7 +716,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf **m0) } 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, int proto) 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 family, struct mbuf **m0) 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 *offp, int proto) inject: /* No GIF tunnel configured */ - return ip4_input(mp, offp, proto); + return ip4_input(mp, offp, proto, af); } #endif /* INET6 */ diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h index f7d4a09ad8d..96cd3abb428 100644 --- a/sys/net/if_gif.h +++ b/sys/net/if_gif.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.h,v 1.16 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: if_gif.h,v 1.17 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $ */ /* @@ -49,7 +49,7 @@ extern LIST_HEAD(gif_softc_head, gif_softc) gif_softc_list; 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_ */ diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 437dff36bde..9a1f3c44589 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.249 2017/04/11 14:43:49 dhill Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.250 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -649,7 +649,7 @@ pfsync_state_import(struct pfsync_state *sp, int flags) } 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; diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index b5eb6e056d4..ef24c220306 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.h,v 1.52 2017/02/20 06:30:39 jca Exp $ */ +/* $OpenBSD: if_pfsync.h,v 1.53 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -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); diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 5c58798db01..bfa5a196c70 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.43 2017/02/09 15:23:35 jca Exp $ */ +/* $OpenBSD: icmp6.h,v 1.44 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -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 *); diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 5576f74252e..50950876dda 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.65 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: igmp.c,v 1.66 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -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, int proto) 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 mbuf **mp, int *offp, int proto) * 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 diff --git a/sys/netinet/igmp_var.h b/sys/netinet/igmp_var.h index 4aeaebc5f9e..15c85d10d6a 100644 --- a/sys/netinet/igmp_var.h +++ b/sys/netinet/igmp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp_var.h,v 1.12 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: igmp_var.h,v 1.13 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */ /* @@ -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); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index ee7846d2013..c5d53105268 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.307 2017/04/11 14:43:49 dhill Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.308 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -415,7 +415,7 @@ carp_hmac_verify(struct carp_vhost_entry *vhe, u_int32_t counter[2], } 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, struct mbuf **mp, int *offp, int proto) #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; diff --git a/sys/netinet/ip_carp.h b/sys/netinet/ip_carp.h index 1ed28cfd340..026990db18b 100644 --- a/sys/netinet/ip_carp.h +++ b/sys/netinet/ip_carp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.h,v 1.41 2017/02/20 06:29:42 jca Exp $ */ +/* $OpenBSD: ip_carp.h,v 1.42 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -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 *); diff --git a/sys/netinet/ip_divert.h b/sys/netinet/ip_divert.h index 6ba83e6a553..31cdc0c09f8 100644 --- a/sys/netinet/ip_divert.h +++ b/sys/netinet/ip_divert.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.h,v 1.9 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: ip_divert.h,v 1.10 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2009 Michele Marchetto @@ -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 *, diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index e64e4a89bc3..2fe409e08e7 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.84 2017/03/07 23:35:06 jca Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.85 2017/04/14 20:46:31 bluhm Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -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 diff --git a/sys/netinet/ip_ether.h b/sys/netinet/ip_ether.h index fcffa66de56..88f6875eaa1 100644 --- a/sys/netinet/ip_ether.h +++ b/sys/netinet/ip_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.h,v 1.21 2017/03/07 23:35:06 jca Exp $ */ +/* $OpenBSD: ip_ether.h,v 1.22 2017/04/14 20:46:31 bluhm Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@adk.gr) * @@ -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; diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 9fed51128f6..9b7ce509b50 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.62 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.63 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -216,7 +216,7 @@ gre_input2(struct mbuf *m, int hlen, int proto) * 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, int proto) * 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, int proto) */ 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; diff --git a/sys/netinet/ip_gre.h b/sys/netinet/ip_gre.h index 338764dfb84..b072532d998 100644 --- a/sys/netinet/ip_gre.h +++ b/sys/netinet/ip_gre.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.h,v 1.11 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip_gre.h,v 1.12 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_gre.h,v 1.3 1998/10/07 23:33:02 thorpej Exp $ */ /* @@ -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 *); diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 6ec9772ce43..9d2d85fec6e 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.164 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.165 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -128,7 +128,7 @@ int *icmpctl_vars[ICMPCTL_MAXID] = ICMPCTL_VARS; 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 code, u_int32_t dest, int destmtu) * 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, int proto) 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); diff --git a/sys/netinet/ip_icmp.h b/sys/netinet/ip_icmp.h index 04b02c33d18..f21dcfcb4a1 100644 --- a/sys/netinet/ip_icmp.h +++ b/sys/netinet/ip_icmp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.h,v 1.29 2017/01/29 19:58:47 bluhm Exp $ */ +/* $OpenBSD: ip_icmp.h,v 1.30 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_icmp.h,v 1.10 1996/02/13 23:42:28 christos Exp $ */ /* @@ -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 *); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 4a43563637d..1f0814e58d5 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.296 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: ip_input.c,v 1.297 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -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); diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 7a47b18773d..45e6e3722d3 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.73 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.74 2017/04/14 20:46:31 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -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) { diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index ecee48dae76..7ea868b7477 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.178 2017/02/07 22:28:37 bluhm Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.179 2017/04/14 20:46:31 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -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, int); 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, int); 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 */ diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index d47b672c961..9a4232f6157 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.70 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: ip_var.h,v 1.71 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -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 *, diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 2104a3c62ac..de3dd99b4c1 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.146 2017/04/06 14:25:18 dhill Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.147 2017/04/14 20:46:31 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -139,11 +139,11 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto, (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, void *oldp, size_t *oldlenp, void *newp, /* 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 *sa, u_int rdomain, void *v) /* 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, int proto) /* 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 *sa, u_int rdomain, void *v) #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, int proto) /* 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, int proto) /* 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; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 90236833f70..f19ed9fdc2c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.97 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.98 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -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 *); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index f22e730395e..880c1402677 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.338 2017/02/09 15:19:32 jca Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.339 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -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, int proto) struct tdb *tdb; int error; #endif /* IPSEC */ - int af; #ifdef TCP_ECN u_char iptos; #endif diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 36f18f647ce..de3390b61f1 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.123 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.124 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -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 *); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index be8f3ca6ef9..363c479cb04 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.233 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.234 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -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; diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 63bbdac98b0..7a511e7b05b 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_var.h,v 1.32 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: udp_var.h,v 1.33 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */ /* @@ -141,7 +141,7 @@ void udp6_ctlinput(int, struct sockaddr *, u_int, void *); #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 *); diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c index 05f0cc5edc7..392f1e1b106 100644 --- a/sys/netinet6/dest6.c +++ b/sys/netinet6/dest6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dest6.c,v 1.16 2017/02/05 16:04:14 jca Exp $ */ +/* $OpenBSD: dest6.c,v 1.17 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: dest6.c,v 1.25 2001/02/22 01:39:16 itojun Exp $ */ /* @@ -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; diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 395051928f8..baaec54bab1 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.72 2017/02/05 16:04:14 jca Exp $ */ +/* $OpenBSD: frag6.c,v 1.73 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -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; diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 215d953bf21..ae8bc54f9f6 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.204 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: icmp6.c,v 1.205 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -378,7 +378,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) * 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; diff --git a/sys/netinet6/ip6_divert.h b/sys/netinet6/ip6_divert.h index a6009214fc7..bbda15b4061 100644 --- a/sys/netinet6/ip6_divert.h +++ b/sys/netinet6/ip6_divert.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.h,v 1.7 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: ip6_divert.h,v 1.8 2017/04/14 20:46:31 bluhm Exp $ */ /* * Copyright (c) 2009 Michele Marchetto @@ -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 *, diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 20173d29804..88bef4f7e6f 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.182 2017/04/06 02:11:08 dhill Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.183 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -532,7 +532,8 @@ ip6_local(struct mbuf *m, int off, int nxt) 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: diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 2275e76f607..32cc51978a4 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.71 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.72 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -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 *, diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index e473484dae5..5f83fb937a3 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.108 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.109 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -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 *); diff --git a/sys/netinet6/route6.c b/sys/netinet6/route6.c index 357fe45a78d..914059abc69 100644 --- a/sys/netinet6/route6.c +++ b/sys/netinet6/route6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route6.c,v 1.20 2017/02/05 16:04:14 jca Exp $ */ +/* $OpenBSD: route6.c,v 1.21 2017/04/14 20:46:31 bluhm Exp $ */ /* $KAME: route6.c,v 1.22 2000/12/03 00:54:00 itojun Exp $ */ /* @@ -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; diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 2b9b66d9899..ccb2e004c22 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.24 2017/03/13 20:18:21 claudio Exp $ */ +/* $OpenBSD: protosw.h,v 1.25 2017/04/14 20:46:31 bluhm Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -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 *);