diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-31 13:19:53 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-01-09 10:42:31 +0100 |
commit | 8b417300ca7e0069c62c3b69adcccab2af9d6226 (patch) | |
tree | a8e725d2aff66617fc16d5fd6276de1ff119368b | |
parent | d3963e4ac70a78970f1e1b626a84235b394db21b (diff) | |
download | NetworkManager-8b417300ca7e0069c62c3b69adcccab2af9d6226.tar.gz |
platform: implement link_6lowpan_add via nm_platform_link_add()
-rw-r--r-- | src/platform/nm-linux-platform.c | 34 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 32 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 17 |
3 files changed, 9 insertions, 74 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 6da7e28e5e..8eb86ddffd 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -7589,39 +7589,6 @@ link_tun_add (NMPlatform *platform, return TRUE; } -static gboolean -link_6lowpan_add (NMPlatform *platform, - const char *name, - int parent, - const NMPlatformLink **out_link) -{ - nm_auto_nlmsg struct nl_msg *nlmsg = NULL; - struct nlattr *info; - - nlmsg = _nl_msg_new_link (RTM_NEWLINK, - NLM_F_CREATE | NLM_F_EXCL, - 0, - name); - if (!nlmsg) - return FALSE; - - NLA_PUT_U32 (nlmsg, IFLA_LINK, parent); - - if (!(info = nla_nest_start (nlmsg, IFLA_LINKINFO))) - goto nla_put_failure; - - NLA_PUT_STRING (nlmsg, IFLA_INFO_KIND, "lowpan"); - - nla_nest_end (nlmsg, info); - - return (do_add_link_with_lookup (platform, - NM_LINK_TYPE_6LOWPAN, - name, nlmsg, out_link) >= 0); -nla_put_failure: - g_return_val_if_reached (FALSE); -} - - static void _vlan_change_vlan_qos_mapping_create (gboolean is_ingress_map, gboolean reset_all, @@ -9258,7 +9225,6 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass) platform_class->link_macvlan_add = link_macvlan_add; platform_class->link_ipip_add = link_ipip_add; platform_class->link_tun_add = link_tun_add; - platform_class->link_6lowpan_add = link_6lowpan_add; platform_class->object_delete = object_delete; platform_class->ip4_address_add = ip4_address_add; diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 3b62bd734f..04d9b2efb5 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2375,38 +2375,6 @@ nm_platform_link_tun_add (NMPlatform *self, return 0; } -/** - * nm_platform_6lowpan_add: - * @self: platform instance - * @parent: parent link - * @name: name of the new interface - * @out_link: on success, the link object - * - * Create a 6LoWPAN interface. - */ -int -nm_platform_link_6lowpan_add (NMPlatform *self, - const char *name, - int parent, - const NMPlatformLink **out_link) -{ - int r; - - _CHECK_SELF (self, klass, -NME_BUG); - - g_return_val_if_fail (name, -NME_BUG); - - r = _link_add_check_existing (self, name, NM_LINK_TYPE_6LOWPAN, out_link); - if (r < 0) - return r; - - _LOG2D ("adding link 6lowpan parent %u", parent); - - if (!klass->link_6lowpan_add (self, name, parent, out_link)) - return -NME_UNSPEC; - return 0; -} - gboolean nm_platform_link_6lowpan_get_properties (NMPlatform *self, int ifindex, int *out_parent) { diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index f8fc6d5e6e..38a92cdfc6 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -1066,10 +1066,6 @@ typedef struct { const NMPlatformLnkTun *props, const NMPlatformLink **out_link, int *out_fd); - gboolean (*link_6lowpan_add) (NMPlatform *self, - const char *name, - int parent, - const NMPlatformLink **out_link); gboolean (*infiniband_partition_add) (NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link); gboolean (*infiniband_partition_delete) (NMPlatform *self, int parent, int p_key); @@ -1465,6 +1461,15 @@ nm_platform_link_vxlan_add (NMPlatform *self, return nm_platform_link_add (self, NM_LINK_TYPE_VXLAN, name, 0, NULL, 0, props, out_link); } +static inline int +nm_platform_link_6lowpan_add (NMPlatform *self, + const char *name, + int parent, + const NMPlatformLink **out_link) +{ + return nm_platform_link_add (self, NM_LINK_TYPE_6LOWPAN, name, parent, NULL, 0, NULL, out_link); +} + gboolean nm_platform_link_delete (NMPlatform *self, int ifindex); gboolean nm_platform_link_set_netns (NMPlatform *self, int ifindex, int netns_fd); @@ -1666,10 +1671,6 @@ int nm_platform_link_tun_add (NMPlatform *self, const NMPlatformLnkTun *props, const NMPlatformLink **out_link, int *out_fd); -int nm_platform_link_6lowpan_add (NMPlatform *self, - const char *name, - int parent, - const NMPlatformLink **out_link); gboolean nm_platform_link_6lowpan_get_properties (NMPlatform *self, int ifindex, int *out_parent); |