diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-09-03 18:19:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-04 14:53:21 -0400 |
commit | b4af8def5c083e5424c66051fe400444a01c4644 (patch) | |
tree | 781f3e4fea6356d28340c5acc5aa89f8f1f001f0 /net/ipv6/mcast.c | |
parent | 2b7c121f82b47ba5efac1ef47355376d1f8d6980 (diff) |
net: ipv6: mld: introduce mld_{gq, ifc, dad}_stop_timer functions
We already have mld_{gq,ifc,dad}_start_timer() functions, so introduce
mld_{gq,ifc,dad}_stop_timer() functions to reduce code size and make it
more readable.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/mcast.c')
-rw-r--r-- | net/ipv6/mcast.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 04399cb71e14..096cd67b737c 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1006,6 +1006,13 @@ static void mld_gq_start_timer(struct inet6_dev *idev) | |||
1006 | in6_dev_hold(idev); | 1006 | in6_dev_hold(idev); |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | static void mld_gq_stop_timer(struct inet6_dev *idev) | ||
1010 | { | ||
1011 | idev->mc_gq_running = 0; | ||
1012 | if (del_timer(&idev->mc_gq_timer)) | ||
1013 | __in6_dev_put(idev); | ||
1014 | } | ||
1015 | |||
1009 | static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay) | 1016 | static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay) |
1010 | { | 1017 | { |
1011 | unsigned long tv = net_random() % delay; | 1018 | unsigned long tv = net_random() % delay; |
@@ -1014,6 +1021,13 @@ static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay) | |||
1014 | in6_dev_hold(idev); | 1021 | in6_dev_hold(idev); |
1015 | } | 1022 | } |
1016 | 1023 | ||
1024 | static void mld_ifc_stop_timer(struct inet6_dev *idev) | ||
1025 | { | ||
1026 | idev->mc_ifc_count = 0; | ||
1027 | if (del_timer(&idev->mc_ifc_timer)) | ||
1028 | __in6_dev_put(idev); | ||
1029 | } | ||
1030 | |||
1017 | static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay) | 1031 | static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay) |
1018 | { | 1032 | { |
1019 | unsigned long tv = net_random() % delay; | 1033 | unsigned long tv = net_random() % delay; |
@@ -1022,6 +1036,12 @@ static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay) | |||
1022 | in6_dev_hold(idev); | 1036 | in6_dev_hold(idev); |
1023 | } | 1037 | } |
1024 | 1038 | ||
1039 | static void mld_dad_stop_timer(struct inet6_dev *idev) | ||
1040 | { | ||
1041 | if (del_timer(&idev->mc_dad_timer)) | ||
1042 | __in6_dev_put(idev); | ||
1043 | } | ||
1044 | |||
1025 | /* | 1045 | /* |
1026 | * IGMP handling (alias multicast ICMPv6 messages) | 1046 | * IGMP handling (alias multicast ICMPv6 messages) |
1027 | */ | 1047 | */ |
@@ -1234,15 +1254,9 @@ static int mld_process_v1(struct inet6_dev *idev, struct mld_msg *mld, | |||
1234 | mld_set_v1_mode(idev); | 1254 | mld_set_v1_mode(idev); |
1235 | 1255 | ||
1236 | /* cancel MLDv2 report timer */ | 1256 | /* cancel MLDv2 report timer */ |
1237 | idev->mc_gq_running = 0; | 1257 | mld_gq_stop_timer(idev); |
1238 | if (del_timer(&idev->mc_gq_timer)) | ||
1239 | __in6_dev_put(idev); | ||
1240 | |||
1241 | /* cancel the interface change timer */ | 1258 | /* cancel the interface change timer */ |
1242 | idev->mc_ifc_count = 0; | 1259 | mld_ifc_stop_timer(idev); |
1243 | if (del_timer(&idev->mc_ifc_timer)) | ||
1244 | __in6_dev_put(idev); | ||
1245 | |||
1246 | /* clear deleted report items */ | 1260 | /* clear deleted report items */ |
1247 | mld_clear_delrec(idev); | 1261 | mld_clear_delrec(idev); |
1248 | 1262 | ||
@@ -2434,14 +2448,9 @@ void ipv6_mc_down(struct inet6_dev *idev) | |||
2434 | /* Withdraw multicast list */ | 2448 | /* Withdraw multicast list */ |
2435 | 2449 | ||
2436 | read_lock_bh(&idev->lock); | 2450 | read_lock_bh(&idev->lock); |
2437 | idev->mc_ifc_count = 0; | 2451 | mld_ifc_stop_timer(idev); |
2438 | if (del_timer(&idev->mc_ifc_timer)) | 2452 | mld_gq_stop_timer(idev); |
2439 | __in6_dev_put(idev); | 2453 | mld_dad_stop_timer(idev); |
2440 | idev->mc_gq_running = 0; | ||
2441 | if (del_timer(&idev->mc_gq_timer)) | ||
2442 | __in6_dev_put(idev); | ||
2443 | if (del_timer(&idev->mc_dad_timer)) | ||
2444 | __in6_dev_put(idev); | ||
2445 | 2454 | ||
2446 | for (i = idev->mc_list; i; i=i->next) | 2455 | for (i = idev->mc_list; i; i=i->next) |
2447 | igmp6_group_dropped(i); | 2456 | igmp6_group_dropped(i); |