mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 02:28:18 +02:00
core: check the iface index correctly
If the iface name is invalid, the index is -1.
This commit is contained in:
parent
b9ceba6133
commit
4e1abb8315
2 changed files with 2 additions and 2 deletions
|
|
@ -423,7 +423,7 @@ nm_device_set_ip_iface (NMDevice *self, const char *iface)
|
||||||
priv->ip_iface = g_strdup (iface);
|
priv->ip_iface = g_strdup (iface);
|
||||||
if (priv->ip_iface) {
|
if (priv->ip_iface) {
|
||||||
priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface);
|
priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface);
|
||||||
if (!priv->ip_ifindex) {
|
if (priv->ip_ifindex < 0) {
|
||||||
nm_log_warn (LOGD_HW, "(%s): failed to look up interface index", iface);
|
nm_log_warn (LOGD_HW, "(%s): failed to look up interface index", iface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
|
||||||
|
|
||||||
/* Grab the interface index for address/routing operations */
|
/* Grab the interface index for address/routing operations */
|
||||||
priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface);
|
priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface);
|
||||||
if (!priv->ip_ifindex) {
|
if (priv->ip_ifindex < 0) {
|
||||||
nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
|
nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue