br_netlink.c (bb900b27a2f49b37bc38c08e656ea13048fee13b) | br_netlink.c (e67f88dd12f610da98ca838822f2c9b4e7c6100e) |
---|---|
1/* 2 * Bridge netlink control interface 3 * 4 * Authors: 5 * Stephen Hemminger <shemminger@osdl.org> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 106 unchanged lines hidden (view full) --- 115 */ 116static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 117{ 118 struct net *net = sock_net(skb->sk); 119 struct net_device *dev; 120 int idx; 121 122 idx = 0; | 1/* 2 * Bridge netlink control interface 3 * 4 * Authors: 5 * Stephen Hemminger <shemminger@osdl.org> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 106 unchanged lines hidden (view full) --- 115 */ 116static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 117{ 118 struct net *net = sock_net(skb->sk); 119 struct net_device *dev; 120 int idx; 121 122 idx = 0; |
123 for_each_netdev(net, dev) { 124 struct net_bridge_port *port = br_port_get_rtnl(dev); | 123 rcu_read_lock(); 124 for_each_netdev_rcu(net, dev) { 125 struct net_bridge_port *port = br_port_get_rcu(dev); |
125 126 /* not a bridge port */ 127 if (!port || idx < cb->args[0]) 128 goto skip; 129 130 if (br_fill_ifinfo(skb, port, 131 NETLINK_CB(cb->skb).pid, 132 cb->nlh->nlmsg_seq, RTM_NEWLINK, 133 NLM_F_MULTI) < 0) 134 break; 135skip: 136 ++idx; 137 } | 126 127 /* not a bridge port */ 128 if (!port || idx < cb->args[0]) 129 goto skip; 130 131 if (br_fill_ifinfo(skb, port, 132 NETLINK_CB(cb->skb).pid, 133 cb->nlh->nlmsg_seq, RTM_NEWLINK, 134 NLM_F_MULTI) < 0) 135 break; 136skip: 137 ++idx; 138 } |
138 | 139 rcu_read_unlock(); |
139 cb->args[0] = idx; 140 141 return skb->len; 142} 143 144/* 145 * Change state of port (ie from forwarding to blocking etc) 146 * Used by spanning tree in user space. --- 104 unchanged lines hidden --- | 140 cb->args[0] = idx; 141 142 return skb->len; 143} 144 145/* 146 * Change state of port (ie from forwarding to blocking etc) 147 * Used by spanning tree in user space. --- 104 unchanged lines hidden --- |