BSD 4_3 release
[unix-history] / usr / src / sys / net / raw_usrreq.c
index 84d1438..b619886 100644 (file)
@@ -1,4 +1,10 @@
-/*     raw_usrreq.c    6.6     85/05/30        */
+/*
+ * Copyright (c) 1980, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)raw_usrreq.c        7.1 (Berkeley) 6/4/86
+ */
 
 #include "param.h"
 #include "mbuf.h"
 
 #include "param.h"
 #include "mbuf.h"
@@ -78,7 +84,6 @@ rawintr()
        int s;
        struct mbuf *m;
        register struct rawcb *rp;
        int s;
        struct mbuf *m;
        register struct rawcb *rp;
-       register struct protosw *lproto;
        register struct raw_header *rh;
        struct socket *last;
 
        register struct raw_header *rh;
        struct socket *last;
 
@@ -91,11 +96,10 @@ next:
        rh = mtod(m, struct raw_header *);
        last = 0;
        for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) {
        rh = mtod(m, struct raw_header *);
        last = 0;
        for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) {
-               lproto = rp->rcb_socket->so_proto;
-               if (lproto->pr_domain->dom_family != rh->raw_proto.sp_family)
+               if (rp->rcb_proto.sp_family != rh->raw_proto.sp_family)
                        continue;
                        continue;
-               if (lproto->pr_protocol &&
-                   lproto->pr_protocol != rh->raw_proto.sp_protocol)
+               if (rp->rcb_proto.sp_protocol  &&
+                   rp->rcb_proto.sp_protocol != rh->raw_proto.sp_protocol)
                        continue;
                /*
                 * We assume the lower level routines have
                        continue;
                /*
                 * We assume the lower level routines have
@@ -138,7 +142,7 @@ next:
 /*ARGSUSED*/
 raw_ctlinput(cmd, arg)
        int cmd;
 /*ARGSUSED*/
 raw_ctlinput(cmd, arg)
        int cmd;
-       caddr_t arg;
+       struct sockaddr *arg;
 {
 
        if (cmd < 0 || cmd > PRC_NCMDS)
 {
 
        if (cmd < 0 || cmd > PRC_NCMDS)
@@ -155,6 +159,8 @@ raw_usrreq(so, req, m, nam, rights)
        register struct rawcb *rp = sotorawcb(so);
        register int error = 0;
 
        register struct rawcb *rp = sotorawcb(so);
        register int error = 0;
 
+       if (req == PRU_CONTROL)
+               return (EOPNOTSUPP);
        if (rights && rights->m_len) {
                error = EOPNOTSUPP;
                goto release;
        if (rights && rights->m_len) {
                error = EOPNOTSUPP;
                goto release;
@@ -179,7 +185,7 @@ raw_usrreq(so, req, m, nam, rights)
                        error = EINVAL;
                        break;
                }
                        error = EINVAL;
                        break;
                }
-               error = raw_attach(so);
+               error = raw_attach(so, (int)nam);
                break;
 
        /*
                break;
 
        /*
@@ -226,8 +232,6 @@ raw_usrreq(so, req, m, nam, rights)
                        error = ENOTCONN;
                        break;
                }
                        error = ENOTCONN;
                        break;
                }
-               if (rp->rcb_route.ro_rt)
-                       rtfree(rp->rcb_route.ro_rt);
                raw_disconnect(rp);
                soisdisconnected(so);
                break;
                raw_disconnect(rp);
                soisdisconnected(so);
                break;
@@ -254,22 +258,6 @@ raw_usrreq(so, req, m, nam, rights)
                        error = ENOTCONN;
                        break;
                }
                        error = ENOTCONN;
                        break;
                }
-               /*
-                * Check for routing.  If new foreign address, or
-                * no route presently in use, try to allocate new
-                * route.  On failure, just hand packet to output
-                * routine anyway in case it can handle it.
-                */
-               if ((rp->rcb_flags & RAW_DONTROUTE) == 0)
-                       if (!equal(rp->rcb_faddr, rp->rcb_route.ro_dst) ||
-                           rp->rcb_route.ro_rt == 0) {
-                               if (rp->rcb_route.ro_rt) {
-                                       RTFREE(rp->rcb_route.ro_rt);
-                                       rp->rcb_route.ro_rt = NULL;
-                               }
-                               rp->rcb_route.ro_dst = rp->rcb_faddr;
-                               rtalloc(&rp->rcb_route);
-                       }
                error = (*so->so_proto->pr_output)(m, so);
                m = NULL;
                if (nam)
                error = (*so->so_proto->pr_output)(m, so);
                m = NULL;
                if (nam)
@@ -291,11 +279,11 @@ raw_usrreq(so, req, m, nam, rights)
        /*
         * Not supported.
         */
        /*
         * Not supported.
         */
-       case PRU_CONTROL:
        case PRU_RCVOOB:
        case PRU_RCVD:
                return(EOPNOTSUPP);
 
        case PRU_RCVOOB:
        case PRU_RCVD:
                return(EOPNOTSUPP);
 
+       case PRU_LISTEN:
        case PRU_ACCEPT:
        case PRU_SENDOOB:
                error = EOPNOTSUPP;
        case PRU_ACCEPT:
        case PRU_SENDOOB:
                error = EOPNOTSUPP;