Re: [patch net-next] openvswitch: introduce rtnl ops stub
From: Jiri Pirko <jiri@resnulli.us>
Date: 2014-06-12 15:03:33
Thu, Jun 12, 2014 at 04:46:05PM CEST, nicolas.dichtel@6wind.com wrote:
Le 12/06/2014 16:20, Jiri Pirko a écrit :quoted
This stub now allows userspace to see IFLA_INFO_KIND for ovs master and IFLA_INFO_SLAVE_KIND for slave. Note that I added ops->setup check into newlink and dellink in order to prevent creating and deleting openvswitch instances using rtnl for now. Signed-off-by: Jiri Pirko <jiri@resnulli.us>net-next is closed ;-)quoted
--- net/core/rtnetlink.c | 5 ++++- net/openvswitch/datapath.c | 9 ++++++++- net/openvswitch/vport-internal_dev.c | 16 ++++++++++++++++ net/openvswitch/vport-internal_dev.h | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-)diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 233b5ae..b874139 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c@@ -1767,7 +1767,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh) return -ENODEV; ops = dev->rtnl_link_ops; - if (!ops) + if (!ops || !ops->setup) return -EOPNOTSUPP; ops->dellink(dev, &list_kill);@@ -2028,6 +2028,9 @@ replay: return -EOPNOTSUPP; } + if (!ops->setup) + return -EOPNOTSUPP; +For this one, you could just add a ops->validate in openvswitch which returns always -EOPNOTSUPP.
yeah, I wanted the check in newlink and dellink to be the same