Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ip6mr: Add API for default_rule fib

Add the ability to discern whether a given FIB rule notification relates
to the default rule inserted when registering ip6mr or a different one.

Would later be used by drivers wishing to offload ipv6 multicast routes
but unable to offload rules other than the default one.

Signed-off-by: Yuval Mintz <yuvalm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yuval Mintz and committed by
David S. Miller
d3c07e5b 088aa3ee

+17
+10
include/linux/mroute6.h
··· 8 8 #include <net/net_namespace.h> 9 9 #include <uapi/linux/mroute6.h> 10 10 #include <linux/mroute_base.h> 11 + #include <net/fib_rules.h> 11 12 12 13 #ifdef CONFIG_IPV6_MROUTE 13 14 static inline int ip6_mroute_opt(int opt) ··· 61 60 static inline void ip6_mr_cleanup(void) 62 61 { 63 62 return; 63 + } 64 + #endif 65 + 66 + #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES 67 + bool ip6mr_rule_default(const struct fib_rule *rule); 68 + #else 69 + static inline bool ip6mr_rule_default(const struct fib_rule *rule) 70 + { 71 + return true; 64 72 } 65 73 #endif 66 74
+7
net/ipv6/ip6mr.c
··· 268 268 { 269 269 return fib_rules_seq_read(net, RTNL_FAMILY_IP6MR); 270 270 } 271 + 272 + bool ip6mr_rule_default(const struct fib_rule *rule) 273 + { 274 + return fib_rule_matchall(rule) && rule->action == FR_ACT_TO_TBL && 275 + rule->table == RT6_TABLE_DFLT && !rule->l3mdev; 276 + } 277 + EXPORT_SYMBOL(ip6mr_rule_default); 271 278 #else 272 279 #define ip6mr_for_each_table(mrt, net) \ 273 280 for (mrt = net->ipv6.mrt6; mrt; mrt = NULL)