diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-03 15:48:03 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-03 15:48:03 +0000 |
commit | d089783796e16ef9fec09f9ecb411d35fbce74b2 (patch) | |
tree | 475918c5ee17f5b8d9a7ab822355e050a60b7f76 | |
parent | dcfcb1baf5db36826bef379ef349e1fd43de7d0e (diff) |
Convert the variable argument list of the pr_output functions to
fixed parameters.
OK mpi@ claudio@ dhill@
-rw-r--r-- | sys/net/pfkey.c | 19 | ||||
-rw-r--r-- | sys/net/raw_usrreq.c | 4 | ||||
-rw-r--r-- | sys/net/route.h | 5 | ||||
-rw-r--r-- | sys/net/rtsock.c | 11 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 5 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 27 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 5 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 23 | ||||
-rw-r--r-- | sys/sys/protosw.h | 5 |
9 files changed, 46 insertions, 58 deletions
diff --git a/sys/net/pfkey.c b/sys/net/pfkey.c index 33aa0b5baa8..3dfcfad0412 100644 --- a/sys/net/pfkey.c +++ b/sys/net/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.38 2017/03/02 08:58:24 mpi Exp $ */ +/* $OpenBSD: pfkey.c,v 1.39 2017/03/03 15:48:02 bluhm Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -90,10 +90,10 @@ static struct pfkey_version *pfkey_versions[PFKEY_PROTOCOL_MAX+1] = struct sockaddr pfkey_addr = { 2, PF_KEY, }; -/* static struct domain pfkeydomain; */ -static int pfkey_usrreq(struct socket *socket, int req, struct mbuf *mbuf, - struct mbuf *nam, struct mbuf *control, struct proc *); -static int pfkey_output(struct mbuf *mbuf, struct socket *socket); +int pfkey_usrreq(struct socket *, int , struct mbuf *, struct mbuf *, + struct mbuf *, struct proc *); +int pfkey_output(struct mbuf *, struct socket *, struct sockaddr *, + struct mbuf *); void pfkey_init(void); int pfkey_buildprotosw(void); @@ -154,8 +154,9 @@ pfkey_sendup(struct socket *socket, struct mbuf *packet, int more) return (0); } -static int -pfkey_output(struct mbuf *mbuf, struct socket *socket) +int +pfkey_output(struct mbuf *mbuf, struct socket *socket, struct sockaddr *dstaddr, + struct mbuf *control) { void *message; int error = 0; @@ -230,7 +231,7 @@ pfkey_detach(struct socket *socket, struct proc *p) return (rval); } -static int +int pfkey_usrreq(struct socket *socket, int req, struct mbuf *mbuf, struct mbuf *nam, struct mbuf *control, struct proc *p) { @@ -266,7 +267,7 @@ static struct protosw pfkey_protosw_template = { .pr_domain = &pfkeydomain, .pr_protocol = -1, .pr_flags = PR_ATOMIC | PR_ADDR, - .pr_output = (void *) pfkey_output, + .pr_output = pfkey_output, .pr_usrreq = pfkey_usrreq }; diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index 5e30b5780a5..1d777cec7e0 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_usrreq.c,v 1.28 2017/01/23 16:31:24 bluhm Exp $ */ +/* $OpenBSD: raw_usrreq.c,v 1.29 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */ /* @@ -139,7 +139,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, error = ENOTCONN; break; } - error = (*so->so_proto->pr_output)(m, so); + error = (*so->so_proto->pr_output)(m, so, NULL, NULL); m = NULL; if (nam) rp->rcb_faddr = 0; diff --git a/sys/net/route.h b/sys/net/route.h index a67f3af27a5..1a0d20a691a 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.157 2017/03/02 17:09:21 krw Exp $ */ +/* $OpenBSD: route.h,v 1.158 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -417,7 +417,8 @@ struct sockaddr_in6; struct bfd_config; void route_init(void); -int route_output(struct mbuf *, ...); +int route_output(struct mbuf *, struct socket *, struct sockaddr *, + struct mbuf *); int route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); void rt_ifmsg(struct ifnet *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 7dbeaab499c..ac55bb5e605 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.227 2017/03/03 14:22:40 bluhm Exp $ */ +/* $OpenBSD: rtsock.c,v 1.228 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -528,7 +528,8 @@ rt_report(struct rtentry *rt, u_char type, int seq, int tableid) } int -route_output(struct mbuf *m, ...) +route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, + struct mbuf *control) { struct rt_msghdr *rtm = NULL; struct rtentry *rt = NULL; @@ -536,20 +537,14 @@ route_output(struct mbuf *m, ...) int plen, len, seq, newgate = 0, error = 0; struct ifnet *ifp = NULL; struct ifaddr *ifa = NULL; - struct socket *so; struct rawcb *rp = NULL; #ifdef MPLS struct sockaddr_mpls *psa_mpls; #endif - va_list ap; u_int tableid; u_int8_t prio; u_char vers, type; - va_start(ap, m); - so = va_arg(ap, struct socket *); - va_end(ap); - if (m == NULL || ((m->m_len < sizeof(int32_t)) && (m = m_pullup(m, sizeof(int32_t))) == 0)) return (ENOBUFS); diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 285d64d9402..2f3d791c52a 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.68 2017/02/01 20:59:47 dhill Exp $ */ +/* $OpenBSD: ip_var.h,v 1.69 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -253,7 +253,8 @@ 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_output(struct mbuf *, ...); +int rip_output(struct mbuf *, struct socket *, struct sockaddr *, + struct mbuf *); int rip_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index b3d0d7acd9e..7c8dc5625aa 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.95 2017/02/01 20:59:47 dhill Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.96 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -207,19 +207,12 @@ rip_input(struct mbuf **mp, int *offp, int proto) * Tack on options user may have setup with control call. */ int -rip_output(struct mbuf *m, ...) +rip_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, + struct mbuf *control) { - struct socket *so; - u_long dst; struct ip *ip; struct inpcb *inp; int flags, error; - va_list ap; - - va_start(ap, m); - so = va_arg(ap, struct socket *); - dst = va_arg(ap, u_long); - va_end(ap); inp = sotoinpcb(so); flags = IP_ALLOWBROADCAST; @@ -242,7 +235,7 @@ rip_output(struct mbuf *m, ...) ip->ip_p = inp->inp_ip.ip_p; ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; - ip->ip_dst.s_addr = dst; + ip->ip_dst = satosin(dstaddr)->sin_addr; ip->ip_ttl = inp->inp_ip.ip_ttl ? inp->inp_ip.ip_ttl : MAXTTL; } else { if (m->m_pkthdr.len > IP_MAXPACKET) { @@ -512,25 +505,29 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, */ case PRU_SEND: { - u_int32_t dst; + struct sockaddr_in dst; + memset(&dst, 0, sizeof(dst)); + dst.sin_family = AF_INET; + dst.sin_len = sizeof(dst); if (so->so_state & SS_ISCONNECTED) { if (nam) { error = EISCONN; break; } - dst = inp->inp_faddr.s_addr; + dst.sin_addr = inp->inp_faddr; } else { if (nam == NULL) { error = ENOTCONN; break; } - dst = mtod(nam, struct sockaddr_in *)->sin_addr.s_addr; + dst.sin_addr = + mtod(nam, struct sockaddr_in *)->sin_addr; } #ifdef IPSEC /* XXX Find an IPsec TDB */ #endif - error = rip_output(m, so, dst); + error = rip_output(m, so, sintosa(&dst), NULL); m = NULL; break; } diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 19a6d832004..70c57d70536 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.69 2017/02/28 09:59:34 mpi Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.70 2017/03/03 15:48:02 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -345,7 +345,8 @@ void rip6_init(void); int rip6_input(struct mbuf **mp, int *offp, int proto); void rip6_ctlinput(int, struct sockaddr *, u_int, void *); int rip6_ctloutput(int, struct socket *, int, int, struct mbuf *); -int rip6_output(struct mbuf *, ...); +int rip6_output(struct mbuf *, struct socket *, struct sockaddr *, + struct mbuf *); int rip6_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); int rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 23c46ecb628..c53e88912c9 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.106 2017/02/09 15:23:35 jca Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.107 2017/03/03 15:48:02 bluhm Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -317,11 +317,9 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) * Tack on options user may have setup with control call. */ int -rip6_output(struct mbuf *m, ...) +rip6_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, + struct mbuf *control) { - struct socket *so; - struct sockaddr_in6 *dstsock; - struct mbuf *control; struct in6_addr *dst; struct ip6_hdr *ip6; struct inpcb *in6p; @@ -330,21 +328,14 @@ rip6_output(struct mbuf *m, ...) struct ip6_pktopts opt, *optp = NULL, *origoptp; int type; /* for ICMPv6 output statistics only */ int priv = 0; - va_list ap; int flags; - va_start(ap, m); - so = va_arg(ap, struct socket *); - dstsock = va_arg(ap, struct sockaddr_in6 *); - control = va_arg(ap, struct mbuf *); - va_end(ap); - in6p = sotoinpcb(so); priv = 0; if ((so->so_state & SS_PRIV) != 0) priv = 1; - dst = &dstsock->sin6_addr; + dst = &satosin6(dstaddr)->sin6_addr; if (control) { if ((error = ip6_setpktopts(control, &opt, in6p->inp_outputopts6, @@ -384,7 +375,7 @@ rip6_output(struct mbuf *m, ...) /* KAME hack: embed scopeid */ origoptp = in6p->inp_outputopts6; in6p->inp_outputopts6 = optp; - if (in6_embedscope(&ip6->ip6_dst, dstsock, in6p) != 0) { + if (in6_embedscope(&ip6->ip6_dst, satosin6(dstaddr), in6p) != 0) { error = EINVAL; goto bad; } @@ -396,7 +387,7 @@ rip6_output(struct mbuf *m, ...) { struct in6_addr *in6a; - error = in6_pcbselsrc(&in6a, dstsock, in6p, optp); + error = in6_pcbselsrc(&in6a, satosin6(dstaddr), in6p, optp); if (error) goto bad; @@ -732,7 +723,7 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, break; } } - error = rip6_output(m, so, dst, control); + error = rip6_output(m, so, sin6tosa(dst), control); m = NULL; break; } diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 1b300953e1e..bf4dca17aae 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.22 2017/02/01 20:59:47 dhill Exp $ */ +/* $OpenBSD: protosw.h,v 1.23 2017/03/03 15:48:02 bluhm Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -71,7 +71,8 @@ struct protosw { /* input to protocol (from below) */ int (*pr_input)(struct mbuf **, int *, int); /* output to protocol (from above) */ - int (*pr_output)(struct mbuf *, ...); + int (*pr_output)(struct mbuf *, struct socket *, struct sockaddr *, + struct mbuf *); /* control input (from below) */ void (*pr_ctlinput)(int, struct sockaddr *, u_int, void *); /* control output (from above) */ |