On 6/12/20 10:49 AM, Andrea Mayer wrote:
@@ -37,6 +45,15 @@ struct l3mdev_ops { #ifdef CONFIG_NET_L3_MASTER_DEV +int l3mdev_table_lookup_register(enum l3mdev_type l3type,
int (*fn)(struct net *net, u32 table_id));
+void l3mdev_table_lookup_unregister(enum l3mdev_type l3type,
int (*fn)(struct net *net, u32 table_id));
+int l3mdev_ifindex_lookup_by_table_id(enum l3mdev_type l3type, struct net *net,
u32 table_id);
int l3mdev_fib_rule_match(struct net *net, struct flowi *fl, struct fib_lookup_arg *arg); @@ -280,6 +297,26 @@ struct sk_buff *l3mdev_ip6_out(struct sock *sk, struct sk_buff *skb) return skb; } +static inline +int l3mdev_table_lookup_register(enum l3mdev_type l3type,
int (*fn)(struct net *net, u32 table_id))
+{
- return -EOPNOTSUPP;
+}
+static inline +void l3mdev_table_lookup_unregister(enum l3mdev_type l3type,
int (*fn)(struct net *net, u32 table_id))
+{ +}
+static inline +int l3mdev_ifindex_lookup_by_table_id(enum l3mdev_type l3type, struct net *net,
u32 table_id)
+{
- return -ENODEV;
+}
static inline int l3mdev_fib_rule_match(struct net *net, struct flowi *fl, struct fib_lookup_arg *arg) diff --git a/net/l3mdev/l3mdev.c b/net/l3mdev/l3mdev.c index f35899d45a9a..6cc1fe7eb039 100644 --- a/net/l3mdev/l3mdev.c +++ b/net/l3mdev/l3mdev.c @@ -9,6 +9,101 @@ #include <net/fib_rules.h> #include <net/l3mdev.h> +DEFINE_SPINLOCK(l3mdev_lock);
+typedef int (*lookup_by_table_id_t)(struct net *net, u32 table_d);
I should have caught this earlier. Move lookup_by_table_id_t to l3mdev.h and use above for 'fn' in l3mdev_table_lookup_{un,}register