- u_long addr;
-
- if (net < 128)
- addr = (net << 24) | host;
- else if (net < 65536)
- addr = (net << 16) | host;
- else
- addr = (net << 8) | host;
-#ifdef vax
- addr = htonl(addr);
-#endif
- return (*(struct in_addr *)&addr);
+
+ ifp->if_flags &= ~IFF_UP;
+ pfctlinput(PRC_IFDOWN, (caddr_t)&ifp->if_addr);
+}
+
+/*
+ * Handle interface watchdog timer routines. Called
+ * from softclock, we decrement timers (if set) and
+ * call the appropriate interface routine on expiration.
+ */
+if_slowtimo()
+{
+ register struct ifnet *ifp;
+
+ for (ifp = ifnet; ifp; ifp = ifp->if_next) {
+ if (ifp->if_timer == 0 || --ifp->if_timer)
+ continue;
+ if (ifp->if_watchdog)
+ (*ifp->if_watchdog)(ifp->if_unit);
+ }
+ timeout(if_slowtimo, (caddr_t)0, hz / IFNET_SLOWHZ);
+}
+
+/*
+ * Map interface name to
+ * interface structure pointer.
+ */
+struct ifnet *
+ifunit(name)
+ register char *name;
+{
+ register char *cp;
+ register struct ifnet *ifp;
+ int unit;
+
+ for (cp = name; cp < name + IFNAMSIZ && *cp; cp++)
+ if (*cp >= '0' && *cp <= '9')
+ break;
+ if (*cp == '\0' || cp == name + IFNAMSIZ)
+ return ((struct ifnet *)0);
+ unit = *cp - '0';
+ for (ifp = ifnet; ifp; ifp = ifp->if_next) {
+ if (bcmp(ifp->if_name, name, (unsigned)(cp - name)))
+ continue;
+ if (unit == ifp->if_unit)
+ break;
+ }
+ return (ifp);