Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171535
b: refs/heads/master
c: eec4df9
h: refs/heads/master
i:
  171533: 9e3caeb
  171531: 9bae5ea
  171527: 5fa694d
  171519: bfc8620
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 14, 2009
1 parent efd6330 commit 3392547
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 342bde1b70c79bfc8509b017b3987f3c7541ff8e
refs/heads/master: eec4df9885f7822cdeca82577a25cac4598fa7cf
61 changes: 38 additions & 23 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,39 +1174,54 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
int idx, ip_idx;
int h, s_h;
int idx, s_idx;
int ip_idx, s_ip_idx;
struct net_device *dev;
struct in_device *in_dev;
struct in_ifaddr *ifa;
int s_ip_idx, s_idx = cb->args[0];
struct hlist_head *head;
struct hlist_node *node;

s_ip_idx = ip_idx = cb->args[1];
idx = 0;
for_each_netdev(net, dev) {
if (idx < s_idx)
goto cont;
if (idx > s_idx)
s_ip_idx = 0;
in_dev = __in_dev_get_rtnl(dev);
if (!in_dev)
goto cont;
s_h = cb->args[0];
s_idx = idx = cb->args[1];
s_ip_idx = ip_idx = cb->args[2];

for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
ifa = ifa->ifa_next, ip_idx++) {
if (ip_idx < s_ip_idx)
continue;
if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
if (idx < s_idx)
goto cont;
if (idx > s_idx)
s_ip_idx = 0;
in_dev = __in_dev_get_rcu(dev);
if (!in_dev)
goto cont;

for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
ifa = ifa->ifa_next, ip_idx++) {
if (ip_idx < s_ip_idx)
continue;
if (inet_fill_ifaddr(skb, ifa,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq,
RTM_NEWADDR, NLM_F_MULTI) <= 0)
goto done;
}
RTM_NEWADDR, NLM_F_MULTI) <= 0) {
rcu_read_unlock();
goto done;
}
}
cont:
idx++;
idx++;
}
rcu_read_unlock();
}

done:
cb->args[0] = idx;
cb->args[1] = ip_idx;
cb->args[0] = h;
cb->args[1] = idx;
cb->args[2] = ip_idx;

return skb->len;
}
Expand Down

0 comments on commit 3392547

Please sign in to comment.