BSD 4_3_Tahoe release
[unix-history] / usr / src / sys / net / raw_cb.c
index c6d850e..e1e5929 100644 (file)
@@ -1,9 +1,20 @@
 /*
 /*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1980, 1986 Regents of the University of California.
+ * All rights reserved.
  *
  *
- *     @(#)raw_cb.c    6.6 (Berkeley) %G%
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *     @(#)raw_cb.c    7.6 (Berkeley) 6/27/88
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "route.h"
 #include "raw_cb.h"
 #include "../netinet/in.h"
 #include "route.h"
 #include "raw_cb.h"
 #include "../netinet/in.h"
-#ifdef PUP
-#include "../netpup/pup.h"
-#endif
 
 
-#include "../vax/mtpr.h"
+#include "../machine/mtpr.h"
 
 /*
  * Routines to manage the raw protocol control blocks. 
 
 /*
  * Routines to manage the raw protocol control blocks. 
@@ -48,9 +56,9 @@ raw_attach(so, proto)
        m = m_getclr(M_DONTWAIT, MT_PCB);
        if (m == 0)
                return (ENOBUFS);
        m = m_getclr(M_DONTWAIT, MT_PCB);
        if (m == 0)
                return (ENOBUFS);
-       if (sbreserve(&so->so_snd, RAWSNDQ) == 0)
+       if (sbreserve(&so->so_snd, (u_long) RAWSNDQ) == 0)
                goto bad;
                goto bad;
-       if (sbreserve(&so->so_rcv, RAWRCVQ) == 0)
+       if (sbreserve(&so->so_rcv, (u_long) RAWRCVQ) == 0)
                goto bad2;
        rp = mtod(m, struct rawcb *);
        rp->rcb_socket = so;
                goto bad2;
        rp = mtod(m, struct rawcb *);
        rp->rcb_socket = so;
@@ -76,9 +84,13 @@ raw_detach(rp)
 {
        struct socket *so = rp->rcb_socket;
 
 {
        struct socket *so = rp->rcb_socket;
 
+       if (rp->rcb_route.ro_rt)
+               rtfree(rp->rcb_route.ro_rt);
        so->so_pcb = 0;
        sofree(so);
        remque(rp);
        so->so_pcb = 0;
        sofree(so);
        remque(rp);
+       if (rp->rcb_options)
+               m_freem(rp->rcb_options);
        m_freem(dtom(rp));
 }
 
        m_freem(dtom(rp));
 }
 
@@ -120,28 +132,6 @@ raw_bind(so, nam)
        }
 #endif
 
        }
 #endif
 
-#ifdef PUP
-       /*
-        * Curious, we convert PUP address format to internet
-        * to allow us to verify we're asking for an Ethernet
-        * interface.  This is wrong, but things are heavily
-        * oriented towards the internet addressing scheme, and
-        * converting internet to PUP would be very expensive.
-        */
-       case AF_PUP: {
-               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 = in_makeaddr(spup->spup_net, spup->spup_host);
-               if (inpup.sin_addr.s_addr &&
-                   ifa_ifwithaddr((struct sockaddr *)&inpup) == 0)
-                       return (EADDRNOTAVAIL);
-               break;
-       }
-#endif
-
        default:
                return (EAFNOSUPPORT);
        }
        default:
                return (EAFNOSUPPORT);
        }