summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorgpalmer <gpalmer@FreeBSD.org>1996-06-10 23:07:36 +0000
committergpalmer <gpalmer@FreeBSD.org>1996-06-10 23:07:36 +0000
commit3d25650dd7c966ac51f8b3282ebd9e19d4180bba (patch)
tree873cfb6a0afbdf68e48eb5fc1d9b647963c2ab23 /sys/net
parent5084820da1fa2c34db54030c73050e853283ba69 (diff)
downloadFreeBSD-src-3d25650dd7c966ac51f8b3282ebd9e19d4180bba.zip
FreeBSD-src-3d25650dd7c966ac51f8b3282ebd9e19d4180bba.tar.gz
Change the use if ifnet.if_lastchange to be more in line with
SNMP requirements. Update description of ifnet.if_lastchange in if.h to indicate this.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c29
-rw-r--r--sys/net/if.h4
-rw-r--r--sys/net/if_disc.c3
-rw-r--r--sys/net/if_ethersubr.c10
-rw-r--r--sys/net/if_fddisubr.c4
-rw-r--r--sys/net/if_loop.c3
-rw-r--r--sys/net/if_ppp.c5
-rw-r--r--sys/net/if_sl.c6
-rw-r--r--sys/net/if_spppsubr.c2
-rw-r--r--sys/net/if_tun.c7
-rw-r--r--sys/net/ppp_tty.c4
11 files changed, 42 insertions, 35 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 5d67e49..e73fdb6 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.29 1996/03/11 15:13:00 davidg Exp $
+ * $Id: if.c,v 1.30 1996/06/05 17:12:41 wollman Exp $
*/
#include <sys/param.h>
@@ -115,6 +115,7 @@ if_attach(ifp)
p = &((*p)->if_next);
*p = ifp;
ifp->if_index = ++if_index;
+ ifp->if_lastchange = time;
if (ifnet_addrs == 0 || if_index >= if_indexlim) {
unsigned n = (if_indexlim <<= 1) * sizeof(ifa);
struct ifaddr **q = (struct ifaddr **)
@@ -356,6 +357,7 @@ if_down(ifp)
register struct ifaddr *ifa;
ifp->if_flags &= ~IFF_UP;
+ ifp->if_lastchange = time;
for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
if_qflush(&ifp->if_snd);
@@ -373,6 +375,7 @@ if_up(ifp)
{
ifp->if_flags |= IFF_UP;
+ ifp->if_lastchange = time;
#ifdef notyet
register struct ifaddr *ifa;
/* this has no effect on IP, and will kill all iso connections XXX */
@@ -525,6 +528,7 @@ ifioctl(so, cmd, data, p)
(ifr->ifr_flags &~ IFF_CANTCHANGE);
if (ifp->if_ioctl)
(void) (*ifp->if_ioctl)(ifp, cmd, data);
+ ifp->if_lastchange = time;
break;
case SIOCSIFMETRIC:
@@ -532,14 +536,19 @@ ifioctl(so, cmd, data, p)
if (error)
return (error);
ifp->if_metric = ifr->ifr_metric;
+ ifp->if_lastchange = time;
break;
case SIOCSIFPHYS:
error = suser(p->p_ucred, &p->p_acflag);
- if (error) return error;
-
- if (!ifp->if_ioctl) return EOPNOTSUPP;
- return ifp->if_ioctl(ifp, cmd, data);
+ if (error)
+ return error;
+ if (!ifp->if_ioctl)
+ return EOPNOTSUPP;
+ error = (*ifp->if_ioctl)(ifp, cmd, data);
+ if (error == 0)
+ ifp->if_lastchange = time;
+ return(error);
case SIOCSIFMTU:
error = suser(p->p_ucred, &p->p_acflag);
@@ -553,7 +562,10 @@ ifioctl(so, cmd, data, p)
*/
if (ifr->ifr_mtu < 72 || ifr->ifr_mtu > 65535)
return (EINVAL);
- return ((*ifp->if_ioctl)(ifp, cmd, data));
+ error = (*ifp->if_ioctl)(ifp, cmd, data);
+ if (error == 0)
+ ifp->if_lastchange = time;
+ return(error);
case SIOCADDMULTI:
case SIOCDELMULTI:
@@ -562,7 +574,10 @@ ifioctl(so, cmd, data, p)
return (error);
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
- return ((*ifp->if_ioctl)(ifp, cmd, data));
+ error = (*ifp->if_ioctl)(ifp, cmd, data);
+ if (error == 0 )
+ ifp->if_lastchange = time;
+ return(error);
default:
if (so->so_proto == 0)
diff --git a/sys/net/if.h b/sys/net/if.h
index 16a731c..0827f50 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
- * $Id: if.h,v 1.27 1996/01/26 22:09:54 wollman Exp $
+ * $Id: if.h,v 1.28 1996/02/06 18:51:10 wollman Exp $
*/
#ifndef _NET_IF_H_
@@ -100,7 +100,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; /* time of last administrative change */
};
/*
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index ffbcbec..ee08041 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93
- * $Id: if_disc.c,v 1.11 1996/02/06 18:51:11 wollman Exp $
+ * $Id: if_disc.c,v 1.12 1996/04/07 17:39:03 bde Exp $
*/
/*
@@ -118,7 +118,6 @@ dsoutput(ifp, m, dst, rt)
{
if ((m->m_flags & M_PKTHDR) == 0)
panic("dsoutput no HDR");
- ifp->if_lastchange = time;
#if NBPFILTER > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 1c9ddb8..7421541 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
- * $Id: if_ethersubr.c,v 1.16 1996/05/24 01:35:08 julian Exp $
+ * $Id: if_ethersubr.c,v 1.17 1996/06/01 23:23:54 gpalmer Exp $
*/
#include <sys/param.h>
@@ -129,7 +129,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;
rt = rt0;
if (rt) {
if ((rt->rt_flags & RTF_UP) == 0) {
@@ -388,7 +387,6 @@ ether_input(ifp, eh, m)
m_freem(m);
return;
}
- ifp->if_lastchange = time;
ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
sizeof(etherbroadcastaddr)) == 0)
@@ -620,7 +618,7 @@ ether_addmulti(ifr, ac)
struct sockaddr_in *sin;
u_char addrlo[6];
u_char addrhi[6];
- int set_allmulti = 0;
+ int set_allmulti = 0;
int s = splimp();
switch (ifr->ifr_addr.sa_family) {
@@ -691,8 +689,8 @@ ether_addmulti(ifr, ac)
ac->ac_multiaddrs = enm;
ac->ac_multicnt++;
splx(s);
- if (set_allmulti)
- ac->ac_if.if_flags |= IFF_ALLMULTI;
+ if (set_allmulti)
+ ac->ac_if.if_flags |= IFF_ALLMULTI;
/*
* Return ENETRESET to inform the driver that the list has changed
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 0d9ebab..7b80735 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
- * $Id: if_fddisubr.c,v 1.7 1996/04/07 17:39:04 bde Exp $
+ * $Id: if_fddisubr.c,v 1.8 1996/06/01 23:23:55 gpalmer Exp $
*/
#include <sys/param.h>
@@ -132,7 +132,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) {
if ((rt->rt_flags & RTF_UP) == 0) {
if (rt0 = rt = RTALLOC1(dst, 1))
@@ -400,7 +399,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_loop.c b/sys/net/if_loop.c
index acbc822..dfe22e1 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_loop.c 8.1 (Berkeley) 6/10/93
- * $Id: if_loop.c,v 1.19 1996/04/07 17:39:06 bde Exp $
+ * $Id: if_loop.c,v 1.20 1996/05/24 01:35:10 julian Exp $
*/
/*
@@ -137,7 +137,6 @@ looutput(ifp, m, dst, rt)
if ((m->m_flags & M_PKTHDR) == 0)
panic("looutput no HDR");
- ifp->if_lastchange = time;
#if NBPFILTER > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index d1022d3..c1ba804 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -69,7 +69,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
-/* $Id: if_ppp.c,v 1.32 1996/04/07 17:39:08 bde Exp $ */
+/* $Id: if_ppp.c,v 1.33 1996/04/13 12:45:33 bde Exp $ */
/* from if_ppp.c,v 1.5 1995/08/16 01:36:38 paulus Exp */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
@@ -258,6 +258,7 @@ pppdealloc(sc)
if_down(&sc->sc_if);
sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);
+ sc->sc_if.if_lastchange = time;
sc->sc_devp = NULL;
sc->sc_xfer = 0;
for (;;) {
@@ -737,7 +738,6 @@ pppoutput(ifp, m0, dst, rtp)
IF_ENQUEUE(ifq, m0);
(*sc->sc_start)(sc);
}
- sc->sc_if.if_lastchange = time;
splx(s);
return (0);
@@ -1152,7 +1152,6 @@ ppp_inproc(sc, m)
u_int hlen;
sc->sc_if.if_ipackets++;
- sc->sc_if.if_lastchange = time;
if (sc->sc_flags & SC_LOG_INPKT) {
printf("ppp%d: got %d bytes\n", sc->sc_if.if_unit, ilen);
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index e69bc54..3cf39f3 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_sl.c 8.6 (Berkeley) 2/1/94
- * $Id: if_sl.c,v 1.40 1996/05/13 14:09:34 ache Exp $
+ * $Id: if_sl.c,v 1.41 1996/05/13 14:18:18 ache Exp $
*/
/*
@@ -302,6 +302,7 @@ slopen(dev, tp)
s = splnet();
if_up(&sc->sc_if);
+ sc->sc_if.if_lastchange = time;
splx(s);
return (0);
}
@@ -487,7 +488,6 @@ sloutput(ifp, m, dst, rtp)
return (ENOBUFS);
}
IF_ENQUEUE(ifq, m);
- sc->sc_if.if_lastchange = time;
if (sc->sc_ttyp->t_outq.c_cc == 0)
slstart(sc->sc_ttyp);
splx(s);
@@ -595,7 +595,6 @@ slstart(tp)
bpf_tap(&sc->sc_if, bpfbuf, len + SLIP_HDRLEN);
}
#endif
- sc->sc_if.if_lastchange = time;
/*
* If system is getting low on clists, just flush our
@@ -877,7 +876,6 @@ slinput(c, tp)
goto error;
sc->sc_if.if_ipackets++;
- sc->sc_if.if_lastchange = time;
if ((sc->sc_if.if_flags & IFF_UP) == 0) {
m_freem(m);
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index b7ab6ab..b6bee56 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -201,7 +201,6 @@ void sppp_input (struct ifnet *ifp, struct mbuf *m)
struct ifqueue *inq = 0;
int s;
- ifp->if_lastchange = time;
if (ifp->if_flags & IFF_UP)
/* Count received bytes, add FCS and one flag */
ifp->if_ibytes += m->m_pkthdr.len + 3;
@@ -470,7 +469,6 @@ nosupport:
* according to RFC 1333.
*/
ifp->if_obytes += m->m_pkthdr.len + 3;
- ifp->if_lastchange = time;
splx (s);
return (0);
}
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 972b6fe..7efab59 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -104,9 +104,10 @@ tunattach(dummy)
struct ifnet *ifp;
dev_t dev;
- if( tun_devsw_installed ) return;
+ if ( tun_devsw_installed )
+ return;
dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&tun_cdevsw, NULL);
+ cdevsw_add(&dev, &tun_cdevsw, NULL);
tun_devsw_installed = 1;
for ( i = 0; i < NTUN; i++ ) {
#ifdef DEVFS
@@ -193,6 +194,7 @@ tunclose(dev_t dev, int foo, int bar, struct proc *p)
if (ifp->if_flags & IFF_UP) {
s = splimp();
if_down(ifp);
+ ifp->if_lastchange = time;
if (ifp->if_flags & IFF_RUNNING) {
/* find internet addresses and delete routes */
register struct ifaddr *ifa;
@@ -223,6 +225,7 @@ tuninit(unit)
TUNDEBUG("%s%d: tuninit\n", ifp->if_name, ifp->if_unit);
ifp->if_flags |= IFF_UP | IFF_RUNNING;
+ ifp->if_lastchange = time;
for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
if (ifa->ifa_addr->sa_family == AF_INET) {
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index cc46cf8..5915310d 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
-/* $Id: ppp_tty.c,v 1.4 1995/12/14 09:53:20 phk Exp $ */
+/* $Id: ppp_tty.c,v 1.5 1996/01/24 21:09:25 phk Exp $ */
/* from Id: ppp_tty.c,v 1.3 1995/08/16 01:36:40 paulus Exp */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
@@ -248,6 +248,7 @@ pppopen(dev, tp)
sc->sc_outm = NULL;
pppgetm(sc);
sc->sc_if.if_flags |= IFF_RUNNING;
+ sc->sc_if.if_lastchange = time;
sc->sc_if.if_baudrate = tp->t_ospeed;
tp->t_sc = (caddr_t) sc;
@@ -669,7 +670,6 @@ pppstart(tp)
/* 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 (;;) {
OpenPOWER on IntegriCloud