netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set
@ 2014-06-25 12:27 Jiri Pirko
  2014-06-25 12:28 ` [patch net-next 2/2] openvswitch: introduce rtnl ops stub Jiri Pirko
  2014-06-25 15:55 ` [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set Eric W. Biederman
  0 siblings, 2 replies; 8+ messages in thread
From: Jiri Pirko @ 2014-06-25 12:27 UTC (permalink / raw)
  To: netdev
  Cc: davem, pshelar, cwang, nicolas.dichtel, ebiederm, david, sfeldma,
	sucheta.chakraborty, stephen

So far, it is assumed that ops->setup is filled up. But there might be
case that ops might make sense even without ->setup. In that case,
forbid to newlink and dellink.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/core/rtnetlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1063996..84affd7 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1777,7 +1777,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);
@@ -2038,6 +2038,9 @@ replay:
 			return -EOPNOTSUPP;
 		}
 
+		if (!ops->setup)
+			return -EOPNOTSUPP;
+
 		if (!ifname[0])
 			snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-26  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 12:27 [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set Jiri Pirko
2014-06-25 12:28 ` [patch net-next 2/2] openvswitch: introduce rtnl ops stub Jiri Pirko
2014-06-25 16:02   ` Eric W. Biederman
2014-06-25 16:35     ` Jiri Pirko
2014-06-25 17:13       ` Eric W. Biederman
2014-06-26  7:39         ` Jiri Pirko
2014-06-25 15:55 ` [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set Eric W. Biederman
2014-06-25 16:31   ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).