Skip to contentSkip to conversation

Problem with talking to the kernel and iproute2/ifconfig

DISCUSSION Paweł Staszewski 3 participants 4 messages Mar 25, 2010 – Mar 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello

I have strange problem with kernel 2.6.33.1

I have script with 6267 ip's

cat gateways.conf | grep 'addr add' | wc -l
6267

and when i want to commit this interfaces by command:
ip -batch gateways.conf

I have only 680 ip interfaces
ip a | grep inet | grep ' 10.' | wc -l
680

I test this on kernels 2.6.29.1 and 2.6.30.1 and all was OK. on kernel 2.6.29.1

ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

on kernel 2.6.30.1
ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

And also weird thing is that on kernel 2.6.33.1

ip addr ls dev vlan0100
158: vlan0100@eth2: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noqueue state DOWN qlen 100

    link/ether 00:30:48:67:fd:2e brd ff:ff:ff:ff:ff:ff

the same machine - the same interface but ifconfig use to list ip's
ifconfig vlan0100
vlan0100 Link encap:Ethernet HWaddr 00:30:48:67:fd:2e
inet addr:10.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.248 BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

The same machine - with the same script that loads gateways but on kernel 2.6.29.1 ip a ls dev vlan0100
8: vlan0100@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc htb state UP qlen 100

    link/ether 00:30:48:d3:33:d6 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/29 brd 10.0.0.7 scope global vlan0100:1
    inet 10.0.0.25/29 brd 10.0.0.31 scope global vlan0100:2
    inet 10.0.0.49/29 brd 10.0.0.55 scope global vlan0100:3
    inet 10.0.0.121/29 brd 10.0.0.127 scope global vlan0100:4
    inet 10.0.0.129/29 brd 10.0.0.135 scope global vlan0100:5
    inet 10.0.0.153/29 brd 10.0.0.159 scope global vlan0100:6

Bests Regards
Paweł

#1 lore raw
Quoted 20 lines · Paweł Staszewski

Hello

I have strange problem with kernel 2.6.33.1

I have script with 6267 ip's

cat gateways.conf | grep 'addr add' | wc -l
6267

and when i want to commit this interfaces by command:
ip -batch gateways.conf

I have only 680 ip interfaces
ip a | grep inet | grep ' 10.' | wc -l
680

I test this on kernels 2.6.29.1 and 2.6.30.1 and all was OK. on kernel 2.6.29.1

Quoted 8 lines

ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

on kernel 2.6.30.1
ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

Does this patch help? When "idx" points to the last device of a chain, it will never get incremented past s_idx and we fail to reset s_ip_idx.

net/ipv4/devinet.c +1 -1
index 51ca946..3feb2b3 100644
@@ -1194,7 +1194,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
 		hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
 			if (idx < s_idx)
 				goto cont;
-			if (idx > s_idx)
+			if (h > s_h || idx > s_idx)
 				s_ip_idx = 0;
 			in_dev = __in_dev_get_rcu(dev);
 			if (!in_dev)
#2 lore raw

Yes
This patch resolve this problem and all is working now correctly.

cat gateways.conf | grep 'addr add' | wc -l
6267
ip -batch gateways.conf
ip a sh | grep ' 10.' | grep inet | wc -l
6267

W dniu 2010-03-25 18:31, Patrick McHardy pisze:

Quoted 36 lines
Quoted 20 lines · Paweł Staszewski

Hello

I have strange problem with kernel 2.6.33.1

I have script with 6267 ip's

cat gateways.conf | grep 'addr add' | wc -l
6267

and when i want to commit this interfaces by command:
ip -batch gateways.conf

I have only 680 ip interfaces
ip a | grep inet | grep ' 10.' | wc -l
680

I test this on kernels 2.6.29.1 and 2.6.30.1 and all was OK. on kernel 2.6.29.1

Quoted 9 lines

ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

on kernel 2.6.30.1
ip -batch gateways.conf
ip a | grep inet | grep ' 10.' | wc -l
6267

Does this patch help? When "idx" points to the last device of a chain, it will never get incremented past s_idx and we fail to reset s_ip_idx.

maintainer
#3 lore raw

From: Paweł Staszewski <[email protected]>
Date: Thu, 25 Mar 2010 18:52:09 +0100

Quoted 1 line

This patch resolve this problem and all is working now correctly.

Patrick, since this is now tested to work, please make a formal submission of this fix if you haven't already.

Thanks!