lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] UDP Input with wrong PCB


From: Ivan Delamer
Subject: Re: [lwip-devel] UDP Input with wrong PCB
Date: Thu, 18 Aug 2011 11:09:53 -0600 (MDT)
User-agent: SquirrelMail/1.4.9a

Andreas,

You may be on to something here. I suggest posting a bug in savannah.

I will also look into it from IPv6 perspective since there might be a
similar issue with link-local all-hosts multicast packets (no broadcast in
IPv6).

Cheers
Ivan



> Date: Thu, 18 Aug 2011 11:26:31 +0200
> From: "Becker, Andreas" <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [lwip-devel] UDP Input with wrong PCB
> Message-ID:
>       <address@hidden>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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 from 192.168.1.255:
>
> udp_input(.)
> {
>       broadcast = ip_addr_isbroadcast(ip_current_dest_addr(), inp);
>
>> Yes it is Broadcast.
>
>       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.
>
> #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?
>
> Best Regards,
> Andreas.
>
>
> i.A. Andreas Becker
> Entwicklung Embedded
> ________________________________
> SE-Elektronic GmbH
> Eythstrasse 16
> 73037 G?ppingen
> Deutschland
>
> Fon +49 (7161) 9584-0
> Fax +49 (7161) 9584-30
> address@hidden
> www.se-elektronic.de
>
> Gesch?ftsf?hrer:
> Bogomir Dajcman
> Hermann Lippert
>
> Sitz der Gesellschaft: G?ppingen
> Handelsregister:       Amtsgericht Ulm HRB Nr. 531354
>
>
>
>
> ------------------------------
>
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-devel
>
>
> End of lwip-devel Digest, Vol 86, Issue 8
> *****************************************
>





reply via email to

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