autoip address set/reset loop
Subject: Re: autoip address set/reset loop
Hi Daniel,
Well, as said it autoip (APIPA) was not working because of this because it seems to not have assigned any gateway at this stage. This get's assigned in the __connman_connection_gateway_add() function which is called after this DBG(...):
if (!ipconfig->address)
return -EINVAL;
service = __connman_service_lookup_from_index(ipconfig->index); if (!service)
return -EINVAL;
/*
* Gateway is allowed to be NULL here, see
* __connman_connection_gateway_add()
*/
DBG("type %d gw %s peer %s", ipconfig->type, ipconfig->address->gateway ? ipconfig->address->gateway : "NULL", ipconfig->address->peer ? ipconfig->address->peer : "NULL");
if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6 || ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4) return __connman_connection_gateway_add(service, ipconfig->address->gateway, ipconfig->type, ipconfig->address->peer);
In that __connman_connection_gateway_add() function the null gateway is assigned 0.0.0.0, so your commit was effectively blocking that.
Quoted 7 lines · Geoffrey Van Landeghem
Subject: Re: autoip address set/reset loop
Hi Daniel,
Well, as said it autoip (APIPA) was not working because of this because it seems to not have assigned any gateway at this stage. This get's assigned in the
__connman_connection_gateway_add()function which is called after this DBG(...):
My patch fixes a bug but introduced a regression. If you want to fix the regression you need to figure out how to address the original problem: cb05780d86c3 ("ipconfig: Don't add invalid gateway routes")
Just reverting is not okay.
Hi Daniel,
I did watch your commit earlier, but because you say "It's propably a safe bet to say NULL is never a valid GW, so let's filter it out for all callers", that for me seems to be guessing it could have been a bug and it just didn't seem to fix much or anything you saw at runtime. It would have been better to see what runtime issues you fixed with it, because there is nothing for me to hold.
Regarding assigning the invalid /non-routable 0.0.0.0 gateway IP: it basically means there is none, so I don't see the issue. See https://unix.stackexchange.com/questions/94018/what-is-the-meaning-of-0-0-0-0-as-a-gateway#:~:text=on%20this%20post.-,0.0.,there%20is%20no%20intermediate%20hop.
Quoted 14 lines · Daniel Wagner
Quoted 7 lines · Geoffrey Van Landeghem
Subject: Re: autoip address set/reset loop
Hi Daniel,
Well, as said it autoip (APIPA) was not working because of this because it seems to not have assigned any gateway at this stage. This get's assigned in the
__connman_connection_gateway_add()function which is called after this DBG(...):My patch fixes a bug but introduced a regression. If you want to fix the regression you need to figure out how to address the original problem:
cb05780d86c3("ipconfig: Don't add invalid gateway routes")Just reverting is not okay.
Quoted 6 lines · Geoffrey Van Landeghem
I did watch your commit earlier, but because you say "It's propably a safe bet to say NULL is never a valid GW, so let's filter it out for all callers", that for me seems to be guessing it could have been a bug and it just didn't seem to fix much or anything you saw at runtime. It would have been better to see what runtime issues you fixed with it, because there is nothing for me to hold.
My commit fixes the problem that the function inserts a non routable route and things break as the kernel doesn't route correctly. My commit message just expresses that I am guessing that is safe to bail out early. I am not guessing if there is bug.
Quoted 3 lines
Regarding assigning the invalid /non-routable 0.0.0.0 gateway IP: it basically means there is none, so I don't see the issue. See
https://unix.stackexchange.com/questions/94018/what-is-the-meaning-of-0-0-0-0-as-a-gateway#:~:text=on%20this%20post.-,0.0.,there%20is%20no%20intermediate%20hop.
Again, 0.0.0.0 as gateway address is a bug:
Ah! That was the mandatory info I was looking for!
When you say that such gateway address is a bug, then do you mean in general? Because I'd think that in case of IPv4LL at least you need some default route. The RFC also speaks about using 0.0.0.0 for forwarding rules: https://datatracker.ietf.org/doc/rfc3927/
And the current codebase also accepts it:
/*
* If gateway is NULL, it's a point to point link and the default
* gateway for ipv4 is 0.0.0.0 and for ipv6 is ::, meaning the
* interface
*/
if (!gateway && type == CONNMAN_IPCONFIG_TYPE_IPV4) gateway = "0.0.0.0";
if (!gateway && type == CONNMAN_IPCONFIG_TYPE_IPV6) gateway = "::";
Note sure how to proceed next, do you mean we should add an extra check if our IPv4 is LL? Something like this function found in acd.c:
#define LINKLOCAL_ADDR 0xa9fe0000
static bool is_link_local(uint32_t ip)
{
return (ip & LINKLOCAL_ADDR) == LINKLOCAL_ADDR; }
Quoted 4 lines · Daniel Wagner
On Wed, Nov 23, 2022 at 07:27:49PM +0100, Geoffrey Van Landeghem wrote:
Again, 0.0.0.0 as gateway address is a bug:
Quoted 4 lines · Geoffrey Van Landeghem
When you say that such gateway address is a bug, then do you mean in general? Because I'd think that in case of IPv4LL at least you need some default route. The RFC also speaks about using 0.0.0.0 for forwarding rules: https://datatracker.ietf.org/doc/rfc3927/
I completely forgot all details about IPv4LL and now I start to remember why it is so broken. We have the problem that we activate IPv4LL on default and for the VPN interface this causes troubles.
Quoted 8 lines
Note sure how to proceed next, do you mean we should add an extra check if our IPv4 is LL? Something like this function found in
acd.c:#define
LINKLOCAL_ADDR0xa9fe0000
static boolis_link_local(uint32_t ip)
{
return (ip &LINKLOCAL_ADDR) ==LINKLOCAL_ADDR; }
Not sure if this would help. So if we need a default route for an IPv4LL interface we should do this. But I just saw we have also the multihome routing problem but let's ignore this for now.
Changing the default not to enable IPv4LL is also not really nice, as it breaks the current behavior and this might be something embedded systems are relying on to be active.
This leaves us the option to disable IPv4LL for the VPN interfaces. With this we could revert the patch. Either we need to pass this info from the vpn daemon to the core daemon or we can figure the 'subtype' of the interface and just ignore those we don't like...