[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1403699280-12837-1-git-send-email-jiri@resnulli.us>
Date: Wed, 25 Jun 2014 14:27:59 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, pshelar@...ira.com, cwang@...pensource.com,
nicolas.dichtel@...nd.com, ebiederm@...ssion.com,
david@...son.dropbear.id.au, sfeldma@...ulusnetworks.com,
sucheta.chakraborty@...gic.com, stephen@...workplumber.org
Subject: [patch net-next 1/2] rtnetlink: allow to register ops without ops->setup set
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@...nulli.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists