From 5b0c7bb97da4f6cd3c8f299c2c04a5f06c80a4cd Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 23 Apr 2014 12:25:35 +0000 Subject: [PATCH] Don't use varargs for udp_output() and sync the argument order with udp6_output(). ok henning@, reyk@, jca@ --- sys/netinet/udp_usrreq.c | 27 ++++++++++----------------- sys/netinet/udp_var.h | 3 +-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 82a3bb0ac84..7cc5d6eb93a 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.183 2014/04/21 12:22:26 henning Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.184 2014/04/23 12:25:35 mpi Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -135,10 +135,11 @@ int *udpctl_vars[UDPCTL_MAXID] = UDPCTL_VARS; struct inpcbtable udbtable; struct udpstat udpstat; -void udp_detach(struct inpcb *); -void udp_notify(struct inpcb *, int); +int udp_output(struct inpcb *, struct mbuf *, struct mbuf *, struct mbuf *); +void udp_detach(struct inpcb *); +void udp_notify(struct inpcb *, int); -#ifndef UDBHASHSIZE +#ifndef UDBHASHSIZE #define UDBHASHSIZE 128 #endif int udbhashsize = UDBHASHSIZE; @@ -964,27 +965,19 @@ udp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) } int -udp_output(struct mbuf *m, ...) +udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr, + struct mbuf *control) { - struct inpcb *inp; - struct mbuf *addr, *control; struct sockaddr_in *sin = NULL; struct udpiphdr *ui; u_int32_t ipsecflowinfo = 0; int len = m->m_pkthdr.len; struct in_addr *laddr; int error = 0; - va_list ap; - - va_start(ap, m); - inp = va_arg(ap, struct inpcb *); - addr = va_arg(ap, struct mbuf *); - control = va_arg(ap, struct mbuf *); - va_end(ap); #ifdef DIAGNOSTIC if ((inp->inp_flags & INP_IPV6) != 0) - panic("IPv6 inpcb to udp_output"); + panic("IPv6 inpcb to %s", __func__); #endif /* @@ -1294,9 +1287,9 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, if (inp->inp_flags & INP_IPV6) return (udp6_output(inp, m, addr, control)); else - return (udp_output(m, inp, addr, control)); + return (udp_output(inp, m, addr, control)); #else - return (udp_output(m, inp, addr, control)); + return (udp_output(inp, m, addr, control)); #endif case PRU_ABORT: diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 0e276107db3..cfbf5152230 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_var.h,v 1.25 2014/01/25 10:13:53 deraadt Exp $ */ +/* $OpenBSD: udp_var.h,v 1.26 2014/04/23 12:25:35 mpi Exp $ */ /* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */ /* @@ -113,7 +113,6 @@ void udp_input(struct mbuf *, ...); int udp6_output(struct inpcb *, struct mbuf *, struct mbuf *, struct mbuf *); #endif /* INET6 */ -int udp_output(struct mbuf *, ...); int udp_sysctl(int *, u_int, void *, size_t *, void *, size_t); int udp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); -- 2.20.1