[LEDE-DEV] [netifd] Fix incorrect eui64 IPv6 address with ula prefix for br-lan
John Crispin
john at phrozen.org
Tue Dec 12 04:05:26 PST 2017
On 04/12/17 07:04, wendy2001011 at 163.com wrote:
> From: Wendy Wu <wendy2001011 at 163.com>
>
> Issue description:
> Configurate /etc/config/network,
> Set the ula_prefix in globals section,
> config globals 'globals'
> option ula_prefix 'fdc7:8830:f3be::/48'
> Add the following option in 'lan' interface,
> option ip6ifaceid 'eui64'
> Then execute /etc/init.d/network, the br-lan ipv6 address with ula_prefix is incorrect.
> Result see the following, fdc7:8830:f3be:0:200:ff:fe00:0/64 is incorrect address
> root at mygateway:~# ifconfig br-lan
> br-lan Link encap:Ethernet HWaddr E0:B9:E5:66:94:DE
> inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
> inet6 addr: fe80::e2b9:e5ff:fe66:94de/64 Scope:Link
> inet6 addr: fdc7:8830:f3be:0:200:ff:fe00:0/64 Scope:Global
> inet6 addr: 4085:6666:f:e7e0:e2b9:e5ff:fe66:94de/64 Scope:Global
> UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
> RX packets:17 errors:0 dropped:0 overruns:0 frame:0
> TX packets:281 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:2262 (2.2 KiB) TX bytes:111905 (109.2 KiB)
>
> After the fix, fdc7:8830:f3be:0:e2b9:e5ff:fe66:94de/64 is correct address
> See the following,
> root at mygateway:~# ifconfig br-lan
> br-lan Link encap:Ethernet HWaddr E0:B9:E5:66:94:DE
> inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
> inet6 addr: fe80::e2b9:e5ff:fe66:94de/64 Scope:Link
> inet6 addr: 4085:6666:f:b130:e2b9:e5ff:fe66:94de/64 Scope:Global
> inet6 addr: fdc7:8830:f3be:0:e2b9:e5ff:fe66:94de/64 Scope:Global
> UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
> RX packets:2462 errors:0 dropped:0 overruns:0 frame:0
> TX packets:31072 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:115038 (112.3 KiB) TX bytes:12676812 (12.0 MiB)
>
> Root cause:
> When eui64 ipv6 address with ula_prefix for br-lan is created, the lan interface setting has not been ready.
> So The mac address for br-lan is null, and the eui64 address with ula_prefix is incorrect.
>
> Solution:
> Put the ula_prefix global initial part after device pending
>
> Signed-off-by: wendy wu <wendy2001011 at 163.com>
> ---
> config.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/config.c b/config.c
> index 21791af..a494e84 100644
> --- a/config.c
> +++ b/config.c
> @@ -310,10 +310,6 @@ config_init_globals(void)
> if (!globals)
> return;
>
> - const char *ula_prefix = uci_lookup_option_string(
> - uci_ctx, globals, "ula_prefix");
> - interface_ip_set_ula_prefix(ula_prefix);
> -
> const char *default_ps = uci_lookup_option_string(
> uci_ctx, globals, "default_ps");
>
> @@ -324,6 +320,21 @@ config_init_globals(void)
> config_parse_global_ps_val(globals, "default_rps_flow_cnt"));
> }
>
> +static void
> +config_init_globals_ula(void)
> +{
> + struct uci_section *globals = uci_lookup_section(
> + uci_ctx, uci_network, "globals");
> + if (!globals)
> + return;
> +
> + const char *ula_prefix = uci_lookup_option_string(
> + uci_ctx, globals, "ula_prefix");
> +
> + interface_ip_set_ula_prefix(ula_prefix);
> +
> +}
> +
> static void
> config_parse_wireless_device(struct uci_section *s)
> {
> @@ -447,6 +458,7 @@ config_init_all(void)
>
> device_reset_old();
> device_init_pending();
> + config_init_globals_ula();
@Hans: can we just move config_init_globals() here ?
John
> vlist_flush(&interfaces);
> device_free_unused(NULL);
> interface_refresh_assignments(false);
More information about the Lede-dev
mailing list