platform: implement link_sit_add via nm_platform_link_add()
This commit is contained in:
@@ -3747,6 +3747,23 @@ _nl_msg_new_link_set_linkinfo (struct nl_msg *msg,
|
||||
NLA_PUT_U16 (msg, IFLA_GRE_OFLAGS, htons (props->output_flags));
|
||||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_SIT: {
|
||||
const NMPlatformLnkSit *props = extra_data;
|
||||
|
||||
nm_assert (props);
|
||||
|
||||
if (!(data = nla_nest_start (msg, IFLA_INFO_DATA)))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (props->parent_ifindex)
|
||||
NLA_PUT_U32 (msg, IFLA_IPTUN_LINK, props->parent_ifindex);
|
||||
NLA_PUT_U32 (msg, IFLA_IPTUN_LOCAL, props->local);
|
||||
NLA_PUT_U32 (msg, IFLA_IPTUN_REMOTE, props->remote);
|
||||
NLA_PUT_U8 (msg, IFLA_IPTUN_TTL, props->ttl);
|
||||
NLA_PUT_U8 (msg, IFLA_IPTUN_TOS, props->tos);
|
||||
NLA_PUT_U8 (msg, IFLA_IPTUN_PMTUDISC, !!props->path_mtu_discovery);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
nm_assert (!extra_data);
|
||||
break;
|
||||
@@ -7486,47 +7503,6 @@ nla_put_failure:
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
link_sit_add (NMPlatform *platform,
|
||||
const char *name,
|
||||
const NMPlatformLnkSit *props,
|
||||
const NMPlatformLink **out_link)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||
struct nlattr *info;
|
||||
struct nlattr *data;
|
||||
|
||||
nlmsg = _nl_msg_new_link (RTM_NEWLINK,
|
||||
NLM_F_CREATE | NLM_F_EXCL,
|
||||
0,
|
||||
name);
|
||||
if (!nlmsg)
|
||||
return FALSE;
|
||||
|
||||
if (!(info = nla_nest_start (nlmsg, IFLA_LINKINFO)))
|
||||
goto nla_put_failure;
|
||||
|
||||
NLA_PUT_STRING (nlmsg, IFLA_INFO_KIND, "sit");
|
||||
|
||||
if (!(data = nla_nest_start (nlmsg, IFLA_INFO_DATA)))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (props->parent_ifindex)
|
||||
NLA_PUT_U32 (nlmsg, IFLA_IPTUN_LINK, props->parent_ifindex);
|
||||
NLA_PUT_U32 (nlmsg, IFLA_IPTUN_LOCAL, props->local);
|
||||
NLA_PUT_U32 (nlmsg, IFLA_IPTUN_REMOTE, props->remote);
|
||||
NLA_PUT_U8 (nlmsg, IFLA_IPTUN_TTL, props->ttl);
|
||||
NLA_PUT_U8 (nlmsg, IFLA_IPTUN_TOS, props->tos);
|
||||
NLA_PUT_U8 (nlmsg, IFLA_IPTUN_PMTUDISC, !!props->path_mtu_discovery);
|
||||
|
||||
nla_nest_end (nlmsg, data);
|
||||
nla_nest_end (nlmsg, info);
|
||||
|
||||
return (do_add_link_with_lookup (platform, NM_LINK_TYPE_SIT, name, nlmsg, out_link) >= 0);
|
||||
nla_put_failure:
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
link_tun_add (NMPlatform *platform,
|
||||
const char *name,
|
||||
@@ -9321,7 +9297,6 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
||||
platform_class->link_macsec_add = link_macsec_add;
|
||||
platform_class->link_macvlan_add = link_macvlan_add;
|
||||
platform_class->link_ipip_add = link_ipip_add;
|
||||
platform_class->link_sit_add = link_sit_add;
|
||||
platform_class->link_tun_add = link_tun_add;
|
||||
platform_class->link_6lowpan_add = link_6lowpan_add;
|
||||
|
||||
|
Reference in New Issue
Block a user