Bug#941026: netcfg_gateway_reachable wrongly rejects IPv6 link-local addresses

2019-10-09 Thread Andrew Kanaber
On Wed, Oct 02, 2019 at 08:27:34AM +0200, Philipp Kern wrote:
> On 2019-09-23 18:00, Andrew Kanaber wrote:
> > When doing static IP configuration, netcfg will reject a gateway address
> > outside the host's network as defined by the netmask.
> So how does it identify the interface to use in this case? Does the kernel
> have special support to pick the correct one if there is only one
> non-loopback interface? Generally link-local addresses do need to be
> qualified with the interface to be used.

The routing table entry contains both the gateway address and the interface to
use. When the kernel decides to use the route it has everything it needs.

Using a link-local gateway is an entirely standard thing to do. It would have
been reasonable for netcfg to reject link-local addresses entered as the actual
host address - but it doesn't check for that, it just does this netmask check
that happens to reject global unicast host address plus link-local gateway.

Thanks,

Andrew



Bug#941026: netcfg_gateway_reachable wrongly rejects IPv6 link-local addresses

2019-10-02 Thread Philipp Kern

On 2019-09-23 18:00, Andrew Kanaber wrote:
When doing static IP configuration, netcfg will reject a gateway 
address
outside the host's network as defined by the netmask. This is wrong for 
IPv6
because the gateway can legitimately be a link-local address in 
fe80::/64
instead of the host's network range. Ubuntu have fixed this bug in 
their

version, see LP#1382295
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/1382295

The relevant function is netcfg_gateway_reachable in netcfg-common.c 
which
simply checks gateway_address & netmask == host_address. It should also 
allow

IPv6 addresses in the link local prefix fe80::/64.

Less importantly, the error message it triggers could be a bit clearer, 
"The
gateway address you entered is unreachable" sounds like it might be a 
network

error when it's purely a user-input parsing rejection - if the code had
actually tried the link-local address it would've worked.


So how does it identify the interface to use in this case? Does the 
kernel have special support to pick the correct one if there is only one 
non-loopback interface? Generally link-local addresses do need to be 
qualified with the interface to be used.


Kind regards
Philipp Kern



Bug#941026: netcfg_gateway_reachable wrongly rejects IPv6 link-local addresses

2019-09-23 Thread Andrew Kanaber
Package: netcfg
Version: 1.160
Severity: normal

When doing static IP configuration, netcfg will reject a gateway address
outside the host's network as defined by the netmask. This is wrong for IPv6
because the gateway can legitimately be a link-local address in fe80::/64
instead of the host's network range. Ubuntu have fixed this bug in their
version, see LP#1382295
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/1382295

The relevant function is netcfg_gateway_reachable in netcfg-common.c which
simply checks gateway_address & netmask == host_address. It should also allow
IPv6 addresses in the link local prefix fe80::/64.

Less importantly, the error message it triggers could be a bit clearer, "The
gateway address you entered is unreachable" sounds like it might be a network
error when it's purely a user-input parsing rejection - if the code had
actually tried the link-local address it would've worked. 

Thanks for your help,

Andrew Kanaber