summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2014-04-23 14:43:15 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2014-04-23 14:43:15 +0000
commit79f7e152440ec1f3d0c8f10767736ffe38009d86 (patch)
tree823512d22cdc4650507fc4a90a6d88114fd269d9
parent164ea08aaffe2c26ed2a04fec6662cc3cf593c34 (diff)
No need for vargs here.
While there move declaration of divert{,6}_output() to .c as it's a private function. Also switch first two args to make it more like similar functions (both suggested by mpi@). Input/OK mpi@, OK lteo@
-rw-r--r--sys/netinet/ip_divert.c21
-rw-r--r--sys/netinet/ip_divert.h3
-rw-r--r--sys/netinet6/ip6_divert.c20
-rw-r--r--sys/netinet6/ip6_divert.h3
4 files changed, 16 insertions, 31 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 31ac40e20d7..0acd87f7b65 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.21 2014/04/21 12:22:26 henning Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.22 2014/04/23 14:43:14 florian Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -62,8 +62,9 @@ int divbhashsize = DIVERTHASHSIZE;
static struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET };
-void divert_detach(struct inpcb *);
-
+void divert_detach(struct inpcb *);
+int divert_output(struct inpcb *, struct mbuf *, struct mbuf *,
+ struct mbuf *);
void
divert_init()
{
@@ -77,27 +78,19 @@ divert_input(struct mbuf *m, ...)
}
int
-divert_output(struct mbuf *m, ...)
+divert_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
+ struct mbuf *control)
{
- struct inpcb *inp;
struct ifqueue *inq;
- struct mbuf *nam, *control;
struct sockaddr_in *sin;
struct socket *so;
struct ifaddr *ifa;
int s, error = 0, p_hdrlen = 0;
- va_list ap;
struct ip *ip;
u_int16_t off, csum = 0;
u_int8_t nxt;
size_t p_off = 0;
- va_start(ap, m);
- inp = va_arg(ap, struct inpcb *);
- nam = va_arg(ap, struct mbuf *);
- control = va_arg(ap, struct mbuf *);
- va_end(ap);
-
m->m_pkthdr.rcvif = NULL;
m->m_nextpkt = NULL;
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
@@ -325,7 +318,7 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
break;
case PRU_SEND:
- return (divert_output(m, inp, addr, control));
+ return (divert_output(inp, m, addr, control));
case PRU_ABORT:
soisdisconnected(so);
diff --git a/sys/netinet/ip_divert.h b/sys/netinet/ip_divert.h
index e2b35a3edb3..488c12814ef 100644
--- a/sys/netinet/ip_divert.h
+++ b/sys/netinet/ip_divert.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.h,v 1.4 2012/10/21 13:06:03 benno Exp $ */
+/* $OpenBSD: ip_divert.h,v 1.5 2014/04/23 14:43:14 florian Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -56,7 +56,6 @@ extern struct divstat divstat;
void divert_init(void);
void divert_input(struct mbuf *, ...);
int divert_packet(struct mbuf *, int);
-int divert_output(struct mbuf *, ...);
int divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int divert_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index f66f64acf7a..08b42fe5565 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.21 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.22 2014/04/23 14:43:14 florian Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -63,7 +63,9 @@ int divb6hashsize = DIVERTHASHSIZE;
static struct sockaddr_in6 ip6addr = { sizeof(ip6addr), AF_INET6 };
-void divert6_detach(struct inpcb *);
+void divert6_detach(struct inpcb *);
+int divert6_output(struct inpcb *, struct mbuf *, struct mbuf *,
+ struct mbuf *);
void
divert6_init()
@@ -80,26 +82,18 @@ divert6_input(struct mbuf **mp, int *offp, int proto)
}
int
-divert6_output(struct mbuf *m, ...)
+divert6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
+ struct mbuf *control)
{
- struct inpcb *inp;
struct ifqueue *inq;
- struct mbuf *nam, *control;
struct sockaddr_in6 *sin6;
struct socket *so;
struct ifaddr *ifa;
int s, error = 0, p_hdrlen = 0, nxt = 0, off;
- va_list ap;
struct ip6_hdr *ip6;
u_int16_t csum = 0;
size_t p_off = 0;
- va_start(ap, m);
- inp = va_arg(ap, struct inpcb *);
- nam = va_arg(ap, struct mbuf *);
- control = va_arg(ap, struct mbuf *);
- va_end(ap);
-
m->m_pkthdr.rcvif = NULL;
m->m_nextpkt = NULL;
m->m_pkthdr.ph_rtableid = inp->inp_rtableid;
@@ -321,7 +315,7 @@ divert6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
break;
case PRU_SEND:
- return (divert6_output(m, inp, addr, control));
+ return (divert6_output(inp, m, addr, control));
case PRU_ABORT:
soisdisconnected(so);
diff --git a/sys/netinet6/ip6_divert.h b/sys/netinet6/ip6_divert.h
index 5375dbc81d7..2b5159de885 100644
--- a/sys/netinet6/ip6_divert.h
+++ b/sys/netinet6/ip6_divert.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.h,v 1.3 2013/10/25 02:53:31 deraadt Exp $ */
+/* $OpenBSD: ip6_divert.h,v 1.4 2014/04/23 14:43:14 florian Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -56,7 +56,6 @@ extern struct div6stat div6stat;
void divert6_init(void);
int divert6_input(struct mbuf **, int *, int);
int divert6_packet(struct mbuf *, int);
-int divert6_output(struct mbuf *, ...);
int divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int divert6_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);