Hi,

This is the next step in merging protosw and ip6protosw.

The IPv4 pr_ctlinput functions return a void pointer that is always
NULL and never used.  Make all functions void like in the IPv6 case.

ok?

bluhm

Index: netinet/ip_icmp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.160
diff -u -p -r1.160 ip_icmp.c
--- netinet/ip_icmp.c   25 Jan 2017 17:34:31 -0000      1.160
+++ netinet/ip_icmp.c   25 Jan 2017 23:27:53 -0000
@@ -326,7 +326,7 @@ icmp_input_if(struct ifnet *ifp, struct 
        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,
                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));
Index: netinet/ip_ipsp.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_ipsp.h,v
retrieving revision 1.175
diff -u -p -r1.175 ip_ipsp.h
--- netinet/ip_ipsp.h   25 Jan 2017 17:34:31 -0000      1.175
+++ netinet/ip_ipsp.h   25 Jan 2017 23:33:06 -0000
@@ -493,8 +493,8 @@ int ah_output(struct mbuf *, struct tdb 
 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
 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);
Index: netinet/ipsec_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ipsec_input.c,v
retrieving revision 1.139
diff -u -p -r1.139 ipsec_input.c
--- netinet/ipsec_input.c       25 Jan 2017 17:34:31 -0000      1.139
+++ netinet/ipsec_input.c       25 Jan 2017 23:35:43 -0000
@@ -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
                 * 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
                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
                            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 sockad
         * 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 sockad
                        }
                }
        }
-       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
Index: netinet/tcp_subr.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.158
diff -u -p -r1.158 tcp_subr.c
--- netinet/tcp_subr.c  10 Jan 2017 09:01:18 -0000      1.158
+++ netinet/tcp_subr.c  25 Jan 2017 23:31:26 -0000
@@ -725,7 +725,7 @@ tcp6_ctlinput(int cmd, struct sockaddr *
 }
 #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 *s
        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 *s
                         */
                        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 *s
                                 */
                                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 *s
        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 *s
                }
        } else
                in_pcbnotifyall(&tcbtable, sa, rdomain, errno, notify);
-
-       return NULL;
 }
 
 
Index: netinet/tcp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v
retrieving revision 1.118
diff -u -p -r1.118 tcp_var.h
--- netinet/tcp_var.h   25 Jan 2017 17:34:31 -0000      1.118
+++ netinet/tcp_var.h   25 Jan 2017 23:31:32 -0000
@@ -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 *);
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.227
diff -u -p -r1.227 udp_usrreq.c
--- netinet/udp_usrreq.c        25 Jan 2017 17:34:31 -0000      1.227
+++ netinet/udp_usrreq.c        25 Jan 2017 23:31:49 -0000
@@ -869,7 +869,7 @@ udp6_ctlinput(int cmd, struct sockaddr *
 }
 #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 *s
        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 *s
                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 *s
                        notify(inp, errno);
        } else
                in_pcbnotifyall(&udbtable, sa, rdomain, errno, notify);
-       return (NULL);
 }
 
 int
Index: netinet/udp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_var.h,v
retrieving revision 1.29
diff -u -p -r1.29 udp_var.h
--- netinet/udp_var.h   25 Jan 2017 17:34:31 -0000      1.29
+++ netinet/udp_var.h   25 Jan 2017 23:30:33 -0000
@@ -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
Index: netinet6/ip6protosw.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6protosw.h,v
retrieving revision 1.10
diff -u -p -r1.10 ip6protosw.h
--- netinet6/ip6protosw.h       21 Oct 2013 12:40:50 -0000      1.10
+++ netinet6/ip6protosw.h       25 Jan 2017 23:26:29 -0000
@@ -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 */
Index: sys/protosw.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/protosw.h,v
retrieving revision 1.19
diff -u -p -r1.19 protosw.h
--- sys/protosw.h       25 Jan 2017 17:34:31 -0000      1.19
+++ sys/protosw.h       25 Jan 2017 23:28:58 -0000
@@ -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 **);
 

Reply via email to