summaryrefslogtreecommitdiff
path: root/src/devices/nm-device.c
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-04-09 16:23:39 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-04-09 16:23:39 +0200
commit94a14ceffe8ccd65d175ed5661868cffb9f37339 (patch)
treebf16c20baf03019a64cd7e0303da42de0f52acf7 /src/devices/nm-device.c
parente4f2c2d8b2a939209ead2606c79c9f83fbbfd81c (diff)
downloadNetworkManager-lr/tc-attrs.tar.gz
tc/tfilter: add mirred actionlr/tc-attrs
Diffstat (limited to 'src/devices/nm-device.c')
-rw-r--r--src/devices/nm-device.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index b6afe7fbcd..23574966d8 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6588,16 +6588,35 @@ tc_commit (NMDevice *self)
action = nm_tc_tfilter_get_action (s_tfilter);
if (action) {
+ GVariant *var;
+
tfilter->action.kind = nm_tc_action_get_kind (action);
if (strcmp (tfilter->action.kind, "simple") == 0) {
- GVariant *sdata;
-
- sdata = nm_tc_action_get_attribute (action, "sdata");
- if (sdata && g_variant_is_of_type (sdata, G_VARIANT_TYPE_BYTESTRING)) {
+ var = nm_tc_action_get_attribute (action, "sdata");
+ if (var && g_variant_is_of_type (var, G_VARIANT_TYPE_BYTESTRING)) {
g_strlcpy (tfilter->action.simple.sdata,
- g_variant_get_bytestring (sdata),
+ g_variant_get_bytestring (var),
sizeof (tfilter->action.simple.sdata));
}
+ } else if (strcmp (tfilter->action.kind, "mirred") == 0) {
+ if (nm_tc_action_get_attribute (action, "egress"))
+ tfilter->action.mirred.egress = TRUE;
+
+ if (nm_tc_action_get_attribute (action, "ingress"))
+ tfilter->action.mirred.ingress = TRUE;
+
+ if (nm_tc_action_get_attribute (action, "mirror"))
+ tfilter->action.mirred.mirror = TRUE;
+
+ if (nm_tc_action_get_attribute (action, "redirect"))
+ tfilter->action.mirred.redirect = TRUE;
+
+ var = nm_tc_action_get_attribute (action, "dev");
+ if (var && g_variant_is_of_type (var, G_VARIANT_TYPE_STRING)) {
+ int ifindex = nm_platform_link_get_ifindex (nm_device_get_platform (self),
+ g_variant_get_string (var, NULL));
+ tfilter->action.mirred.ifindex = ifindex;
+ }
}
}