[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] New netif link_up/up behaviour and PPP
From: |
address@hidden |
Subject: |
Re: [lwip-devel] New netif link_up/up behaviour and PPP |
Date: |
Sat, 07 Mar 2015 20:17:08 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
Hi Sylvain
the 2 changes in lwIP's behaviour are that:
a) netif_set_link_up() is not called implicitly by dhcp/autoip and
b) IPv4 routing does not select a netif that has no IP address assigned
(i.e. netif->ip_addr is "0.0.0.0")
The latter was previously solved by setting the netif up or down, but
this technique clearly doesn't work for dual-stack mode, so it had to be
changed.
Link up/down state is currently not checked by routing, but this will be
changed for 1.5.0, too, since not checking the link state breaks routing
as well (at least if there are multiple ways to reach a destination and
one of them has no link).
I'm not sure how IPv6 handles the "no address" case though...
However, for PPP, this means that you still can set either netif_up or
netif_link_up i.e. when the PPP session is established, but both of them
need to be independent of IPv4/IPv6 "address assigned" to not let one
depend on the other.
Sylvain Rochet wrote:
If I understand correctly I should call netif_set_up() once for all in
the init netif callback and call netif_set_down() in the ppp_free()
function. Is doing netif->flags = NETIF_FLAG_UP; and netif->flags = 0;
instead is ok for the PPP case ?
Once a protocol is running (IPv4 or IPv6), I should now call
netif_set_link_up() and when all protocols are stopped I should now call
netif_set_link_down().
I guess that will do, yes.
Are netif->output and netif->output_ip6 callbacks are guaranteed to
never ever be called on a netif currently in link down state ? If true,
I can remove some checks in the PPP ip4 and ip6 netif output callbacks.
No, not really. Both flags are essentially only used in routing.
However, functions like udp_sendto_if() could still send to any netif.
Whether that makes sense is a different question, but I wouldn't remove
the check for a correct state.
Simon