Message ID | 1294763724-9927-3-git-send-email-ddvlad@rosedu.org |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, 2011-01-11 at 18:35 +0200, Vlad Dogaru wrote: > If a rtnetlink request specifies a negative or zero ifindex and has no > interface name attribute, but has a group attribute, then the chenges > are made to all the interfaces belonging to the specified group. > > Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> Looks good. Please just do some basic tests like setting a few interfaces to the same group, changing their MTU and setting admin up then down. If it works add my ACKed-by on both patches. The only thing that will still generate a lot of noise is the netlink events that will be generated afterwards for each change on a netdev in a group i.e a single netlink message.. Maybe we could batch those in a future patch cheers, jamal -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 012b0f0..f208397 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1558,6 +1558,24 @@ err: } EXPORT_SYMBOL(rtnl_create_link); +static int rtnl_group_changelink(struct net *net, int group, + struct ifinfomsg *ifm, + struct nlattr **tb) +{ + struct net_device *dev; + int err; + + for_each_netdev(net, dev) { + if (dev->group == group) { + err = do_setlink(dev, ifm, tb, NULL, 0); + if (err < 0) + return err; + } + } + + return 0; +} + static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) { struct net *net = sock_net(skb->sk); @@ -1585,10 +1603,16 @@ replay: ifm = nlmsg_data(nlh); if (ifm->ifi_index > 0) dev = __dev_get_by_index(net, ifm->ifi_index); - else if (ifname[0]) - dev = __dev_get_by_name(net, ifname); - else - dev = NULL; + else { + if (ifname[0]) + dev = __dev_get_by_name(net, ifname); + else if (tb[IFLA_GROUP]) + return rtnl_group_changelink(net, + nla_get_u32(tb[IFLA_GROUP]), + ifm, tb); + else + dev = NULL; + } err = validate_linkmsg(dev, tb); if (err < 0)
If a rtnetlink request specifies a negative or zero ifindex and has no interface name attribute, but has a group attribute, then the chenges are made to all the interfaces belonging to the specified group. Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> --- net/core/rtnetlink.c | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-)