Add a new variable, ifi_epoch, to struct if_data. It is set to the last

time the interface counters were zeroed, currently the time if_attach()
was called.  It is indentended to be a valid value for RFC2233's
ifCounterDiscontinuityTime and to make it easier for applications to
verify that the interface they find at a given index is the one that was
there last time they looked.

An if_epoch "compatability" macro has not been created as ifi_epoch has
never been a member of struct ifnet.

Approved by:	andre, bms, wollman
This commit is contained in:
Brooks Davis 2004-08-30 06:29:26 +00:00
parent d91a18bc4c
commit 1fc4519b1d
4 changed files with 8 additions and 1 deletions

View File

@ -23,6 +23,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW:
developers choose to disable these features on build machines developers choose to disable these features on build machines
to maximize performance. to maximize performance.
20040830:
A new variable, ifi_epoch, has been added to struct if_data
which is part if struct ifnet. This means all network drivers
and network monitoring applications need to be recompiled.
20040828: 20040828:
The default configuration for the network stack has been changed The default configuration for the network stack has been changed
such that it now runs without the Giant lock unless configured such that it now runs without the Giant lock unless configured

View File

@ -387,6 +387,7 @@ if_attach(struct ifnet *ifp)
TAILQ_INIT(&ifp->if_multiaddrs); TAILQ_INIT(&ifp->if_multiaddrs);
knlist_init(&ifp->if_klist, NULL); knlist_init(&ifp->if_klist, NULL);
getmicrotime(&ifp->if_lastchange); getmicrotime(&ifp->if_lastchange);
getmicrotime(&ifp->if_data.ifi_epoch);
#ifdef MAC #ifdef MAC
mac_init_ifnet(ifp); mac_init_ifnet(ifp);

View File

@ -103,6 +103,7 @@ struct if_data {
u_long ifi_hwassist; /* HW offload capabilities */ u_long ifi_hwassist; /* HW offload capabilities */
u_long ifi_unused; /* XXX was ifi_xmittiming */ u_long ifi_unused; /* XXX was ifi_xmittiming */
struct timeval ifi_lastchange; /* time of last administrative change */ struct timeval ifi_lastchange; /* time of last administrative change */
struct timeval ifi_epoch; /* time of creation or stat reset */
}; };
#define IFF_UP 0x1 /* interface is up */ #define IFF_UP 0x1 /* interface is up */

View File

@ -57,7 +57,7 @@
* is created, otherwise 1. * is created, otherwise 1.
*/ */
#undef __FreeBSD_version #undef __FreeBSD_version
#define __FreeBSD_version 600001 /* Master, propagated to newvers */ #define __FreeBSD_version 600002 /* Master, propagated to newvers */
#ifndef LOCORE #ifndef LOCORE
#include <sys/types.h> #include <sys/types.h>