mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 23:28:08 +02:00
platform: be more resilient in init_link against missing name of the rtnl link
Now we use init_link to print the rtnllink object, so be more resilient to incompletly initilized objects and just set the fields to NULL. This fixes the (non harmful) warning: <debug> [1397563880.690580] [platform/nm-linux-platform.c:1950] link_change_flags(): link: change 3: flags set 'up' (1) init_link: assertion 'rtnl_link_get_name (rtnllink)' failed file platform/nm-linux-platform.c: line 1021 (to_string_link): should not be reached <error> [1397563880.690632] [platform/nm-linux-platform.c:1836] link_change(): Netlink error changing link (invalid link 0x7f88b5cf93c0): Unspecific failure Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
c54faa4801
commit
05b5577815
1 changed files with 6 additions and 2 deletions
|
|
@ -788,14 +788,18 @@ init_link (NMPlatform *platform, NMPlatformLink *info, struct rtnl_link *rtnllin
|
|||
{
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
GUdevDevice *udev_device;
|
||||
const char *name;
|
||||
|
||||
g_return_val_if_fail (rtnllink, FALSE);
|
||||
g_return_val_if_fail (rtnl_link_get_name (rtnllink), FALSE);
|
||||
|
||||
name = rtnl_link_get_name (rtnllink);
|
||||
memset (info, 0, sizeof (*info));
|
||||
|
||||
info->ifindex = rtnl_link_get_ifindex (rtnllink);
|
||||
g_strlcpy (info->name, rtnl_link_get_name (rtnllink), sizeof (info->name));
|
||||
if (name)
|
||||
g_strlcpy (info->name, name, sizeof (info->name));
|
||||
else
|
||||
info->name[0] = '\0';
|
||||
info->type = link_extract_type (platform, rtnllink, &info->type_name);
|
||||
info->up = !!(rtnl_link_get_flags (rtnllink) & IFF_UP);
|
||||
info->connected = !!(rtnl_link_get_flags (rtnllink) & IFF_LOWER_UP);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue