diff options
author | 2013-12-17 02:41:07 +0000 | |
---|---|---|
committer | 2013-12-17 02:41:07 +0000 | |
commit | 9f7d3e6b7cc31bb6587a49368f870c2be1b28c3d (patch) | |
tree | b1d5ad2e129c1cb5fed3712dfb6da834540c1897 | |
parent | Switch generic drm modesetting code over to Linux-style negative errno (diff) | |
download | wireguard-openbsd-9f7d3e6b7cc31bb6587a49368f870c2be1b28c3d.tar.xz wireguard-openbsd-9f7d3e6b7cc31bb6587a49368f870c2be1b28c3d.zip |
Change ip_output()'s non-optional arguments to be standard arguments
instead of variable arguments.
Allows stricter type checking by the compiler at call sites and also
saves a bit of code size on some platforms (e.g., ~200 bytes on
amd64).
ok mikeb
-rw-r--r-- | sys/netinet/in_proto.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 27 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 6 |
3 files changed, 16 insertions, 21 deletions
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index 00fd4aa1eee..f9bd021eddd 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_proto.c,v 1.59 2013/04/24 10:17:08 mpi Exp $ */ +/* $OpenBSD: in_proto.c,v 1.60 2013/12/17 02:41:07 matthew Exp $ */ /* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */ /* @@ -180,7 +180,7 @@ u_char ip_protox[IPPROTO_MAX]; struct protosw inetsw[] = { { 0, &inetdomain, 0, 0, - 0, ip_output, 0, 0, + 0, 0, 0, 0, 0, ip_init, 0, ip_slowtimo, ip_drain, ip_sysctl }, diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 3297116044f..896e5c6accc 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.252 2013/12/04 16:27:56 mikeb Exp $ */ +/* $OpenBSD: ip_output.c,v 1.253 2013/12/17 02:41:07 matthew Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -82,7 +82,8 @@ void ip_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in *); * The mbuf opt, if present, will not be freed. */ int -ip_output(struct mbuf *m0, ...) +ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, + struct ip_moptions *imo, struct inpcb *inp, ...) { struct ip *ip; struct ifnet *ifp; @@ -92,11 +93,6 @@ ip_output(struct mbuf *m0, ...) struct route iproute; struct sockaddr_in *dst; struct in_ifaddr *ia; - struct mbuf *opt; - struct route *ro; - int flags; - struct ip_moptions *imo; - va_list ap; u_int8_t sproto = 0, donerouting = 0; u_long mtu; #ifdef IPSEC @@ -106,26 +102,23 @@ ip_output(struct mbuf *m0, ...) struct m_tag *mtag; struct tdb_ident *tdbi; - struct inpcb *inp; struct tdb *tdb; - u_int32_t ipsecflowinfo; + u_int32_t ipsecflowinfo = 0; #if NPF > 0 struct ifnet *encif; #endif #endif /* IPSEC */ - va_start(ap, m0); - opt = va_arg(ap, struct mbuf *); - ro = va_arg(ap, struct route *); - flags = va_arg(ap, int); - imo = va_arg(ap, struct ip_moptions *); #ifdef IPSEC - inp = va_arg(ap, struct inpcb *); if (inp && (inp->inp_flags & INP_IPV6) != 0) panic("ip_output: IPv6 pcb is passed"); - ipsecflowinfo = (flags & IP_IPSECFLOW) ? va_arg(ap, u_int32_t) : 0; + if (flags & IP_IPSECFLOW) { + va_list ap; + va_start(ap, inp); + ipsecflowinfo = va_arg(ap, u_int32_t); + va_end(ap); + } #endif /* IPSEC */ - va_end(ap); #ifdef DIAGNOSTIC if ((m->m_flags & M_PKTHDR) == 0) diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index b667012f96c..42f683e897e 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.49 2013/11/17 10:07:32 bluhm Exp $ */ +/* $OpenBSD: ip_var.h,v 1.50 2013/12/17 02:41:07 matthew Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -172,6 +172,7 @@ extern int la_hold_total; extern struct rttimer_queue *ip_mtudisc_timeout_q; extern struct pool ipqent_pool; +struct route; struct inpcb; int ip_ctloutput(int, struct socket *, int, int, struct mbuf **); @@ -186,7 +187,8 @@ int ip_getmoptions(int, struct ip_moptions *, struct mbuf **); void ip_init(void); int ip_mforward(struct mbuf *, struct ifnet *); int ip_optcopy(struct ip *, struct ip *); -int ip_output(struct mbuf *, ...); +int ip_output(struct mbuf *, struct mbuf *, struct route *, int, + struct ip_moptions *, struct inpcb *, ...); int ip_pcbopts(struct mbuf **, struct mbuf *); struct mbuf * ip_reass(struct ipqent *, struct ipq *); |