struct netlink_ext_ack *);
typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
+enum rtnl_link_flags {
+ RTNL_FLAG_DOIT_UNLOCKED = 1,
+};
+
int __rtnl_register(int protocol, int msgtype,
rtnl_doit_func, rtnl_dumpit_func, unsigned int flags);
void rtnl_register(int protocol, int msgtype,
struct rtnl_link {
rtnl_doit_func doit;
rtnl_dumpit_func dumpit;
+ unsigned int flags;
};
static DEFINE_MUTEX(rtnl_mutex);
tab[msgindex].doit = doit;
if (dumpit)
tab[msgindex].dumpit = dumpit;
+ tab[msgindex].flags |= flags;
return 0;
}
handlers[msgindex].doit = NULL;
handlers[msgindex].dumpit = NULL;
+ handlers[msgindex].flags = 0;
rtnl_unlock();
return 0;
struct rtnl_link *handlers;
int err = -EOPNOTSUPP;
rtnl_doit_func doit;
+ unsigned int flags;
int kind;
int family;
int type;
return err;
}
+ flags = READ_ONCE(handlers[type].flags);
+ if (flags & RTNL_FLAG_DOIT_UNLOCKED) {
+ refcount_inc(&rtnl_msg_handlers_ref[family]);
+ doit = READ_ONCE(handlers[type].doit);
+ rcu_read_unlock();
+ if (doit)
+ err = doit(skb, nlh, extack);
+ refcount_dec(&rtnl_msg_handlers_ref[family]);
+ return err;
+ }
+
rcu_read_unlock();
rtnl_lock();