mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 07:08:02 +02:00
wwan: fix checks on IP configuration
Don't call nm_utils_parse_inaddr_bin() if the string returned by mm_bearer_ip_config_get_address() and mm_bearer_ip_config_get_gateway() is NULL, as the function requires a valid pointer. Throw an error if the address is NULL, but allow an empty gateway. Fixes:7837afe87f(cherry picked from commit8ddc6caf98)
This commit is contained in:
parent
b1b463d0dc
commit
f4dc5bd782
1 changed files with 8 additions and 7 deletions
|
|
@ -883,24 +883,25 @@ static_stage3_ip4_done (NMModemBroadband *self)
|
||||||
|
|
||||||
/* Fully fail if invalid IP address retrieved */
|
/* Fully fail if invalid IP address retrieved */
|
||||||
address_string = mm_bearer_ip_config_get_address (self->_priv.ipv4_config);
|
address_string = mm_bearer_ip_config_get_address (self->_priv.ipv4_config);
|
||||||
if (!nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
|
if ( !address_string
|
||||||
|
|| !nm_utils_parse_inaddr_bin (AF_INET, address_string, &address_network)) {
|
||||||
error = g_error_new (NM_DEVICE_ERROR,
|
error = g_error_new (NM_DEVICE_ERROR,
|
||||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||||
"(%s) retrieving IP4 configuration failed: invalid address given '%s'",
|
"(%s) retrieving IP4 configuration failed: invalid address given %s%s%s",
|
||||||
nm_modem_get_uid (NM_MODEM (self)),
|
nm_modem_get_uid (NM_MODEM (self)),
|
||||||
address_string);
|
NM_PRINT_FMT_QUOTE_STRING (address_string));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Missing gateway not a hard failure */
|
/* Missing gateway not a hard failure */
|
||||||
gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
|
gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
|
||||||
if ( !gw_string
|
if ( gw_string
|
||||||
|| !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
|
&& !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
|
||||||
error = g_error_new (NM_DEVICE_ERROR,
|
error = g_error_new (NM_DEVICE_ERROR,
|
||||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||||
"(%s) retrieving IP4 configuration failed: invalid gateway address %s%s%s",
|
"(%s) retrieving IP4 configuration failed: invalid gateway address \"%s\"",
|
||||||
nm_modem_get_uid (NM_MODEM (self)),
|
nm_modem_get_uid (NM_MODEM (self)),
|
||||||
NM_PRINT_FMT_QUOTE_STRING (gw_string));
|
gw_string);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue