Change pr_output's prototype to avoid the need for explicit casts.

This is a follow up to r269699.

Phabric:	D564
Reviewed by:	jhb
This commit is contained in:
Kevin Lo 2014-08-15 02:43:02 +00:00
parent 6e8f9f5113
commit 73d76e77b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270008
15 changed files with 30 additions and 23 deletions

View File

@ -128,7 +128,7 @@ static const struct protosw in_gre_protosw = {
.pr_protocol = IPPROTO_GRE,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = gre_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctlinput = rip_ctlinput,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
@ -139,7 +139,7 @@ static const struct protosw in_mobile_protosw = {
.pr_protocol = IPPROTO_MOBILE,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = gre_mobile_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctlinput = rip_ctlinput,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs

View File

@ -171,7 +171,7 @@ struct protosw in_stf_protosw = {
.pr_protocol = IPPROTO_IPV6,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = in_stf_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
};

View File

@ -159,7 +159,7 @@ static int rt_xaddrs(caddr_t cp, caddr_t cplim,
static int sysctl_dumpentry(struct radix_node *rn, void *vw);
static int sysctl_iflist(int af, struct walkarg *w);
static int sysctl_ifmalist(int af, struct walkarg *w);
static int route_output(struct mbuf *m, struct socket *so);
static int route_output(struct mbuf *m, struct socket *so, ...);
static void rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out);
static void rt_dispatch(struct mbuf *, sa_family_t);
static struct sockaddr *rtsock_fix_netmask(struct sockaddr *dst,
@ -516,7 +516,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp,
/*ARGSUSED*/
static int
route_output(struct mbuf *m, struct socket *so)
route_output(struct mbuf *m, struct socket *so, ...)
{
struct rt_msghdr *rtm = NULL;
struct rtentry *rt = NULL;

View File

@ -81,7 +81,7 @@ struct protosw in_gif_protosw = {
.pr_protocol = 0/* IPPROTO_IPV[46] */,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = in_gif_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
};

View File

@ -2054,7 +2054,7 @@ static struct protosw in_carp_protosw = {
.pr_protocol = IPPROTO_CARP,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = carp_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
};
@ -2068,7 +2068,7 @@ static struct protosw in6_carp_protosw = {
.pr_protocol = IPPROTO_CARP,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = carp6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
};

View File

@ -247,7 +247,7 @@ static const struct protosw in_pim_protosw = {
.pr_protocol = IPPROTO_PIM,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = pim_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
};

View File

@ -235,7 +235,7 @@ void rip_init(void);
void rip_destroy(void);
#endif
int rip_input(struct mbuf **, int *, int);
int rip_output(struct mbuf *, struct socket *, u_long);
int rip_output(struct mbuf *, struct socket *, ...);
int ipip_input(struct mbuf **, int *, int);
int rsvp_input(struct mbuf **, int *, int);
int ip_rsvp_init(struct socket *);

View File

@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
#include <netipsec/ipsec.h>
#endif /*IPSEC*/
#include <machine/stdarg.h>
#include <security/mac/mac_framework.h>
VNET_DEFINE(int, ip_defttl) = IPDEFTTL;
@ -426,14 +427,20 @@ rip_input(struct mbuf **mp, int *offp, int proto)
* have setup with control call.
*/
int
rip_output(struct mbuf *m, struct socket *so, u_long dst)
rip_output(struct mbuf *m, struct socket *so, ...)
{
struct ip *ip;
int error;
struct inpcb *inp = sotoinpcb(so);
va_list ap;
u_long dst;
int flags = ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0) |
IP_ALLOWBROADCAST;
va_start(ap, so);
dst = va_arg(ap, u_long);
va_end(ap);
/*
* If the user handed us a complete IP packet, use it. Otherwise,
* allocate an mbuf for a header and fill it in.

View File

@ -89,7 +89,7 @@ struct protosw in6_gif_protosw = {
.pr_protocol = 0, /* IPPROTO_IPV[46] */
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = in6_gif_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
};

View File

@ -233,7 +233,7 @@ struct protosw inet6sw[] = {
.pr_protocol = IPPROTO_RAW,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
#ifndef INET /* Do not call initialization twice. */
@ -247,7 +247,7 @@ struct protosw inet6sw[] = {
.pr_protocol = IPPROTO_ICMPV6,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = icmp6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
.pr_fasttimo = icmp6_fasttimo,
@ -312,7 +312,7 @@ struct protosw inet6sw[] = {
.pr_protocol = IPPROTO_IPV4,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_init = encap_init,
.pr_usrreqs = &rip6_usrreqs
@ -324,7 +324,7 @@ struct protosw inet6sw[] = {
.pr_protocol = IPPROTO_IPV6,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_init = encap_init,
.pr_usrreqs = &rip6_usrreqs
@ -335,7 +335,7 @@ struct protosw inet6sw[] = {
.pr_protocol = IPPROTO_PIM,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = encap6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
},
@ -354,7 +354,7 @@ IP6PROTOSPACER,
.pr_domain = &inet6domain,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
},

View File

@ -146,7 +146,7 @@ static const struct protosw in6_pim_protosw = {
.pr_protocol = IPPROTO_PIM,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR,
.pr_input = pim6_input,
.pr_output = (pr_output_t *)rip6_output,
.pr_output = rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
};

View File

@ -88,7 +88,7 @@ VNET_PCPUSTAT_SYSUNINIT(pfkeystat);
* key_output()
*/
int
key_output(struct mbuf *m, struct socket *so)
key_output(struct mbuf *m, struct socket *so, ...)
{
struct sadb_msg *msg;
int len, error = 0;

View File

@ -76,7 +76,7 @@ VNET_PCPUSTAT_DECLARE(struct pfkeystat, pfkeystat);
VNET_PCPUSTAT_ADD(struct pfkeystat, pfkeystat, name, (val))
#define PFKEYSTAT_INC(name) PFKEYSTAT_ADD(name, 1)
extern int key_output(struct mbuf *m, struct socket *so);
extern int key_output(struct mbuf *m, struct socket *so, ...);
extern int key_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *));

View File

@ -2281,7 +2281,7 @@ static struct protosw in_pfsync_protosw = {
.pr_protocol = IPPROTO_PFSYNC,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = pfsync_input,
.pr_output = (pr_output_t *)rip_output,
.pr_output = rip_output,
.pr_ctloutput = rip_ctloutput,
.pr_usrreqs = &rip_usrreqs
};

View File

@ -65,7 +65,7 @@ struct sockopt;
*/
/* USE THESE FOR YOUR PROTOTYPES ! */
typedef int pr_input_t (struct mbuf **, int*, int);
typedef int pr_output_t (struct mbuf *, struct socket *);
typedef int pr_output_t (struct mbuf *, struct socket *, ...);
typedef void pr_ctlinput_t (int, struct sockaddr *, void *);
typedef int pr_ctloutput_t (struct socket *, struct sockopt *);
typedef void pr_init_t (void);