diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-06-15 03:38:36 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-06-15 03:38:36 +0000 |
commit | f503c85b89c9d4081a557d228744177a77713e0b (patch) | |
tree | 0cb10156e6c8e931370c8412b68fa339b640f1f2 /sys/net | |
parent | 0155468b6bfa9af93194487c72f384953150ed8f (diff) |
change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange.
follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific
interfaces only).
was: if_lastchange get updated on every packet transmission/receipt.
now: if_lastchange get updated when IFF_UP is changed.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 4 | ||||
-rw-r--r-- | sys/net/if.h | 4 | ||||
-rw-r--r-- | sys/net/if_arcsubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_atmsubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 7 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_gif.c | 4 | ||||
-rw-r--r-- | sys/net/if_loop.c | 3 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 4 | ||||
-rw-r--r-- | sys/net/if_sl.c | 10 | ||||
-rw-r--r-- | sys/net/if_slvar.h | 3 | ||||
-rw-r--r-- | sys/net/if_strip.c | 12 | ||||
-rw-r--r-- | sys/net/if_stripvar.h | 4 | ||||
-rw-r--r-- | sys/net/if_tokensubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_tun.c | 4 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 3 |
17 files changed, 32 insertions, 50 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index c79d61482e5..480da5060d9 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.45 2001/06/08 04:19:25 angelos Exp $ */ +/* $OpenBSD: if.c,v 1.46 2001/06/15 03:38:33 itojun Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -576,6 +576,7 @@ if_down(ifp) int i; ifp->if_flags &= ~IFF_UP; + microtime(&ifp->if_lastchange); for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; ifa = ifa->ifa_list.tqe_next) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); if_qflush(&ifp->if_snd); @@ -608,6 +609,7 @@ if_up(ifp) int i; ifp->if_flags |= IFF_UP; + microtime(&ifp->if_lastchange); #ifdef notyet /* this has no effect on IP, and will kill all ISO connections XXX */ for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; diff --git a/sys/net/if.h b/sys/net/if.h index e913c4e34e9..6f03764cd5f 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.26 2001/06/09 06:16:37 angelos Exp $ */ +/* $OpenBSD: if.h,v 1.27 2001/06/15 03:38:33 itojun Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -101,7 +101,7 @@ struct if_data { u_long ifi_omcasts; /* packets sent via multicast */ u_long ifi_iqdrops; /* dropped on input, this interface */ u_long ifi_noproto; /* destined for unsupported protocol */ - struct timeval ifi_lastchange; /* last updated */ + struct timeval ifi_lastchange; /* last operational state change */ }; /* diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index b84d955ee0b..08675f34879 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_arcsubr.c,v 1.6 2001/05/11 17:20:09 aaron Exp $ */ +/* $OpenBSD: if_arcsubr.c,v 1.7 2001/06/15 03:38:33 itojun Exp $ */ /* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */ /* @@ -113,7 +113,6 @@ arc_output(ifp, m0, dst, rt0) m = m0; mcopy = m1 = NULL; - ifp->if_lastchange = time; if ((rt = rt0)) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = rtalloc1(dst, 1))) @@ -483,7 +482,6 @@ arc_input(ifp, m) ah = mtod(m, struct arc_header *); - ifp->if_lastchange = time; ifp->if_ibytes += m->m_pkthdr.len; if (arcbroadcastaddr == ah->arc_dhost) { diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index b81fecc5354..c9437d5d1aa 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atmsubr.c,v 1.14 2001/05/11 17:20:10 aaron Exp $ */ +/* $OpenBSD: if_atmsubr.c,v 1.15 2001/06/15 03:38:33 itojun Exp $ */ /* * @@ -116,7 +116,6 @@ atm_output(ifp, m0, dst, rt0) if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); - ifp->if_lastchange = time; /* * check route @@ -275,7 +274,6 @@ atm_input(ifp, ah, m, rxhand) m_freem(m); return; } - ifp->if_lastchange = time; ifp->if_ibytes += m->m_pkthdr.len; if (rxhand) { diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 0e32c0a8006..e13e96a31c8 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.59 2001/06/07 04:12:58 mickey Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.60 2001/06/15 03:38:33 itojun Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -815,7 +815,6 @@ bridge_output(ifp, m, sa, rt) sc->sc_if.if_opackets++; sc->sc_if.if_obytes += mc->m_pkthdr.len; - dst_if->if_lastchange = time; dst_if->if_obytes += mc->m_pkthdr.len; IF_ENQUEUE(&dst_if->if_snd, mc); if (mc->m_flags & M_MCAST) @@ -844,7 +843,6 @@ sendunicast: } sc->sc_if.if_opackets++; sc->sc_if.if_obytes += m->m_pkthdr.len; - dst_if->if_lastchange = time; dst_if->if_obytes += m->m_pkthdr.len; IF_ENQUEUE(&dst_if->if_snd, m); if (m->m_flags & M_MCAST) @@ -913,7 +911,6 @@ bridgeintr_frame(sc, m) bpf_mtap(sc->sc_if.if_bpf, m); #endif - sc->sc_if.if_lastchange = time; sc->sc_if.if_ipackets++; sc->sc_if.if_ibytes += m->m_pkthdr.len; @@ -1074,7 +1071,6 @@ bridgeintr_frame(sc, m) } sc->sc_if.if_opackets++; sc->sc_if.if_obytes += m->m_pkthdr.len; - dst_if->if_lastchange = time; dst_if->if_obytes += m->m_pkthdr.len; IF_ENQUEUE(&dst_if->if_snd, m); if (m->m_flags & M_MCAST) @@ -1295,7 +1291,6 @@ bridge_broadcast(sc, ifp, eh, m) sc->sc_if.if_opackets++; sc->sc_if.if_obytes += mc->m_pkthdr.len; dst_if->if_obytes += m->m_pkthdr.len; - dst_if->if_lastchange = time; IF_ENQUEUE(&dst_if->if_snd, mc); if (mc->m_flags & M_MCAST) dst_if->if_omcasts++; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index a70476a6aa7..78ac06472e8 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.46 2001/06/14 02:13:58 itojun Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.47 2001/06/15 03:38:33 itojun Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -255,7 +255,6 @@ ether_output(ifp, m0, dst, rt0) if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); - ifp->if_lastchange = time; if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = rtalloc1(dst, 1)) != NULL) @@ -605,7 +604,6 @@ ether_input(ifp, eh, m) ifp->if_imcasts++; } - ifp->if_lastchange = time; ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); etype = ntohs(eh->ether_type); diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 5afc3bd19b6..e4e9464ad79 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fddisubr.c,v 1.23 2001/05/28 19:51:06 dugsong Exp $ */ +/* $OpenBSD: if_fddisubr.c,v 1.24 2001/06/15 03:38:33 itojun Exp $ */ /* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */ /* @@ -160,7 +160,6 @@ fddi_output(ifp, m0, dst, rt0) if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); - ifp->if_lastchange = time; if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = RTALLOC1(dst, 1)) != NULL) @@ -480,7 +479,6 @@ fddi_input(ifp, fh, m) m_freem(m); return; } - ifp->if_lastchange = time; ifp->if_ibytes += m->m_pkthdr.len + sizeof (*fh); if (bcmp((caddr_t)fddibroadcastaddr, (caddr_t)fh->fddi_dhost, sizeof(fddibroadcastaddr)) == 0) diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index a1250278a8a..b6d58459a11 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.17 2001/06/09 06:27:08 angelos Exp $ */ +/* $OpenBSD: if_gif.c,v 1.18 2001/06/15 03:38:34 itojun Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -167,8 +167,6 @@ gif_output(ifp, m, dst, rt) goto end; } - ifp->if_lastchange = time; - m->m_flags &= ~(M_BCAST|M_MCAST); if (!(ifp->if_flags & IFF_UP) || sc->gif_psrc == NULL || sc->gif_pdst == NULL) { diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 28d2ab5327d..3d784315000 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.17 2001/02/06 03:34:59 mickey Exp $ */ +/* $OpenBSD: if_loop.c,v 1.18 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -187,7 +187,6 @@ looutput(ifp, m, dst, rt) if ((m->m_flags & M_PKTHDR) == 0) panic("looutput: no header mbuf"); - ifp->if_lastchange = time; #if NBPFILTER > 0 /* * only send packets to bpf if they are real loopback packets; diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 723bc7dca2d..404431129b1 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.19 2001/05/28 07:53:04 angelos Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.20 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -771,7 +771,6 @@ pppoutput(ifp, m0, dst, rtp) IF_ENQUEUE(ifq, m0); (*sc->sc_start)(sc); } - ifp->if_lastchange = time; ifp->if_opackets++; ifp->if_obytes += len; @@ -1426,7 +1425,6 @@ ppp_inproc(sc, m) splx(s); ifp->if_ipackets++; ifp->if_ibytes += ilen; - ifp->if_lastchange = time; if (rv) (*sc->sc_ctlp)(sc); diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 31e1f7e8e9b..38a24740995 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sl.c,v 1.12 2001/06/12 21:41:32 deraadt Exp $ */ +/* $OpenBSD: if_sl.c,v 1.13 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */ /* @@ -420,7 +420,7 @@ sloutput(ifp, m, dst, rtp) struct timeval tv; /* if output's been stalled for too long, and restart */ - timersub(&time, &sc->sc_if.if_lastchange, &tv); + timersub(&time, &sc->sc_lastpacket, &tv); if (tv.tv_sec > 0) { sc->sc_otimeout++; slstart(sc->sc_ttyp); @@ -434,7 +434,7 @@ sloutput(ifp, m, dst, rtp) return (ENOBUFS); } IF_ENQUEUE(ifq, m); - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; if ((sc->sc_oqlen = sc->sc_ttyp->t_outq.c_cc) == 0) slstart(sc->sc_ttyp); splx(s); @@ -551,7 +551,7 @@ slstart(tp) bpf_tap(sc->sc_bpf, bpfbuf, len + SLIP_HDRLEN); } #endif - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; #if !(defined(__NetBSD__) || defined(__OpenBSD__)) /* XXX - cgd */ /* @@ -842,7 +842,7 @@ slinput(c, tp) #endif sc->sc_if.if_ipackets++; - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; s = splimp(); if (IF_QFULL(&ipintrq)) { IF_DROP(&ipintrq); diff --git a/sys/net/if_slvar.h b/sys/net/if_slvar.h index ccffba9e1bf..892273732bb 100644 --- a/sys/net/if_slvar.h +++ b/sys/net/if_slvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_slvar.h,v 1.8 2001/06/12 21:41:32 deraadt Exp $ */ +/* $OpenBSD: if_slvar.h,v 1.9 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_slvar.h,v 1.16 1996/05/07 02:40:46 thorpej Exp $ */ /*- @@ -69,6 +69,7 @@ struct sl_softc { struct slcompress sc_comp; /* tcp compression data */ #endif caddr_t sc_bpf; /* BPF data */ + struct timeval sc_lastpacket; /* for watchdog */ }; /* diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index d911616c3da..ccf994ce912 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_strip.c,v 1.13 2000/12/30 01:02:55 angelos Exp $ */ +/* $OpenBSD: if_strip.c,v 1.14 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ @@ -836,7 +836,7 @@ stripoutput(ifp, m, dst, rt) struct timeval tv; /* if output's been stalled for too long, and restart */ - timersub(&time, &sc->sc_if.if_lastchange, &tv); + timersub(&time, &sc->sc_lastpacket, &tv); if (tv.tv_sec > 0) { DPRINTF(("stripoutput: stalled, resetting\n")); sc->sc_otimeout++; @@ -851,7 +851,7 @@ stripoutput(ifp, m, dst, rt) return (ENOBUFS); } IF_ENQUEUE(ifq, m); - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; if ((sc->sc_oqlen = sc->sc_ttyp->t_outq.c_cc) == 0) { stripstart(sc->sc_ttyp); } @@ -993,7 +993,7 @@ stripstart(tp) bpf_tap(sc->sc_bpf, cp, len + SLIP_HDRLEN); } #endif - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; #if !(defined(__NetBSD__) || defined(__OpenBSD__)) /* XXX - cgd */ /* @@ -1251,7 +1251,7 @@ stripinput(c, tp) } sc->sc_if.if_ipackets++; - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; s = splimp(); if (IF_QFULL(&ipintrq)) { IF_DROP(&ipintrq); @@ -1373,7 +1373,7 @@ strip_resetradio(sc, tp) * is so badlyhung it needs powercycling. */ sc->sc_state = ST_DEAD; - sc->sc_if.if_lastchange = time; + sc->sc_lastpacket = time; sc->sc_statetimo = time.tv_sec + STRIP_RESET_INTERVAL; /* diff --git a/sys/net/if_stripvar.h b/sys/net/if_stripvar.h index ab3cfb44d44..efee4af3ca7 100644 --- a/sys/net/if_stripvar.h +++ b/sys/net/if_stripvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stripvar.h,v 1.6 2001/06/09 06:16:38 angelos Exp $ */ +/* $OpenBSD: if_stripvar.h,v 1.7 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_stripvar.h,v 1.2.4.1 1996/08/05 20:37:51 jtc Exp $ */ #ifndef _NET_IF_STRIPVAR_H_ @@ -39,6 +39,8 @@ struct st_softc { caddr_t sc_bpf; /* BPF data */ struct timeout sc_timo; + + struct timeval sc_lastpacket; /* for watchdog */ }; diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c index 172e7e40913..d0b85026f85 100644 --- a/sys/net/if_tokensubr.c +++ b/sys/net/if_tokensubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tokensubr.c,v 1.2 2000/01/21 13:44:27 fgsch Exp $ */ +/* $OpenBSD: if_tokensubr.c,v 1.3 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */ /* @@ -155,7 +155,6 @@ token_output(ifp, m0, dst, rt0) if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); - ifp->if_lastchange = time; if ((rt = rt0)) { if ((rt->rt_flags & RTF_UP) == 0) { if ((rt0 = rt = RTALLOC1(dst, 1))) @@ -487,7 +486,6 @@ token_input(ifp, m) trh = mtod(m, struct token_header *); - ifp->if_lastchange = time; ifp->if_ibytes += m->m_pkthdr.len; if (bcmp((caddr_t)tokenbroadcastaddr, (caddr_t)trh->token_dhost, sizeof(tokenbroadcastaddr)) == 0) diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 724cae4b2a1..e9b7ff47528 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.34 2001/05/16 12:53:34 ho Exp $ */ +/* $OpenBSD: if_tun.c,v 1.35 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -341,8 +341,6 @@ tun_output(ifp, m0, dst, rt) m_freem (m0); return EHOSTDOWN; } - ifp->if_lastchange = time; - M_PREPEND(m0, sizeof(*af), M_DONTWAIT); af = mtod(m0, u_int32_t *); diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 3b41b062d5c..4e71673d850 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp_tty.c,v 1.11 2001/05/16 12:53:34 ho Exp $ */ +/* $OpenBSD: ppp_tty.c,v 1.12 2001/06/15 03:38:34 itojun Exp $ */ /* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */ /* @@ -535,7 +535,6 @@ pppasyncstart(sc) /* Calculate the FCS for the first mbuf's worth. */ sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len); - sc->sc_if.if_lastchange = time; } for (;;) { |