diff --git a/CHANGELOG b/CHANGELOG index 27f86da1..585e7457 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -131,6 +131,10 @@ HISTORY ++ Bugfixes: + 2010-02-15: Simon Goldschmidt/Stephane Lesage + * netif.c/.h: Link status does not depend on LWIP_NETIF_LINK_CALLBACK + (fixes bug #28899) + 2010-02-14: Simon Goldschmidt * netif.c: Fixed bug #28877 (Duplicate ARP gratuitous packet with LWIP_NETIF_LINK_CALLBACK set on) by only sending if both link- and diff --git a/src/core/netif.c b/src/core/netif.c index de1959e0..ffadc5fb 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -61,15 +61,15 @@ #endif /* LWIP_DHCP */ #if LWIP_NETIF_STATUS_CALLBACK -#define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); } +#define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0) #else -#define NETIF_STATUS_CALLBACK(n) { /* NOP */ } +#define NETIF_STATUS_CALLBACK(n) #endif /* LWIP_NETIF_STATUS_CALLBACK */ #if LWIP_NETIF_LINK_CALLBACK -#define NETIF_LINK_CALLBACK(n) { if (n->link_callback) (n->link_callback)(n); } +#define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0) #else -#define NETIF_LINK_CALLBACK(n) { /* NOP */ } +#define NETIF_LINK_CALLBACK(n) #endif /* LWIP_NETIF_LINK_CALLBACK */ struct netif *netif_list; @@ -502,7 +502,6 @@ void netif_set_status_callback(struct netif *netif, netif_status_callback_fn sta } #endif /* LWIP_NETIF_STATUS_CALLBACK */ -#if LWIP_NETIF_LINK_CALLBACK /** * Called by a driver when its link goes up */ @@ -553,6 +552,7 @@ void netif_set_link_down(struct netif *netif ) } } +#if LWIP_NETIF_LINK_CALLBACK /** * Set callback to be called when link is brought up/down */ diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index 0bf8ec13..c2719aac 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -2497,7 +2497,6 @@ ifentry_get_value(struct obj_def *od, u16_t len, void *value) ocstrncpy((u8_t*)value, netif->hwaddr, len); break; case 7: /* ifAdminStatus */ -#if LWIP_NETIF_LINK_CALLBACK { s32_t *sint_ptr = (s32_t*)value; if (netif_is_up(netif)) @@ -2517,7 +2516,6 @@ ifentry_get_value(struct obj_def *od, u16_t len, void *value) } } break; -#endif case 8: /* ifOperStatus */ { s32_t *sint_ptr = (s32_t*)value; diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 6b993eed..a8790b5f 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -80,8 +80,7 @@ extern "C" { * (set by the network interface driver). * Either set by the netif driver in its init function (if the link * is up at that time) or at a later point once the link comes up - * (if link detection is supported by the hardware). - * Only really used with LWIP_NETIF_LINK_CALLBACK. */ + * (if link detection is supported by the hardware). */ #define NETIF_FLAG_LINK_UP 0x10U /** If set, the netif is an ethernet device using ARP. * Set by the netif driver in its init function. @@ -279,18 +278,15 @@ void netif_set_down(struct netif *netif); #define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) #if LWIP_NETIF_STATUS_CALLBACK -/* - * Set callback to be called when interface is brought up/down - */ void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback); #endif /* LWIP_NETIF_STATUS_CALLBACK */ -#if LWIP_NETIF_LINK_CALLBACK void netif_set_link_up(struct netif *netif); void netif_set_link_down(struct netif *netif); /** Ask if a link is up */ #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) +#if LWIP_NETIF_LINK_CALLBACK void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback); #endif /* LWIP_NETIF_LINK_CALLBACK */