-/* $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>
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()
{
}
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;
break;
case PRU_SEND:
- return (divert_output(m, inp, addr, control));
+ return (divert_output(inp, m, addr, control));
case PRU_ABORT:
soisdisconnected(so);
-/* $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>
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 *);
-/* $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>
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()
}
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;
break;
case PRU_SEND:
- return (divert6_output(m, inp, addr, control));
+ return (divert6_output(inp, m, addr, control));
case PRU_ABORT:
soisdisconnected(so);
-/* $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>
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 *);