[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] New netif link_up/up behaviour and PPP
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-devel] New netif link_up/up behaviour and PPP |
Date: |
Sat, 7 Mar 2015 20:50:50 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello Simon,
On Sat, Mar 07, 2015 at 08:17:08PM +0100, address@hidden wrote:
> Hi Sylvain
>
> the 2 changes in lwIP's behaviour are that:
> a) netif_set_link_up() is not called implicitly by dhcp/autoip and
netif_set_up() ;-)
> 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.
This change is great, we should absolutely never change the
administrative status of an interface, that's a user controlled flag. It
might explain why I didn't fully understand this UP flag previously and
I am probably not the only one, this was indeed confusing.
> 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 fully agree.
> I'm not sure how IPv6 handles the "no address" case though...
Neither do I, I added a task so we don't forget to check.
> 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,
Yeah, I am going for netif_link_up(), administrative flag of an
interface should not be changed by PPP.
I even wonder if I should set the interface administratively enabled by
default in the PPP netif init callback, that's not the case for
"Ethernet" netif after all and we require the user to set their netif
administratively enabled, why not for PPP as well ?
> but both of them need to be independent of IPv4/IPv6 "address
> assigned" to not let one depend on the other.
Yep, that's currently done correctly, and I am going to improve that,
PPP keep track of the number of enabled protocols in a reference counter
which controls the PPP running state, I should probably use that instead
of flags ;)
> 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.
I also need to clear IPv4 and IPv6 addresses during PPP disconnect if I
understand correctly, this wasn't the case until now, or is
netif_set_link_down() will be enough to prevent routing ? (when support
for conditionnal link up/down routing will be added of course)
> > 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.
Yeah, I guesss I will keep the flag to refuse IP/IPv6 packets while PPP
is not in running phase.
Thank you very much Simon about the detailed explanation on a point I
failed to fully understand ! :)
Sylvain
signature.asc
Description: Digital signature