date and time created 88/12/13 13:20:26 by sklower
[unix-history] / usr / src / sys / net / if.c
index 579d0fb..f4f7efe 100644 (file)
@@ -1,12 +1,24 @@
 /*
 /*
- * 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.
  *
  *
- *     @(#)if.c        6.12 (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.
+ *
+ *     @(#)if.c        7.4 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
+#include "mbuf.h"
 #include "systm.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "systm.h"
 #include "socket.h"
 #include "socketvar.h"
@@ -143,6 +155,7 @@ ifa_ifwithnet(addr)
        return ((struct ifaddr *)0);
 }
 
        return ((struct ifaddr *)0);
 }
 
+#ifdef notdef
 /*
  * Find an interface using a specific address family
  */
 /*
  * Find an interface using a specific address family
  */
@@ -159,6 +172,7 @@ ifa_ifwithaf(af)
                        return (ifa);
        return ((struct ifaddr *)0);
 }
                        return (ifa);
        return ((struct ifaddr *)0);
 }
+#endif
 
 /*
  * Mark an interface down and notify protocols of
 
 /*
  * Mark an interface down and notify protocols of
@@ -173,6 +187,25 @@ if_down(ifp)
        ifp->if_flags &= ~IFF_UP;
        for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
                pfctlinput(PRC_IFDOWN, &ifa->ifa_addr);
        ifp->if_flags &= ~IFF_UP;
        for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
                pfctlinput(PRC_IFDOWN, &ifa->ifa_addr);
+       if_qflush(&ifp->if_snd);
+}
+
+/*
+ * Flush an interface queue.
+ */
+if_qflush(ifq)
+       register struct ifqueue *ifq;
+{
+       register struct mbuf *m, *n;
+
+       n = ifq->ifq_head;
+       while (m = n) {
+               n = m->m_act;
+               m_freem(m);
+       }
+       ifq->ifq_head = 0;
+       ifq->ifq_tail = 0;
+       ifq->ifq_len = 0;
 }
 
 /*
 }
 
 /*