fixed bug #43596 IGMP queries from 0.0.0.0 are discarded

This commit is contained in:
sg 2014-12-09 20:56:39 +01:00
parent 1bf2e313f6
commit f38352f1af
2 changed files with 18 additions and 4 deletions

View File

@ -139,6 +139,9 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2014-12-09: Simon Goldschmidt
* ip4.c: fixed bug #43596 IGMP queries from 0.0.0.0 are discarded
2014-10-21: Simon Goldschmidt (patch by Joel Cunningham and Albert Huitsing) 2014-10-21: Simon Goldschmidt (patch by Joel Cunningham and Albert Huitsing)
* sockts.c: fixed bugs #41495 Possible threading issue in select() and #43278 * sockts.c: fixed bugs #41495 Possible threading issue in select() and #43278
event_callback() handle context switch when calling sys_sem_signal() event_callback() handle context switch when calling sys_sem_signal()

View File

@ -301,9 +301,9 @@ ip_input(struct pbuf *p, struct netif *inp)
struct netif *netif; struct netif *netif;
u16_t iphdr_hlen; u16_t iphdr_hlen;
u16_t iphdr_len; u16_t iphdr_len;
#if IP_ACCEPT_LINK_LAYER_ADDRESSING #if IP_ACCEPT_LINK_LAYER_ADDRESSING || LWIP_IGMP
int check_ip_src=1; int check_ip_src = 1;
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ #endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING || LWIP_IGMP */
IP_STATS_INC(ip.recv); IP_STATS_INC(ip.recv);
snmp_inc_ipinreceives(); snmp_inc_ipinreceives();
@ -381,6 +381,13 @@ ip_input(struct pbuf *p, struct netif *inp)
#if LWIP_IGMP #if LWIP_IGMP
if (ip_addr_ismulticast(ip_current_dest_addr())) { if (ip_addr_ismulticast(ip_current_dest_addr())) {
if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group(inp, ip_current_dest_addr()))) { if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group(inp, ip_current_dest_addr()))) {
/* IGMP snooping switches need 0.0.0.0 to be allowed as source address (RFC 4541) */
ip_addr_t allsystems;
IP4_ADDR(&allsystems, 224, 0, 0, 1);
if (ip_addr_cmp(ip_current_dest_addr(), &allsystems) &&
ip_addr_isany(ip_current_src_addr())) {
check_ip_src = 0;
}
netif = inp; netif = inp;
} else { } else {
netif = NULL; netif = NULL;
@ -461,10 +468,14 @@ ip_input(struct pbuf *p, struct netif *inp)
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ #endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */ /* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
#if LWIP_IGMP || IP_ACCEPT_LINK_LAYER_ADDRESSING
if (check_ip_src
#if IP_ACCEPT_LINK_LAYER_ADDRESSING #if IP_ACCEPT_LINK_LAYER_ADDRESSING
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */ /* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
if (check_ip_src && !ip_addr_isany(ip_current_src_addr())) && !ip_addr_isany(ip_current_src_addr())
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ #endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
)
#endif /* LWIP_IGMP || IP_ACCEPT_LINK_LAYER_ADDRESSING */
{ if ((ip_addr_isbroadcast(ip_current_src_addr(), inp)) || { if ((ip_addr_isbroadcast(ip_current_src_addr(), inp)) ||
(ip_addr_ismulticast(ip_current_src_addr()))) { (ip_addr_ismulticast(ip_current_src_addr()))) {
/* packet source is not valid */ /* packet source is not valid */