]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: add netlink rule support for fwmark option
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 27 Apr 2018 14:32:51 +0000 (16:32 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 31 May 2018 15:44:39 +0000 (17:44 +0200)
When a mark is set, incoming traffic having that mark set can be
redirected to a specific table identifier. This work is done through
netlink.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/rule_netlink.c
zebra/zebra_pbr.h

index 310f0952faa3e4c11a3a64686718a7141294af59..0cac3172fa5d36d8955b2eef7d3b39bbd4a5e16f 100644 (file)
@@ -98,6 +98,12 @@ static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule)
                          &rule->rule.filter.dst_ip.u.prefix, bytelen);
        }
 
+       /* fwmark, if specified */
+       if (IS_RULE_FILTERING_ON_FWMARK(rule)) {
+               addattr32(&req.n, sizeof(req), FRA_FWMARK,
+                         rule->rule.filter.fwmark);
+       }
+
        /* Route table to use to forward, if filter criteria matches. */
        if (rule->rule.action.table < 256)
                req.frh.table = rule->rule.action.table;
index 7ba4e988c1a74c1dc7ba7f2824d00c96d18dde01..12678b210bdb0b93d3d820d2a8384757cef4e3c5 100644 (file)
@@ -48,6 +48,8 @@ struct zebra_pbr_rule {
        (r->rule.filter.filter_bm & PBR_FILTER_SRC_PORT)
 #define IS_RULE_FILTERING_ON_DST_PORT(r) \
        (r->rule.filter.filter_bm & PBR_FILTER_DST_PORT)
+#define IS_RULE_FILTERING_ON_FWMARK(r) \
+       (r->rule.filter.filter_bm & PBR_FILTER_FWMARK)
 
 /*
  * An IPSet Entry Filter