From 3ccf847284e7b946995b2b82cf318c2a4027a24d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 28 Nov 2023 12:47:17 +0000 Subject: bearer-mbim: warn and workaround wrong link prefix length in static IPv6 config Seems to happen with e.g. the Fibocom FM350: # mmcli -b 2 ------------------------------------ IPv6 configuration | method: static | address: 2607:fb90:dd16:d38a:ac39:89f1:67a7:5a9d | prefix: 128 | gateway: 2607:fb90:dd16:d38a:ac39:89f1:67a7:5a01 | dns: fd00:976a::9, fd00:976a::10 | mtu: 1436 --- src/mm-bearer-mbim.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c index 03eb3789..7988a080 100644 --- a/src/mm-bearer-mbim.c +++ b/src/mm-bearer-mbim.c @@ -563,6 +563,14 @@ ip_configuration_query_ready (MbimDevice *device, /* Netmask */ mm_bearer_ip_config_set_prefix (ipv6_config, ipv6address[0]->on_link_prefix_length); + /* If the modem has done SLAAC itself, it is never expected to return a /128 prefix, + * warn if it happens and workaround it. Use /64 as default. */ + if ((mm_bearer_ip_config_get_method (ipv6_config) == MM_BEARER_IP_METHOD_STATIC) && + (mm_bearer_ip_config_get_prefix (ipv6_config) == 128)) { + mm_obj_warn (self, "unexpected link prefix returned with global IPv6 address (128): ignoring"); + mm_bearer_ip_config_set_prefix (ipv6_config, 64); + } + /* Gateway */ if (ipv6configurationavailable & MBIM_IP_CONFIGURATION_AVAILABLE_FLAG_GATEWAY) { g_autoptr(GInetAddress) gw_addr = NULL; -- cgit v1.2.3-70-g09d2