lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #33128] Socket send() and sendto() do not use bound in


From: Ken MacKay
Subject: [lwip-devel] [bug #33128] Socket send() and sendto() do not use bound interface.
Date: Wed, 20 Apr 2011 16:38:33 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27

Follow-up Comment #3, bug #33128 (project lwip):

Sorry, I don't have a reference, so possibly it's not supposed to work.

The destination is not on the same subnet as any of the device interfaces, so
the selected interface must be used so that the correct gateway will be used.

So for example, suppose we have 2 interfaces on the device: 10.0.0.2 and
10.0.1.2. Both have a netmask of 255.255.255.0. We open a UDP socket bound to
each interface.

>From the socket bound to 10.0.0.2, we want to send to 10.0.0.24. This works
fine because ip_route() finds the correct interface.

>From the socket bound to 10.0.1.2, we want to send to 74.125.127.147. We would
expect that the packet would be sent to the gateway for the 10.0.1.2 interface
(10.0.1.254 in this case), and the gateway would then route the packet
appropriately.

The main issue with the way it currently works is that the packet actually
never gets sent at all if the incorrect interface is selected. The reason is
that there is a check to see if the packet's source address is equal to the
netif's address (around line 560 in udp.c, if (!ip_addr_cmp(&(pcb->local_ip),
&(netif->ip_addr))) { ... ). This means that whenever the interface selected
is not the same one as what the socket was bound to, the packet will not get
sent. This happens for all the packets destined for 74.125.127.147 over the
10.0.1.2 interface. I think this is a general issue?

The current behaviour is to use the default interface (since the destination
IP is not on any interface's subnet), and then send to whatever the gateway is
for the default interface. So it would (for example) choose the 10.0.0.2
interface to send over, and then the packet would get sent to that interface's
gateway (10.0.0.254). This would be bad because the 10.0.0.254 gateway is not
connected to the internet (for example). This could just be an issue for us
because of our crazy network setup (since only one gateway can actually route
to the destination).


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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