summaryrefslogtreecommitdiff
path: root/system-linux.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin.shar@gmail.com>2020-05-17 20:39:44 +0200
committerHans Dedecker <dedeckeh@gmail.com>2020-05-21 20:08:48 +0200
commit74e0222eeb9e62f4d5073a5b3d9208678782a198 (patch)
tree7198184cf4410dd5d1a3f41a32782dafa4ea3037 /system-linux.c
parentcfccdc22ca6d8f28d70a2546a495c9ead4bbb765 (diff)
downloadnetifd-74e0222eeb9e62f4d5073a5b3d9208678782a198.tar.gz
vlandev: support setting ingress/egress QoS mappings
It allows setting mappings for instance this way: """ config device option name 'vlan41' option type '8021q' option vid '41' option ifname 'eth1' list ingress_qos_mapping '1:2' list ingress_qos_mapping '2:5' list egress_qos_mapping '0:3' """ Signed-off-by: Pau Espin Pedrol <pespin.shar@gmail.com> Tested-by: Pedro <pedrowrt@cas.cat>
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/system-linux.c b/system-linux.c
index 62636c4..c225175 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -74,6 +74,7 @@
#include "netifd.h"
#include "device.h"
#include "system.h"
+#include "utils.h"
struct event_socket {
struct uloop_fd uloop;
@@ -1401,8 +1402,10 @@ int system_vlan_del(struct device *dev)
int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlandev_config *cfg)
{
struct nl_msg *msg;
- struct nlattr *linkinfo, *data;
+ struct nlattr *linkinfo, *data, *qos;
struct ifinfomsg iim = { .ifi_family = AF_UNSPEC };
+ struct vlan_qos_mapping *elem;
+ struct ifla_vlan_qos_mapping nl_qos_map;
int rv;
msg = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
@@ -1431,6 +1434,26 @@ int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlande
netifd_log_message(L_WARNING, "%s Your kernel is older than linux 3.10.0, 802.1ad is not supported defaulting to 802.1q", vlandev->type->name);
#endif
+ if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS)))
+ goto nla_put_failure;
+
+ vlist_simple_for_each_element(&cfg->ingress_qos_mapping_list, elem, node) {
+ nl_qos_map.from = elem->from;
+ nl_qos_map.to = elem->to;
+ nla_put(msg, IFLA_VLAN_QOS_MAPPING, sizeof(nl_qos_map), &nl_qos_map);
+ }
+ nla_nest_end(msg, qos);
+
+ if (!(qos = nla_nest_start(msg, IFLA_VLAN_EGRESS_QOS)))
+ goto nla_put_failure;
+
+ vlist_simple_for_each_element(&cfg->egress_qos_mapping_list, elem, node) {
+ nl_qos_map.from = elem->from;
+ nl_qos_map.to = elem->to;
+ nla_put(msg, IFLA_VLAN_QOS_MAPPING, sizeof(nl_qos_map), &nl_qos_map);
+ }
+ nla_nest_end(msg, qos);
+
nla_nest_end(msg, data);
nla_nest_end(msg, linkinfo);