summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 0ac5738..b0c7be7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
- * $Id: if.c,v 1.62 1998/08/12 22:51:59 wpaul Exp $
+ * $Id: if.c,v 1.63 1998/12/04 22:54:52 archie Exp $
*/
#include "opt_compat.h"
@@ -401,16 +401,17 @@ link_rtrequest(cmd, rt, sa)
* NOTE: must be called at splnet or eqivalent.
*/
void
-if_down(ifp)
+if_unroute(ifp, flag, fam)
register struct ifnet *ifp;
+ int flag, fam;
{
register struct ifaddr *ifa;
- ifp->if_flags &= ~IFF_UP;
+ ifp->if_flags &= ~flag;
getmicrotime(&ifp->if_lastchange);
- for (ifa = ifp->if_addrhead.tqh_first; ifa;
- ifa = ifa->ifa_link.tqe_next)
- pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
+ if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family))
+ pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
if_qflush(&ifp->if_snd);
rt_ifmsg(ifp);
}
@@ -421,20 +422,47 @@ if_down(ifp)
* NOTE: must be called at splnet or eqivalent.
*/
void
-if_up(ifp)
+if_route(ifp, flag, fam)
register struct ifnet *ifp;
+ int flag, fam;
{
register struct ifaddr *ifa;
- ifp->if_flags |= IFF_UP;
+ ifp->if_flags |= flag;
getmicrotime(&ifp->if_lastchange);
- for (ifa = ifp->if_addrhead.tqh_first; ifa;
- ifa = ifa->ifa_link.tqe_next)
- pfctlinput(PRC_IFUP, ifa->ifa_addr);
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
+ if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family))
+ pfctlinput(PRC_IFUP, ifa->ifa_addr);
rt_ifmsg(ifp);
}
/*
+ * Mark an interface down and notify protocols of
+ * the transition.
+ * NOTE: must be called at splnet or eqivalent.
+ */
+void
+if_down(ifp)
+ register struct ifnet *ifp;
+{
+
+ if_unroute(ifp, IFF_UP, AF_UNSPEC);
+}
+
+/*
+ * Mark an interface up and notify protocols of
+ * the transition.
+ * NOTE: must be called at splnet or eqivalent.
+ */
+void
+if_up(ifp)
+ register struct ifnet *ifp;
+{
+
+ if_route(ifp, IFF_UP, AF_UNSPEC);
+}
+
+/*
* Flush an interface queue.
*/
static void
OpenPOWER on IntegriCloud