lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #44608] connectionless UDP dst address not being check


From: Joel Cunningham
Subject: [lwip-devel] [bug #44608] connectionless UDP dst address not being checked within udp_input
Date: Thu, 27 Aug 2015 21:01:23 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0

Follow-up Comment #2, bug #44608 (project lwip):

I agree OP's patch is incorrect, but I believe he spotted a bug if we are
adhering to traditional BSD sockets multicast semantics.

In BSD, you can only receive multicast on a socket bound to the multicast
group or INADDR_ANY as long as IP_ADD_MEMBERSHIP has been enabled.

http://stackoverflow.com/questions/10692956/what-does-it-mean-to-bind-a-multicast-udp-socket

The logic here I think is missing a single check:

/* compare PCB local addr+port to UDP destination addr+port */
if (pcb->local_port == dest) {
  if (
     (!broadcast && ip_addr_isany(&pcb->local_ip)) ||
     ip_addr_cmp(&(pcb->local_ip), &current_iphdr_dest) ||
#if LWIP_IGMP
     ip_addr_ismulticast(&current_iphdr_dest) ||
#endif /* LWIP_IGMP */
     ...

1) Binding to the multicast group is satisfied by comparing pcb->local_ip to
current_iphdr_dest

2) Handling for the second case needs to include a check for INADDR_ANY. 
Under #if LWIP_IGMP, we need:

ip_addr_isany(&pcb->local_ip) && ip_addr_ismulticast(&current_iphdr_dest)

Without the INADDR any check, any socket whether it's bound to another
multicast group (the case of OP) or a netif, or a broadcast address, would
receive it.



    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?44608>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]