lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Sending to a non-local network without default netif se


From: Fabian Koch
Subject: Re: [lwip-users] Sending to a non-local network without default netif set
Date: Fri, 8 Aug 2014 07:25:31 +0000

Hey Mark, Simon,

well it does work when introducing the source address in the routing algorithm 
and thats what I did for now.
But obviously, Simon is right: routing doesn't have anything to do with the 
source address and it shouldn't have to.

The underlying problem in LwIP at the moment is that the ip_route() function is 
used to determine the netif that we should be sending on when it's not already 
clear and that leads to most of the problems, because in that early state of 
determining

There are several functions where LwIP uses the output of ip_route() to find a 
local interface to send on. And in those cases, it actually _should_ consider 
the source address (meaning the bind() address). When actually _sending_ the 
packet, the ip_route() should work as usual like any routing algorithm does. 
Only based on destination.

Ip_route() is used in a few places other than the IP layer to determine the 
local netif to send on:
    in udp_connect()
    in udp_sendto()
    in tcp_eff_send_mss()
    in snmp_send_trap()
    in etharp_add_static_entry()

Essentially, those placed need to get a different function which considers more 
info than ip_route().
Then you also do not need to touch both the ipv6 and the ipv4 version of the 
route function.

But yeah, if you need a quick solution that doesn't quite "feel" right, using 
the source address in ip_route() is a way to go for now ;o)

Cheers,
Fabian

PS: I also wrote an open issue about this on my experimental fork of lwip on 
github:
https://github.com/tabascoeye/lwip/issues/5
(pull-requests are welcomed)



reply via email to

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