lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9169] Allows multicast packets through udp input la


From: Alex Moran
Subject: [lwip-devel] [patch #9169] Allows multicast packets through udp input layer
Date: Mon, 21 Nov 2016 19:49:53 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

URL:
  <http://savannah.nongnu.org/patch/?9169>

                 Summary: Allows multicast packets through udp input layer
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: alex081293
            Submitted on: Mon 21 Nov 2016 07:49:51 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

If user opens a raw socket to a multicast address, the current udp layer drops
the packet because it's only looking if remote ip address is any value or if
the pcb remote address is equal to the packet source address. In the case of
multicast traffic, the packet source is irrelevant the critical info is if the
packet destination is equal to the pcb remote ip.

I propose adding an extra condition on lines 291-295:
  ...
  if (((pcb->remote_port == src) || (pcb->remote_port == 0)) &&
     (ip_addr_isany_val(pcb->remote_ip) ||
     ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr())
  // PATCH - Allow multicast packets
#if LWIP_IGMP
     || (ip_addr_ismulticast(&(pcb->remote_ip)) &&
(ip_addr_cmp(&(pcb->remote_ip), &current_iphdr_dest)))
#endif
   )) { 
   ...

So that the device can open a socket like so:

   ...
   struct ip_addr multicast_addr;
   IP4_ADDR(&multicast_addr,  239, 1, 80, 1);
   int mPort= 12032;

   udp_bind(this->pcb, IP_ADDR_ANY, mPort);
   udp_connect(this->pcb, &(multicast_addr), 0);
   ...


And receive all multicast traffic aimed at address 239.1.80.1 to port 12032
regardless the ip src.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9169>

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




reply via email to

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