mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 22:20:08 +01: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
This commit is contained in:
parent
5fff928a6b
commit
8ddc6caf98
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 */
|
||||
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,
|
||||
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)),
|
||||
address_string);
|
||||
NM_PRINT_FMT_QUOTE_STRING (address_string));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Missing gateway not a hard failure */
|
||||
gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
|
||||
if ( !gw_string
|
||||
|| !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
|
||||
if ( gw_string
|
||||
&& !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
|
||||
error = g_error_new (NM_DEVICE_ERROR,
|
||||
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_PRINT_FMT_QUOTE_STRING (gw_string));
|
||||
gw_string);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue