interface-ip: add unreachable route if address is offlink openwrt-19.07
authorHans Dedecker <dedeckeh@gmail.com>
Sat, 9 Jan 2021 20:18:45 +0000 (21:18 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Wed, 20 Jan 2021 19:58:23 +0000 (20:58 +0100)
commit753c351bc729967a691d99e27693be5aec334028
tree0dac76f1f5862d28ed2be02845ac611cdca19591
parent5e02f94411b06f192fb2a7d9be9abde3549153a8
interface-ip: add unreachable route if address is offlink

In order to avoid a routing loop add an unreachable route for the
address prefix is the offlink flag is set for an address.
This fixes a routing loop which is currently present on point-to-point
links (e.g PPP) when the wan interface is assigned a globally unique
prefix (e.g. 2001:db8:1:0::/64) from which an IPv6 address is picked
and installed on the wan interface
(e.g. 2001:db8:1:0:5054:ff:feab:d87c/64)

The prefix route 2001:db8:1::/64 would be present in the routing table
which will route any packet with as destination 2001:db8:1::/64 to the wan
interface and would be routed back by the upstream router due to the
wan interface due to the assigned global unique prefix.
Besides not installing the prefix route 2001:db8:1::/64 on point-to-point links
adding an unreachable route is required to avoid the routing loop.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
(cherry picked from commit c00c8335d6188daa326ecfe5a62da15a9b9987e1)
interface-ip.c