Added define NETIF_INIT_SNMP(type, speed) to initialize per-netif snmp variables, added initialization of those to slipif and loopif.

This commit is contained in:
goldsimon 2007-06-08 17:17:41 +00:00
parent b7e4d2a8ff
commit 945460c67e
5 changed files with 39 additions and 14 deletions

View File

@ -19,6 +19,11 @@ HISTORY
++ New features:
2007-05-18 Simon Goldschmidt
* netif.h, ethernetif.c, slipif.c, loopif.c: Added define
NETIF_INIT_SNMP(type, speed) to initialize per-netif snmp variables, added
initialization of those to slipif and loopif.
2007-05-18 Simon Goldschmidt
* opt.h, ip_frag.c, ip_frag.h, ip.c: Added option IP_FRAG_USES_STATIC_BUF
(defaulting to off for now) that can be set to 0 to send fragmented

View File

@ -150,6 +150,26 @@ struct netif {
#endif /* LWIP_IGMP */
};
#if LWIP_SNMP
#define NETIF_INIT_SNMP(type, speed) \
/* ifType ethernetCsmacd(6) @see RFC1213 */ \
netif->link_type = type; \
/* your link speed here */ \
netif->link_speed = speed; \
netif->ts = 0; \
netif->ifinoctets = 0; \
netif->ifinucastpkts = 0; \
netif->ifinnucastpkts = 0; \
netif->ifindiscards = 0; \
netif->ifoutoctets = 0; \
netif->ifoutucastpkts = 0; \
netif->ifoutnucastpkts = 0; \
netif->ifoutdiscards = 0
#else /* LWIP_SNMP */
#define NETIF_INIT_SNMP(type, speed)
#endif /* LWIP_SNMP */
/** The list of network interfaces. */
extern struct netif *netif_list;
/** The default network interface. */

View File

@ -341,22 +341,9 @@ ethernetif_init(struct netif *netif)
netif->hostname = "lwip";
#endif /* LWIP_NETIF_HOSTNAME */
#if LWIP_SNMP
/* initialize the snmp variables and counters inside the struct netif */
/* ifType ethernetCsmacd(6) @see RFC1213 */
netif->link_type = 6;
/* your link speed here */
netif->link_speed = ;
netif->ts = 0;
netif->ifinoctets = 0;
netif->ifinucastpkts = 0;
netif->ifinnucastpkts = 0;
netif->ifindiscards = 0;
netif->ifoutoctets = 0;
netif->ifoutucastpkts = 0;
netif->ifoutnucastpkts = 0;
netif->ifoutdiscards = 0;
#endif /* LWIP_SNMP */
NETIF_INIT_SNMP(6, ???);
netif->state = ethernetif;
netif->name[0] = IFNAME0;

View File

@ -196,6 +196,12 @@ loopif_init(struct netif *netif)
netif->state = priv;
#endif /* LWIP_LOOPIF_MULTITHREADING */
/* initialize the snmp variables and counters inside the struct netif
* ifType: softwareLoopback(24) @see RFC1213
* ifSpeed: no assumption can be made!
*/
NETIF_INIT_SNMP(24, 0);
netif->name[0] = 'l';
netif->name[1] = 'o';
netif->output = loopif_output;

View File

@ -253,6 +253,13 @@ slipif_init(struct netif *netif)
return ERR_IF;
}
/* initialize the snmp variables and counters inside the struct netif
* ifType: we're using propPointToPointSerial(22) @see RFC1213
* ifSpeed: no assumption can be made without knowing more about the
* serial line!
*/
NETIF_INIT_SNMP(22, 0);
/* Create a thread to poll the serial line. */
sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);
return ERR_OK;