mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 08:30:15 +01:00
libnm-core: don't assert against non-NULL @ip argument to canonicalize_ip()
Remove an assertion in canonicalize_ip() to assert that either a non-NULL @ip is given, or @null_any is TRUE. The condition of the assert is not easy to understand without context. Instead the caller should already handle %NULL properly. All callers that pass @null_any=FALSE to canonicalize_ip(), already assert that the argument is not %NULL. With the exception of nm_ip_route_new() which however checks for a valid @dest early on.
This commit is contained in:
parent
f14fd048ff
commit
7f129b976c
1 changed files with 2 additions and 4 deletions
|
|
@ -71,10 +71,8 @@ canonicalize_ip (int family, const char *ip, gboolean null_any)
|
|||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
int ret;
|
||||
|
||||
if (!ip) {
|
||||
g_return_val_if_fail (null_any == TRUE, NULL);
|
||||
if (!ip)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = inet_pton (family, ip, addr_bytes);
|
||||
g_return_val_if_fail (ret == 1, NULL);
|
||||
|
|
@ -2288,7 +2286,7 @@ set_property (GObject *object, guint prop_id,
|
|||
gateway = g_value_get_string (value);
|
||||
g_return_if_fail (!gateway || nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway));
|
||||
g_free (priv->gateway);
|
||||
priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, gateway == NULL);
|
||||
priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, FALSE);
|
||||
break;
|
||||
case PROP_ROUTES:
|
||||
g_ptr_array_unref (priv->routes);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue