wwan: perform SLAAC and DNS assignment when IPv6 is on auto method

This allows SLAAC for IPv6 to be performed, even when no IPv6
address was passed by the bearer. The link-local address will be
assigned, because of do_auto = TRUE.

The commit also allows the DNS assignment to be made statically when
no IPv6 address has been statically assigned yet. This is to be able
to receive IPv6 DNS servers via signalling, where host SLAAC still
needs to be performed for some modems (e.g. some huawei modems).

This also changes the logging so that SLAAC usage is logged
on a separate line.
This commit is contained in:
Pavel Valach
2024-04-12 21:31:13 +00:00
committed by Beniamino Galvani
parent 495a64cc3c
commit 498142d942
2 changed files with 28 additions and 24 deletions

2
NEWS
View File

@@ -16,6 +16,8 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Deprecated 802-11-wireless and 802-11-wired property 'mac-address-blacklist'
and introduced the 'mac-address-denylist' property.
* Fix detection of 6 GHz band capability for WiFi devices
* Allow IPv6 SLAAC and static IPv6 DNS server assignment for modem broadband
when IPv6 device address was not explicitly passed on by ModemManager
=============================================
NetworkManager-1.46

View File

@@ -1167,20 +1167,8 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho
NM_DEVICE_ERROR_INVALID_CONNECTION,
"(%s) retrieving IPv6 configuration failed: no address given",
nm_modem_get_uid(NM_MODEM(self)));
goto out;
}
goto out;
}
address = (NMPlatformIP6Address){};
if (!inet_pton(AF_INET6, address_string, &address.address)) {
g_set_error(&error,
NM_DEVICE_ERROR,
NM_DEVICE_ERROR_INVALID_CONNECTION,
"(%s) retrieving IPv6 configuration failed: invalid address given '%s'",
nm_modem_get_uid(NM_MODEM(self)),
address_string);
goto out;
}
data_port = mm_bearer_get_interface(self->_priv.bearer);
@@ -1204,19 +1192,33 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho
NM_IP_CONFIG_SOURCE_WWAN);
do_auto = TRUE;
address.plen = mm_bearer_ip_config_get_prefix(self->_priv.ipv6_config);
if (address.plen <= 128) {
if (IN6_IS_ADDR_LINKLOCAL(&address.address)) {
nm_utils_ipv6_interface_identifier_get_from_addr(&iid_data, &address.address);
iid = &iid_data;
} else
do_auto = FALSE;
nm_l3_config_data_add_address_6(l3cd, &address);
if (address_string) {
address = (NMPlatformIP6Address){};
if (!inet_pton(AF_INET6, address_string, &address.address)) {
g_set_error(&error,
NM_DEVICE_ERROR,
NM_DEVICE_ERROR_INVALID_CONNECTION,
"(%s) retrieving IPv6 configuration failed: invalid address given '%s'",
nm_modem_get_uid(NM_MODEM(self)),
address_string);
goto out;
}
address.plen = mm_bearer_ip_config_get_prefix(self->_priv.ipv6_config);
if (address.plen <= 128) {
if (IN6_IS_ADDR_LINKLOCAL(&address.address)) {
nm_utils_ipv6_interface_identifier_get_from_addr(&iid_data, &address.address);
iid = &iid_data;
} else
do_auto = FALSE;
nm_l3_config_data_add_address_6(l3cd, &address);
}
_LOGI(" address %s", nm_platform_ip6_address_to_string(&address, sbuf, sizeof(sbuf)));
}
_LOGI(" address %s (slaac %s)",
nm_platform_ip6_address_to_string(&address, sbuf, sizeof(sbuf)),
do_auto ? "enabled" : "disabled");
_LOGI(" slaac %s", do_auto ? "enabled" : "disabled");
gw_string = mm_bearer_ip_config_get_gateway(self->_priv.ipv6_config);
if (gw_string) {