core: add nm_platform_link_refresh() function to refresh the libnl cache for links

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-02-11 13:58:00 +01:00
parent eac0573d5e
commit 66f5256b94
3 changed files with 39 additions and 0 deletions

View File

@@ -1668,6 +1668,20 @@ link_get_flags (NMPlatform *platform, int ifindex)
return rtnl_link_get_flags (rtnllink);
}
static gboolean
link_refresh (NMPlatform *platform, int ifindex)
{
auto_nl_object struct rtnl_link *rtnllink = rtnl_link_alloc ();
if (rtnllink) {
rtnl_link_set_ifindex (rtnllink, ifindex);
return refresh_object (platform, (struct nl_object *) rtnllink, FALSE, NM_PLATFORM_REASON_EXTERNAL);
} else
error ("link_refresh failed with out of memory");
return FALSE;
}
static gboolean
link_is_up (NMPlatform *platform, int ifindex)
{
@@ -3026,6 +3040,8 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
platform_class->link_get_type = link_get_type;
platform_class->link_get_type_name = link_get_type_name;
platform_class->link_refresh = link_refresh;
platform_class->link_set_up = link_set_up;
platform_class->link_set_down = link_set_down;
platform_class->link_set_arp = link_set_arp;