diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-26 13:03:48 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-01-26 13:03:48 +0000 |
commit | ed8098d9ded7c0223cd86a93edde73daf3d18c5c (patch) | |
tree | 4fc6567785c02322373234fe5611708d4231bb95 /sys | |
parent | e173df0131cb7072da934d265d564d849b23fc85 (diff) |
Reduce the difference between struct protosw and ip6protosw. The
IPv4 pr_ctlinput functions did return a void pointer that was always
NULL and never used. Make all functions void like in the IPv6 case.
OK mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_icmp.c | 6 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.h | 8 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 30 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 24 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 4 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 17 | ||||
-rw-r--r-- | sys/netinet/udp_var.h | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6protosw.h | 5 | ||||
-rw-r--r-- | sys/sys/protosw.h | 4 |
9 files changed, 48 insertions, 54 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index a312182becc..b75ed391bb2 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.160 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.161 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -326,7 +326,7 @@ icmp_input_if(struct ifnet *ifp, struct mbuf *m, int hlen, int proto) struct sockaddr_in sin; int icmplen, i, code; struct in_ifaddr *ia; - void *(*ctlfunc)(int, struct sockaddr *, u_int, void *); + void (*ctlfunc)(int, struct sockaddr *, u_int, void *); struct mbuf *opts; /* @@ -1053,7 +1053,7 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) return; if ((rt->rt_flags & (RTF_DYNAMIC|RTF_HOST)) == (RTF_DYNAMIC|RTF_HOST)) { - void *(*ctlfunc)(int, struct sockaddr *, u_int, void *); + void (*ctlfunc)(int, struct sockaddr *, u_int, void *); struct sockaddr_in sin; sin = *satosin(rt_key(rt)); diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index 4780a873b8e..823dd78105e 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.175 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.176 2017/01/26 13:03:47 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -493,8 +493,8 @@ int ah_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); int ah_sysctl(int *, u_int, void *, size_t *, void *, size_t); void ah4_input(struct mbuf *, int, int); -void *ah4_ctlinput(int, struct sockaddr *, u_int, void *); -void *udpencap_ctlinput(int, struct sockaddr *, u_int, void *); +void ah4_ctlinput(int, struct sockaddr *, u_int, void *); +void udpencap_ctlinput(int, struct sockaddr *, u_int, void *); #ifdef INET6 int ah6_input(struct mbuf **, int *, int); @@ -509,7 +509,7 @@ int esp_output(struct mbuf *, struct tdb *, struct mbuf **, int, int); int esp_sysctl(int *, u_int, void *, size_t *, void *, size_t); void esp4_input(struct mbuf *, int, int); -void *esp4_ctlinput(int, struct sockaddr *, u_int, void *); +void esp4_ctlinput(int, struct sockaddr *, u_int, void *); #ifdef INET6 int esp6_input(struct mbuf **, int *, int); diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index d181d5d89e1..116b7bc77e2 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.139 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.140 2017/01/26 13:03:47 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -79,7 +79,7 @@ #include "bpfilter.h" -void *ipsec_common_ctlinput(u_int, int, struct sockaddr *, void *, int); +void ipsec_common_ctlinput(u_int, int, struct sockaddr *, void *, int); int ah4_input_cb(struct mbuf *, ...); int esp4_input_cb(struct mbuf *, ...); int ipcomp4_input_cb(struct mbuf *, ...); @@ -725,14 +725,14 @@ ah4_input_cb(struct mbuf *m, ...) /* XXX rdomain */ -void * +void ah4_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) { if (sa->sa_family != AF_INET || sa->sa_len != sizeof(struct sockaddr_in)) - return (NULL); + return; - return (ipsec_common_ctlinput(rdomain, cmd, sa, v, IPPROTO_AH)); + ipsec_common_ctlinput(rdomain, cmd, sa, v, IPPROTO_AH); } /* IPv4 ESP wrapper. */ @@ -786,7 +786,7 @@ ipcomp4_input_cb(struct mbuf *m, ...) return 0; } -void * +void ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa, void *v, int proto) { @@ -810,7 +810,7 @@ ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa, * or the MTU is too small to be acceptable. */ if (mtu < 296) - return (NULL); + return; memset(&dst, 0, sizeof(struct sockaddr_in)); dst.sin_family = AF_INET; @@ -822,13 +822,13 @@ ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa, tdbp = gettdb(rdomain, spi, (union sockaddr_union *)&dst, proto); if (tdbp == NULL || tdbp->tdb_flags & TDBF_INVALID) - return (NULL); + return; /* Walk the chain backwards to the first tdb */ for (; tdbp; tdbp = tdbp->tdb_inext) { if (tdbp->tdb_flags & TDBF_INVALID || (adjust = ipsec_hdrsz(tdbp)) == -1) - return (NULL); + return; mtu -= adjust; @@ -842,11 +842,10 @@ ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa, adjust)); } } - return (NULL); } /* XXX rdomain */ -void * +void udpencap_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) { struct ip *ip = v; @@ -867,7 +866,7 @@ udpencap_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) * or the MTU is too small to be acceptable. */ if (mtu < 296) - return (NULL); + return; memset(&dst, 0, sizeof(dst)); dst.sin_family = AF_INET; @@ -900,18 +899,17 @@ udpencap_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) } } } - return (NULL); } /* XXX rdomain */ -void * +void esp4_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) { if (sa->sa_family != AF_INET || sa->sa_len != sizeof(struct sockaddr_in)) - return (NULL); + return; - return (ipsec_common_ctlinput(rdomain, cmd, sa, v, IPPROTO_ESP)); + ipsec_common_ctlinput(rdomain, cmd, sa, v, IPPROTO_ESP); } #ifdef INET6 diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5729c1bae48..55ec3fe41fd 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.158 2017/01/10 09:01:18 mpi Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.159 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -725,7 +725,7 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) } #endif -void * +void tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) { struct ip *ip = v; @@ -739,20 +739,20 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) int errno; if (sa->sa_family != AF_INET) - return NULL; + return; faddr = satosin(sa)->sin_addr; if (faddr.s_addr == INADDR_ANY) - return NULL; + return; if ((unsigned)cmd >= PRC_NCMDS) - return NULL; + return; errno = inetctlerrmap[cmd]; if (cmd == PRC_QUENCH) /* * Don't honor ICMP Source Quench messages meant for * TCP connections. */ - return NULL; + return; else if (PRC_IS_REDIRECT(cmd)) notify = in_rtchange, ip = 0; else if (cmd == PRC_MSGSIZE && ip_mtudisc && ip) { @@ -779,7 +779,7 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) */ mtu = (u_int)ntohs(icp->icmp_nextmtu); if (mtu >= tp->t_pmtud_mtu_sent) - return NULL; + return; if (mtu >= tcp_hdrsz(tp) + tp->t_pmtud_mss_acked) { /* * Calculate new MTU, and create corresponding @@ -797,18 +797,18 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) */ if (tp->t_flags & TF_PMTUD_PEND) { if (SEQ_LT(tp->t_pmtud_th_seq, seq)) - return NULL; + return; } else tp->t_flags |= TF_PMTUD_PEND; tp->t_pmtud_th_seq = seq; tp->t_pmtud_nextmtu = icp->icmp_nextmtu; tp->t_pmtud_ip_len = icp->icmp_ip.ip_len; tp->t_pmtud_ip_hl = icp->icmp_ip.ip_hl; - return NULL; + return; } } else { /* ignore if we don't have a matching connection */ - return NULL; + return; } notify = tcp_mtudisc, ip = 0; } else if (cmd == PRC_MTUINC) @@ -816,7 +816,7 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) else if (cmd == PRC_HOSTDEAD) ip = 0; else if (errno == 0) - return NULL; + return; if (ip) { th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2)); @@ -844,8 +844,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) } } else in_pcbnotifyall(&tcbtable, sa, rdomain, errno, notify); - - return NULL; } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f1f7c269328..34fba69a0a0 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.118 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.119 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -601,7 +601,7 @@ int tcp_freeq(struct tcpcb *); #ifdef INET6 void tcp6_ctlinput(int, struct sockaddr *, u_int, void *); #endif -void *tcp_ctlinput(int, struct sockaddr *, u_int, void *); +void tcp_ctlinput(int, struct sockaddr *, u_int, void *); int tcp_ctloutput(int, struct socket *, int, int, struct mbuf **); struct tcpcb * tcp_disconnect(struct tcpcb *); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 6020c90a961..5039c60214f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.227 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.228 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -869,7 +869,7 @@ udp6_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *d) } #endif -void * +void udp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) { struct ip *ip = v; @@ -880,23 +880,23 @@ udp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) int errno; if (sa == NULL) - return NULL; + return; if (sa->sa_family != AF_INET || sa->sa_len != sizeof(struct sockaddr_in)) - return NULL; + return; faddr = satosin(sa)->sin_addr; if (faddr.s_addr == INADDR_ANY) - return NULL; + return; if ((unsigned)cmd >= PRC_NCMDS) - return NULL; + return; errno = inetctlerrmap[cmd]; if (PRC_IS_REDIRECT(cmd)) notify = in_rtchange, ip = 0; else if (cmd == PRC_HOSTDEAD) ip = 0; else if (errno == 0) - return NULL; + return; if (ip) { uhp = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2)); @@ -905,7 +905,7 @@ udp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) if (cmd == PRC_MSGSIZE && ip_mtudisc && udpencap_enable && udpencap_port && uhp->uh_sport == htons(udpencap_port)) { udpencap_ctlinput(cmd, sa, rdomain, v); - return (NULL); + return; } #endif inp = in_pcbhashlookup(&udbtable, @@ -915,7 +915,6 @@ udp_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) notify(inp, errno); } else in_pcbnotifyall(&udbtable, sa, rdomain, errno, notify); - return (NULL); } int diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 6b6911ae5fb..b5689307ac2 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_var.h,v 1.29 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: udp_var.h,v 1.30 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */ /* @@ -140,7 +140,7 @@ extern struct udpstat udpstat; void udp6_ctlinput(int, struct sockaddr *, u_int, void *); int udp6_input(struct mbuf **, int *, int); #endif /* INET6 */ -void *udp_ctlinput(int, struct sockaddr *, u_int, void *); +void udp_ctlinput(int, struct sockaddr *, u_int, void *); void udp_init(void); void udp_input(struct mbuf *, int, int); #ifdef INET6 diff --git a/sys/netinet6/ip6protosw.h b/sys/netinet6/ip6protosw.h index 6b1c677fa1c..7ae41cca75c 100644 --- a/sys/netinet6/ip6protosw.h +++ b/sys/netinet6/ip6protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6protosw.h,v 1.10 2013/10/21 12:40:50 deraadt Exp $ */ +/* $OpenBSD: ip6protosw.h,v 1.11 2017/01/26 13:03:47 bluhm Exp $ */ /* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */ /* @@ -110,7 +110,7 @@ struct ip6ctlparam { }; struct ip6protosw { - short pr_type; /* socket type used for */ + short pr_type; /* socket type used for */ struct domain *pr_domain; /* domain protocol a member of */ short pr_protocol; /* protocol number */ short pr_flags; /* see below */ @@ -132,7 +132,6 @@ struct ip6protosw { /* utility hooks */ void (*pr_init)(void); /* initialization hook */ - void (*pr_fasttimo)(void); /* fast timeout (200ms) */ void (*pr_slowtimo)(void); /* slow timeout (500ms) */ void (*pr_drain)(void); /* flush any excess space possible */ diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index b25de61ee8f..6f6704ce376 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.19 2017/01/25 17:34:31 bluhm Exp $ */ +/* $OpenBSD: protosw.h,v 1.20 2017/01/26 13:03:47 bluhm Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -73,7 +73,7 @@ struct protosw { /* output to protocol (from above) */ int (*pr_output)(struct mbuf *, ...); /* control input (from below) */ - void *(*pr_ctlinput)(int, struct sockaddr *, u_int, void *); + void (*pr_ctlinput)(int, struct sockaddr *, u_int, void *); /* control output (from above) */ int (*pr_ctloutput)(int, struct socket *, int, int, struct mbuf **); |