Hi,

The function raw_input() gets not called since netiso has been
removed in 2004.  The comment above rip_input() has been added in
1981, but it is wrong since 1992.  pr_input is never called with
parameters (*pr_input)(mbuf, sockproto, sockaddr, sockaddr).

So I think it is time to retire raw_input().

ok?

bluhm

Index: kern/uipc_proto.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_proto.c,v
retrieving revision 1.9
diff -u -p -r1.9 uipc_proto.c
--- kern/uipc_proto.c   5 Sep 2016 15:12:29 -0000       1.9
+++ kern/uipc_proto.c   20 Jan 2017 18:56:20 -0000
@@ -65,7 +65,7 @@ struct protosw unixsw[] = {
   0,           0,              0,              0,
 },
 { 0,           0,              0,              0,
-  raw_input,   0,              0,              0,
+  0,           0,              0,              0,
   raw_usrreq,
   raw_init,    0,              0,              0,
 }
Index: net/pfkey.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkey.c,v
retrieving revision 1.34
diff -u -p -r1.34 pfkey.c
--- net/pfkey.c 13 Jan 2017 08:52:09 -0000      1.34
+++ net/pfkey.c 20 Jan 2017 18:57:04 -0000
@@ -270,7 +270,7 @@ static struct protosw pfkey_protosw_temp
        &pfkeydomain,
        -1, /* protocol */
        PR_ATOMIC | PR_ADDR,
-       (void *) raw_input,
+       NULL, /* input */
        (void *) pfkey_output,
        NULL, /* ctlinput */
        NULL, /* ctloutput */
Index: net/raw_cb.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/raw_cb.h,v
retrieving revision 1.10
diff -u -p -r1.10 raw_cb.h
--- net/raw_cb.h        5 Sep 2016 15:12:30 -0000       1.10
+++ net/raw_cb.h        20 Jan 2017 18:57:13 -0000
@@ -62,7 +62,6 @@ int    raw_attach(struct socket *, int);
 void    raw_detach(struct rawcb *);
 void    raw_disconnect(struct rawcb *);
 void    raw_init(void);
-void    raw_input(struct mbuf *, ...);
 int     raw_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
 #endif /* _KERNEL */
Index: net/raw_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/raw_usrreq.c,v
retrieving revision 1.27
diff -u -p -r1.27 raw_usrreq.c
--- net/raw_usrreq.c    19 Dec 2016 08:36:49 -0000      1.27
+++ net/raw_usrreq.c    20 Jan 2017 18:57:51 -0000
@@ -55,82 +55,6 @@ raw_init(void)
        LIST_INIT(&rawcb);
 }
 
-
-/*
- * Raw protocol input routine.  Find the socket
- * associated with the packet(s) and move them over.  If
- * nothing exists for this packet, drop it.
- */
-/*
- * Raw protocol interface.
- */
-void
-raw_input(struct mbuf *m0, ...)
-{
-       struct rawcb *rp;
-       struct mbuf *m = m0;
-       int sockets = 0;
-       struct socket *last;
-       va_list ap;
-       struct sockproto *proto;
-       struct sockaddr *src, *dst;
-       
-       va_start(ap, m0);
-       proto = va_arg(ap, struct sockproto *);
-       src = va_arg(ap, struct sockaddr *);
-       dst = va_arg(ap, struct sockaddr *);
-       va_end(ap);
-
-       last = 0;
-       LIST_FOREACH(rp, &rawcb, rcb_list) {
-               if (rp->rcb_socket->so_state & SS_CANTRCVMORE)
-                       continue;
-               if (rp->rcb_proto.sp_family != proto->sp_family)
-                       continue;
-               if (rp->rcb_proto.sp_protocol  &&
-                   rp->rcb_proto.sp_protocol != proto->sp_protocol)
-                       continue;
-               /*
-                * We assume the lower level routines have
-                * placed the address in a canonical format
-                * suitable for a structure comparison.
-                *
-                * Note that if the lengths are not the same
-                * the comparison will fail at the first byte.
-                */
-#define        equal(a1, a2) \
-  (bcmp((caddr_t)(a1), (caddr_t)(a2), a1->sa_len) == 0)
-               if (rp->rcb_laddr && !equal(rp->rcb_laddr, dst))
-                       continue;
-               if (rp->rcb_faddr && !equal(rp->rcb_faddr, src))
-                       continue;
-               if (last) {
-                       struct mbuf *n;
-                       if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
-                               if (sbappendaddr(&last->so_rcv, src,
-                                   n, (struct mbuf *)NULL) == 0)
-                                       /* should notify about lost packet */
-                                       m_freem(n);
-                               else {
-                                       sorwakeup(last);
-                                       sockets++;
-                               }
-                       }
-               }
-               last = rp->rcb_socket;
-       }
-       if (last) {
-               if (sbappendaddr(&last->so_rcv, src,
-                   m, (struct mbuf *)NULL) == 0)
-                       m_freem(m);
-               else {
-                       sorwakeup(last);
-                       sockets++;
-               }
-       } else
-               m_freem(m);
-}
-
 int
 raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
     struct mbuf *control, struct proc *p)
Index: netinet/raw_ip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.91
diff -u -p -r1.91 raw_ip.c
--- netinet/raw_ip.c    10 Jan 2017 09:01:18 -0000      1.91
+++ netinet/raw_ip.c    20 Jan 2017 18:59:46 -0000
@@ -115,11 +115,6 @@ rip_init(void)
 
 struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
 
-/*
- * Setup generic address and protocol structures
- * for raw_input routine, then pass them along with
- * mbuf chain.
- */
 void
 rip_input(struct mbuf *m, ...)
 {
Index: netinet6/raw_ip6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.102
diff -u -p -r1.102 raw_ip6.c
--- netinet6/raw_ip6.c  10 Jan 2017 09:01:18 -0000      1.102
+++ netinet6/raw_ip6.c  20 Jan 2017 18:59:02 -0000
@@ -115,11 +115,6 @@ rip6_init(void)
        in_pcbinit(&rawin6pcbtable, 1);
 }
 
-/*
- * Setup generic address and protocol structures
- * for raw_input routine, then pass them along with
- * mbuf chain.
- */
 int
 rip6_input(struct mbuf **mp, int *offp, int proto)
 {

Reply via email to