diff options
author | Rami Rosen <ramirose@gmail.com> | 2008-10-07 18:34:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-07 18:34:37 -0400 |
commit | b8bae41ed6a53cce56c50811a91cd963e3187d1c (patch) | |
tree | a54cbcedbfd4d4f88fe207068c9b910c884b6b20 /net | |
parent | be713a443ee019489890e93654557916fbf72612 (diff) |
ipv4: add mc_count to in_device.
This patch add mc_count to struct in_device and updates
increment/decrement/initilaize of this field in IPv4 and in IPv6.
- Also printing the vfs /proc entry (/proc/net/igmp) is adjusted to
use the new mc_count.
Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/igmp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index f70fac612596..7f9e337e3908 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1234,6 +1234,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) | |||
1234 | write_lock_bh(&in_dev->mc_list_lock); | 1234 | write_lock_bh(&in_dev->mc_list_lock); |
1235 | im->next=in_dev->mc_list; | 1235 | im->next=in_dev->mc_list; |
1236 | in_dev->mc_list=im; | 1236 | in_dev->mc_list=im; |
1237 | in_dev->mc_count++; | ||
1237 | write_unlock_bh(&in_dev->mc_list_lock); | 1238 | write_unlock_bh(&in_dev->mc_list_lock); |
1238 | #ifdef CONFIG_IP_MULTICAST | 1239 | #ifdef CONFIG_IP_MULTICAST |
1239 | igmpv3_del_delrec(in_dev, im->multiaddr); | 1240 | igmpv3_del_delrec(in_dev, im->multiaddr); |
@@ -1282,6 +1283,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) | |||
1282 | if (--i->users == 0) { | 1283 | if (--i->users == 0) { |
1283 | write_lock_bh(&in_dev->mc_list_lock); | 1284 | write_lock_bh(&in_dev->mc_list_lock); |
1284 | *ip = i->next; | 1285 | *ip = i->next; |
1286 | in_dev->mc_count--; | ||
1285 | write_unlock_bh(&in_dev->mc_list_lock); | 1287 | write_unlock_bh(&in_dev->mc_list_lock); |
1286 | igmp_group_dropped(i); | 1288 | igmp_group_dropped(i); |
1287 | 1289 | ||
@@ -1330,6 +1332,7 @@ void ip_mc_init_dev(struct in_device *in_dev) | |||
1330 | setup_timer(&in_dev->mr_gq_timer, igmp_gq_timer_expire, | 1332 | setup_timer(&in_dev->mr_gq_timer, igmp_gq_timer_expire, |
1331 | (unsigned long)in_dev); | 1333 | (unsigned long)in_dev); |
1332 | in_dev->mr_ifc_count = 0; | 1334 | in_dev->mr_ifc_count = 0; |
1335 | in_dev->mc_count = 0; | ||
1333 | setup_timer(&in_dev->mr_ifc_timer, igmp_ifc_timer_expire, | 1336 | setup_timer(&in_dev->mr_ifc_timer, igmp_ifc_timer_expire, |
1334 | (unsigned long)in_dev); | 1337 | (unsigned long)in_dev); |
1335 | in_dev->mr_qrv = IGMP_Unsolicited_Report_Count; | 1338 | in_dev->mr_qrv = IGMP_Unsolicited_Report_Count; |
@@ -1369,8 +1372,8 @@ void ip_mc_destroy_dev(struct in_device *in_dev) | |||
1369 | write_lock_bh(&in_dev->mc_list_lock); | 1372 | write_lock_bh(&in_dev->mc_list_lock); |
1370 | while ((i = in_dev->mc_list) != NULL) { | 1373 | while ((i = in_dev->mc_list) != NULL) { |
1371 | in_dev->mc_list = i->next; | 1374 | in_dev->mc_list = i->next; |
1375 | in_dev->mc_count--; | ||
1372 | write_unlock_bh(&in_dev->mc_list_lock); | 1376 | write_unlock_bh(&in_dev->mc_list_lock); |
1373 | |||
1374 | igmp_group_dropped(i); | 1377 | igmp_group_dropped(i); |
1375 | ip_ma_put(i); | 1378 | ip_ma_put(i); |
1376 | 1379 | ||
@@ -2383,7 +2386,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v) | |||
2383 | 2386 | ||
2384 | if (state->in_dev->mc_list == im) { | 2387 | if (state->in_dev->mc_list == im) { |
2385 | seq_printf(seq, "%d\t%-10s: %5d %7s\n", | 2388 | seq_printf(seq, "%d\t%-10s: %5d %7s\n", |
2386 | state->dev->ifindex, state->dev->name, state->dev->mc_count, querier); | 2389 | state->dev->ifindex, state->dev->name, state->in_dev->mc_count, querier); |
2387 | } | 2390 | } |
2388 | 2391 | ||
2389 | seq_printf(seq, | 2392 | seq_printf(seq, |