add IFF_LOCAL
[unix-history] / usr / src / sys / net / raw_cb.c
index 50a247a..3f70238 100644 (file)
@@ -1,14 +1,19 @@
-/*     raw_cb.c        4.14    82/11/13        */
+/*     raw_cb.c        6.1     83/07/29        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
-#include "../vax/mtpr.h"
+#include "../h/errno.h"
+
 #include "../net/if.h"
 #include "../net/if.h"
+#include "../net/route.h"
 #include "../net/raw_cb.h"
 #include "../net/raw_cb.h"
-#include <errno.h>
+#include "../netinet/in.h"
+#include "../netpup/pup.h"
+
+#include "../vax/mtpr.h"
 
 /*
  * Routines to manage the raw protocol control blocks. 
 
 /*
  * Routines to manage the raw protocol control blocks. 
@@ -29,7 +34,7 @@ raw_attach(so)
        struct mbuf *m;
        register struct rawcb *rp;
 
        struct mbuf *m;
        register struct rawcb *rp;
 
-       m = m_getclr(M_DONTWAIT);
+       m = m_getclr(M_DONTWAIT, MT_PCB);
        if (m == 0)
                return (ENOBUFS);
        if (sbreserve(&so->so_snd, RAWSNDQ) == 0)
        if (m == 0)
                return (ENOBUFS);
        if (sbreserve(&so->so_snd, RAWSNDQ) == 0)
@@ -85,10 +90,6 @@ raw_bind(so, nam)
 
        if (ifnet == 0)
                return (EADDRNOTAVAIL);
 
        if (ifnet == 0)
                return (EADDRNOTAVAIL);
-{
-#include "../h/domain.h"
-#include "../netinet/in.h"
-#include "../netinet/in_systm.h"
 /* BEGIN DUBIOUS */
        /*
         * Should we verify address not already in use?
 /* BEGIN DUBIOUS */
        /*
         * Should we verify address not already in use?
@@ -96,12 +97,15 @@ raw_bind(so, nam)
         */
        switch (addr->sa_family) {
 
         */
        switch (addr->sa_family) {
 
+#ifdef INET
        case AF_IMPLINK:
        case AF_IMPLINK:
-       case AF_INET:
+       case AF_INET: {
                if (((struct sockaddr_in *)addr)->sin_addr.s_addr &&
                    if_ifwithaddr(addr) == 0)
                        return (EADDRNOTAVAIL);
                break;
                if (((struct sockaddr_in *)addr)->sin_addr.s_addr &&
                    if_ifwithaddr(addr) == 0)
                        return (EADDRNOTAVAIL);
                break;
+       }
+#endif
 
 #ifdef PUP
        /*
 
 #ifdef PUP
        /*
@@ -112,14 +116,12 @@ raw_bind(so, nam)
         * converting internet to PUP would be very expensive.
         */
        case AF_PUP: {
         * converting internet to PUP would be very expensive.
         */
        case AF_PUP: {
-#include "../netpup/pup.h"
                struct sockaddr_pup *spup = (struct sockaddr_pup *)addr;
                struct sockaddr_in inpup;
 
                bzero((caddr_t)&inpup, (unsigned)sizeof(inpup));
                inpup.sin_family = AF_INET;
                struct sockaddr_pup *spup = (struct sockaddr_pup *)addr;
                struct sockaddr_in inpup;
 
                bzero((caddr_t)&inpup, (unsigned)sizeof(inpup));
                inpup.sin_family = AF_INET;
-               inpup.sin_addr.s_net = spup->sp_net;
-               inpup.sin_addr.s_impno = spup->sp_host;
+               inpup.sin_addr = if_makeaddr(spup->spup_net, spup->spup_host);
                if (inpup.sin_addr.s_addr &&
                    if_ifwithaddr((struct sockaddr *)&inpup) == 0)
                        return (EADDRNOTAVAIL);
                if (inpup.sin_addr.s_addr &&
                    if_ifwithaddr((struct sockaddr *)&inpup) == 0)
                        return (EADDRNOTAVAIL);
@@ -130,7 +132,6 @@ raw_bind(so, nam)
        default:
                return (EAFNOSUPPORT);
        }
        default:
                return (EAFNOSUPPORT);
        }
-}
 /* END DUBIOUS */
        rp = sotorawcb(so);
        bcopy((caddr_t)addr, (caddr_t)&rp->rcb_laddr, sizeof (*addr));
 /* END DUBIOUS */
        rp = sotorawcb(so);
        bcopy((caddr_t)addr, (caddr_t)&rp->rcb_laddr, sizeof (*addr));