lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #34072] UDP Broadcast is received from wrong UDP PCB i


From: Andreas Becker
Subject: [lwip-devel] [bug #34072] UDP Broadcast is received from wrong UDP PCB if udp_port matches
Date: Fri, 19 Aug 2011 07:25:36 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0

URL:
  <http://savannah.nongnu.org/bugs/?34072>

                 Summary: UDP Broadcast is received from wrong UDP PCB if
udp_port matches
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: abecker
            Submitted on: Fr 19 Aug 2011 07:25:35 GMT
                Category: UDP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

Hi folks,

i have an issue with udp_input() IPV4 at the PCB and IP Matching.

I use two netifs with two UDP PCBs. If I receive a broadcast packet on one
Interface, I want to send this to the other Interface, same UDP Ports.
But at the moment I'll receive the packet with  the wrong UDP-pcb.  Every time
it receives  arrives with the same UDP PCB.

For example
Netif1: ip_addr: 192.168.0.1/24
PCB 1:  local_ip 192.168.0.1 : 1000
Netif2: ip_addr: 192.168.1.1/24
PCB 2:  local_ip 192.168.1.1 : 1000

We receive a Packet for 192.168.1.255:

udp_input(.)
{
      broadcast = ip_addr_isbroadcast(ip_current_dest_addr(), inp);

> Yes it is Broadcast on this Interface.

      for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
            local_match = 0;
...
   
      /* compare PCB local addr+port to UDP destination addr+port */
      if ((pcb->local_port == dest) &&
??
> PORT match

... /* IPV 6*/

           ((
            ((!broadcast && ipX_addr_isany(0, &pcb->local_ip)) ||
            ip_addr_cmp(ipX_2_ip(&pcb->local_ip), ip_current_dest_addr()) ||
#if LWIP_IGMP
            ip_addr_ismulticast(ip_current_dest_addr()) || #endif /* LWIP_IGMP
*/ #if IP_SOF_BROADCAST_RECV
            (broadcast && (pcb->so_options & SOF_BROADCAST)))))) { #else  /*
IP_SOF_BROADCAST_RECV */
            (broadcast))))) {

> YES it is Broadcast but will it be PCB1 or PCB2 ?? --> It could be the wrong
PCB, depending hwo ist first on the linked list.

#endif /* IP_SOF_BROADCAST_RECV */
        local_match = 1;
...
        }

So I suggest, in case of Broadcast, we should match the netif->ip_addr with
the pcb->local_ip:

              ( /* In Broadcast*/
#if IP_SOF_BROADCAST_RECV
            (broadcast && (pcb->so_options & SOF_BROADCAST)) #else  /*
IP_SOF_BROADCAST_RECV */
            (broadcast)
#endif /* IP_SOF_BROADCAST_RECV */
             && ( ip_addr_isany(&pcb->local_ip) ||      /* don't care IP*/
                  ip_addr_cmp(&(pcb->local_ip), &(inp->ip_addr)) /* IF Local IP 
== PCB Local
IP*/ 
                 
                /* In Broadcast*/)

What do You think?





    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/




reply via email to

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