summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2014-04-21 12:22:25 +0000
committerhenning <henning@openbsd.org>2014-04-21 12:22:25 +0000
commit4dc494bb7fe7c9c28288c6cd20bb7ae39ee56120 (patch)
tree03fb1649b2abe2937552467f54d214f9d8733ad4 /sys/netinet
parentFix off-by-one error in PG_LGFRAME mask (diff)
downloadwireguard-openbsd-4dc494bb7fe7c9c28288c6cd20bb7ae39ee56120.tar.xz
wireguard-openbsd-4dc494bb7fe7c9c28288c6cd20bb7ae39ee56120.zip
ip_output() using varargs always struck me as bizarre, esp since it's only
ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/igmp.c4
-rw-r--r--sys/netinet/ip_carp.c4
-rw-r--r--sys/netinet/ip_divert.c4
-rw-r--r--sys/netinet/ip_icmp.c4
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet/ip_mroute.c7
-rw-r--r--sys/netinet/ip_output.c11
-rw-r--r--sys/netinet/ip_var.h7
-rw-r--r--sys/netinet/ipsec_output.c4
-rw-r--r--sys/netinet/raw_ip.c4
-rw-r--r--sys/netinet/tcp_input.c4
-rw-r--r--sys/netinet/tcp_output.c4
-rw-r--r--sys/netinet/tcp_subr.c4
-rw-r--r--sys/netinet/udp_usrreq.c6
14 files changed, 32 insertions, 39 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 0dc9d63bce0..5c53f557b03 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.38 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: igmp.c,v 1.39 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -634,7 +634,7 @@ igmp_sendpkt(struct in_multi *inm, int type, in_addr_t addr)
imo.imo_multicast_loop = 0;
#endif /* MROUTING */
- ip_output(m, NULL, NULL, IP_MULTICASTOPTS, &imo, NULL);
+ ip_output(m, NULL, NULL, IP_MULTICASTOPTS, &imo, NULL, 0);
++igmpstat.igps_snd_reports;
}
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 9228d89e48e..8b780aae4e4 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.227 2014/04/20 14:54:39 henning Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.228 2014/04/21 12:22:26 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -1175,7 +1175,7 @@ carp_send_ad(void *v)
carpstats.carps_opackets++;
error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo,
- NULL);
+ NULL, 0);
if (error) {
if (error == ENOBUFS)
carpstats.carps_onomem++;
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 4a1ab47f26b..31ac40e20d7 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.20 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.21 2014/04/21 12:22:26 henning Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -181,7 +181,7 @@ divert_output(struct mbuf *m, ...)
splx(s);
} else {
error = ip_output(m, NULL, &inp->inp_route,
- IP_ALLOWBROADCAST | IP_RAWOUTPUT, NULL, NULL);
+ IP_ALLOWBROADCAST | IP_RAWOUTPUT, NULL, NULL, 0);
if (error == EACCES) /* translate pf(4) error for userland */
error = EHOSTUNREACH;
}
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 478bcdd4bcc..e00a46a5c81 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.120 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.121 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -844,7 +844,7 @@ icmp_send(struct mbuf *m, struct mbuf *opts)
printf("icmp_send dst %s src %s\n", dst, src);
}
#endif
- ip_output(m, opts, NULL, 0, NULL, NULL);
+ ip_output(m, opts, NULL, 0, NULL, NULL, 0);
}
n_time
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index b22fd7dcab6..3570648998b 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.230 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: ip_input.c,v 1.231 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1474,7 +1474,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt)
error = ip_output(m, NULL, &ipforward_rt,
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)),
- NULL, NULL);
+ NULL, NULL, 0);
if (error)
ipstat.ips_cantforward++;
else {
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 2e4a30a3d15..d7afaf85743 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.65 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.66 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -1732,7 +1732,8 @@ send_packet(struct vif *vifp, struct mbuf *m)
if (vifp->v_flags & VIFF_TUNNEL) {
/* If tunnel options */
- ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, NULL, NULL);
+ ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, NULL, NULL,
+ 0);
} else {
/*
* if physical interface option, extract the options
@@ -1745,7 +1746,7 @@ send_packet(struct vif *vifp, struct mbuf *m)
imo.imo_multicast_loop = 1;
error = ip_output(m, NULL, NULL,
- IP_FORWARDING | IP_MULTICASTOPTS, &imo, NULL);
+ IP_FORWARDING | IP_MULTICASTOPTS, &imo, NULL, 0);
if (mrtdebug & DEBUG_XMIT)
log(LOG_DEBUG, "phyint_send on vif %ld err %d\n",
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 1b63a287d63..a5429eacfa8 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.262 2014/04/20 09:38:19 henning Exp $ */
+/* $OpenBSD: ip_output.c,v 1.263 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -86,7 +86,7 @@ void in_delayed_cksum(struct mbuf *);
*/
int
ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags,
- struct ip_moptions *imo, struct inpcb *inp, ...)
+ struct ip_moptions *imo, struct inpcb *inp, u_int32_t ipsecflowinfo)
{
struct ip *ip;
struct ifnet *ifp;
@@ -106,7 +106,6 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags,
struct tdb_ident *tdbi;
struct tdb *tdb;
- u_int32_t ipsecflowinfo = 0;
#if NPF > 0
struct ifnet *encif;
#endif
@@ -115,12 +114,6 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags,
#ifdef IPSEC
if (inp && (inp->inp_flags & INP_IPV6) != 0)
panic("ip_output: IPv6 pcb is passed");
- if (flags & IP_IPSECFLOW) {
- va_list ap;
- va_start(ap, inp);
- ipsecflowinfo = va_arg(ap, u_int32_t);
- va_end(ap);
- }
#endif /* IPSEC */
#ifdef DIAGNOSTIC
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 518eaa9adea..5ffb08a563d 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_var.h,v 1.55 2014/04/07 10:04:17 mpi Exp $ */
+/* $OpenBSD: ip_var.h,v 1.56 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
@@ -137,13 +137,12 @@ struct ipq {
struct in_addr ipq_src, ipq_dst;
};
-/* flags passed to ip_output as last parameter */
+/* flags passed to ip_output */
#define IP_FORWARDING 0x1 /* most of ip header exists */
#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
#define IP_MTUDISC 0x0800 /* pmtu discovery, set DF */
#define IP_ROUTETOETHER 0x1000 /* ether addresses given */
-#define IP_IPSECFLOW 0x2000 /* IPsec flow info */
extern struct ipstat ipstat;
extern LIST_HEAD(ipqhead, ipq) ipq; /* ip reass. queue */
@@ -185,7 +184,7 @@ void ip_init(void);
int ip_mforward(struct mbuf *, struct ifnet *);
int ip_optcopy(struct ip *, struct ip *);
int ip_output(struct mbuf *, struct mbuf *, struct route *, int,
- struct ip_moptions *, struct inpcb *, ...);
+ struct ip_moptions *, struct inpcb *, u_int32_t);
int ip_pcbopts(struct mbuf **, struct mbuf *);
struct mbuf *
ip_reass(struct ipqent *, struct ipq *);
diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c
index 5467e4dfe56..ca1c1bfa2c6 100644
--- a/sys/netinet/ipsec_output.c
+++ b/sys/netinet/ipsec_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_output.c,v 1.51 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: ipsec_output.c,v 1.52 2014/04/21 12:22:26 henning Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -511,7 +511,7 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb)
switch (tdb->tdb_dst.sa.sa_family) {
#ifdef INET
case AF_INET:
- return (ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL));
+ return (ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL, 0));
#endif /* INET */
#ifdef INET6
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 6e2de4c3ef6..a939901d550 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.71 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.72 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -278,7 +278,7 @@ rip_output(struct mbuf *m, ...)
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
error = ip_output(m, inp->inp_options, &inp->inp_route, flags,
- inp->inp_moptions, inp);
+ inp->inp_moptions, inp, 0);
if (error == EACCES) /* translate pf(4) error for userland */
error = EHOSTUNREACH;
return (error);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 23208bfa025..14fc254a3d6 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.274 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.275 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -4414,7 +4414,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m)
#ifdef INET
case AF_INET:
error = ip_output(m, sc->sc_ipopts, ro,
- (ip_mtudisc ? IP_MTUDISC : 0), NULL, inp);
+ (ip_mtudisc ? IP_MTUDISC : 0), NULL, inp, 0);
break;
#endif
#ifdef INET6
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index d18c22776cb..21eb847ffdb 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.105 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.106 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -1076,7 +1076,7 @@ send:
}
error = ip_output(m, tp->t_inpcb->inp_options,
&tp->t_inpcb->inp_route,
- (ip_mtudisc ? IP_MTUDISC : 0), NULL, tp->t_inpcb);
+ (ip_mtudisc ? IP_MTUDISC : 0), NULL, tp->t_inpcb, 0);
break;
#endif /* INET */
#ifdef INET6
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index aff8b95df8f..e0e4773b69a 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.128 2014/04/21 11:10:54 henning Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.129 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -421,7 +421,7 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0,
ip->ip_ttl = ip_defttl;
ip->ip_tos = 0;
ip_output(m, NULL, ro, ip_mtudisc ? IP_MTUDISC : 0,
- NULL, tp ? tp->t_inpcb : NULL);
+ NULL, tp ? tp->t_inpcb : NULL, 0);
}
}
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 8fc4507e208..82a3bb0ac84 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.182 2014/04/18 10:48:29 jca Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.183 2014/04/21 12:22:26 henning Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -1111,8 +1111,8 @@ udp_output(struct mbuf *m, ...)
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
error = ip_output(m, inp->inp_options, &inp->inp_route,
- (inp->inp_socket->so_options & SO_BROADCAST) | IP_IPSECFLOW,
- inp->inp_moptions, inp, ipsecflowinfo);
+ (inp->inp_socket->so_options & SO_BROADCAST), inp->inp_moptions,
+ inp, ipsecflowinfo);
if (error == EACCES) /* translate pf(4) error for userland */
error = EHOSTUNREACH;