memset(frh, 0, sizeof(*frh));
frh->family = family;
frh->action = FR_ACT_TO_TBL;
+ frh->proto = RTPROT_KERNEL;
if (nla_put_u8(skb, FRA_L3MDEV, 1))
goto nla_put_failure;
u32 table;
u8 action;
u8 l3mdev;
- /* 2 bytes hole, try to use */
+ u8 proto;
+ /* 1 byte hole, try to use */
u32 target;
__be64 tun_id;
struct fib_rule __rcu *ctarget;
r->pref = pref;
r->table = table;
r->flags = flags;
+ r->proto = RTPROT_KERNEL;
r->fr_net = ops->fro_net;
r->uid_range = fib_kuid_range_unset;
}
refcount_set(&rule->refcnt, 1);
rule->fr_net = net;
+ rule->proto = frh->proto;
rule->pref = tb[FRA_PRIORITY] ? nla_get_u32(tb[FRA_PRIORITY])
: fib_default_rule_pref(ops);
}
list_for_each_entry(rule, &ops->rules_list, list) {
+ if (frh->proto && (frh->proto != rule->proto))
+ continue;
+
if (frh->action && (frh->action != rule->action))
continue;
if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))
goto nla_put_failure;
frh->res1 = 0;
- frh->res2 = 0;
frh->action = rule->action;
frh->flags = rule->flags;
+ frh->proto = rule->proto;
if (rule->action == FR_ACT_GOTO &&
rcu_access_pointer(rule->ctarget) == NULL)