aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianjun Kong <jianjun@zeuux.org>2008-11-03 03:26:09 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-03 03:26:09 -0500
commita7e9ff735bd5e3437a8e5ecbbc2db3865974a523 (patch)
tree29107bc9cb4667fb341078ea4dbfa38b732b3728
parent6ed2533e55889943c478d11b1f63aaed2fd767cc (diff)
net: clean up net/ipv4/igmp.c
Signed-off-by: Jianjun Kong <jianjun@zeuux.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/igmp.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index a0d86455c53e..f92733e15c9f 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -167,7 +167,7 @@ static __inline__ void igmp_stop_timer(struct ip_mc_list *im)
167 spin_lock_bh(&im->lock); 167 spin_lock_bh(&im->lock);
168 if (del_timer(&im->timer)) 168 if (del_timer(&im->timer))
169 atomic_dec(&im->refcnt); 169 atomic_dec(&im->refcnt);
170 im->tm_running=0; 170 im->tm_running = 0;
171 im->reporter = 0; 171 im->reporter = 0;
172 im->unsolicit_count = 0; 172 im->unsolicit_count = 0;
173 spin_unlock_bh(&im->lock); 173 spin_unlock_bh(&im->lock);
@@ -176,9 +176,9 @@ static __inline__ void igmp_stop_timer(struct ip_mc_list *im)
176/* It must be called with locked im->lock */ 176/* It must be called with locked im->lock */
177static void igmp_start_timer(struct ip_mc_list *im, int max_delay) 177static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
178{ 178{
179 int tv=net_random() % max_delay; 179 int tv = net_random() % max_delay;
180 180
181 im->tm_running=1; 181 im->tm_running = 1;
182 if (!mod_timer(&im->timer, jiffies+tv+2)) 182 if (!mod_timer(&im->timer, jiffies+tv+2))
183 atomic_inc(&im->refcnt); 183 atomic_inc(&im->refcnt);
184} 184}
@@ -207,7 +207,7 @@ static void igmp_mod_timer(struct ip_mc_list *im, int max_delay)
207 if (del_timer(&im->timer)) { 207 if (del_timer(&im->timer)) {
208 if ((long)(im->timer.expires-jiffies) < max_delay) { 208 if ((long)(im->timer.expires-jiffies) < max_delay) {
209 add_timer(&im->timer); 209 add_timer(&im->timer);
210 im->tm_running=1; 210 im->tm_running = 1;
211 spin_unlock_bh(&im->lock); 211 spin_unlock_bh(&im->lock);
212 return; 212 return;
213 } 213 }
@@ -358,7 +358,7 @@ static int igmpv3_sendpack(struct sk_buff *skb)
358 358
359static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel) 359static int grec_size(struct ip_mc_list *pmc, int type, int gdel, int sdel)
360{ 360{
361 return sizeof(struct igmpv3_grec) + 4*igmp_scount(pmc,type,gdel,sdel); 361 return sizeof(struct igmpv3_grec) + 4*igmp_scount(pmc, type, gdel, sdel);
362} 362}
363 363
364static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, 364static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc,
@@ -653,7 +653,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
653 return -1; 653 return -1;
654 } 654 }
655 655
656 skb=alloc_skb(IGMP_SIZE+LL_ALLOCATED_SPACE(dev), GFP_ATOMIC); 656 skb = alloc_skb(IGMP_SIZE+LL_ALLOCATED_SPACE(dev), GFP_ATOMIC);
657 if (skb == NULL) { 657 if (skb == NULL) {
658 ip_rt_put(rt); 658 ip_rt_put(rt);
659 return -1; 659 return -1;
@@ -682,11 +682,11 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
682 ((u8*)&iph[1])[3] = 0; 682 ((u8*)&iph[1])[3] = 0;
683 683
684 ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr)); 684 ih = (struct igmphdr *)skb_put(skb, sizeof(struct igmphdr));
685 ih->type=type; 685 ih->type = type;
686 ih->code=0; 686 ih->code = 0;
687 ih->csum=0; 687 ih->csum = 0;
688 ih->group=group; 688 ih->group = group;
689 ih->csum=ip_compute_csum((void *)ih, sizeof(struct igmphdr)); 689 ih->csum = ip_compute_csum((void *)ih, sizeof(struct igmphdr));
690 690
691 return ip_local_out(skb); 691 return ip_local_out(skb);
692} 692}
@@ -728,7 +728,7 @@ static void igmp_timer_expire(unsigned long data)
728 struct in_device *in_dev = im->interface; 728 struct in_device *in_dev = im->interface;
729 729
730 spin_lock(&im->lock); 730 spin_lock(&im->lock);
731 im->tm_running=0; 731 im->tm_running = 0;
732 732
733 if (im->unsolicit_count) { 733 if (im->unsolicit_count) {
734 im->unsolicit_count--; 734 im->unsolicit_count--;
@@ -997,7 +997,7 @@ static void ip_mc_filter_add(struct in_device *in_dev, __be32 addr)
997 --ANK 997 --ANK
998 */ 998 */
999 if (arp_mc_map(addr, buf, dev, 0) == 0) 999 if (arp_mc_map(addr, buf, dev, 0) == 0)
1000 dev_mc_add(dev,buf,dev->addr_len,0); 1000 dev_mc_add(dev, buf, dev->addr_len, 0);
1001} 1001}
1002 1002
1003/* 1003/*
@@ -1010,7 +1010,7 @@ static void ip_mc_filter_del(struct in_device *in_dev, __be32 addr)
1010 struct net_device *dev = in_dev->dev; 1010 struct net_device *dev = in_dev->dev;
1011 1011
1012 if (arp_mc_map(addr, buf, dev, 0) == 0) 1012 if (arp_mc_map(addr, buf, dev, 0) == 0)
1013 dev_mc_delete(dev,buf,dev->addr_len,0); 1013 dev_mc_delete(dev, buf, dev->addr_len, 0);
1014} 1014}
1015 1015
1016#ifdef CONFIG_IP_MULTICAST 1016#ifdef CONFIG_IP_MULTICAST
@@ -1210,10 +1210,10 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1210 if (!im) 1210 if (!im)
1211 goto out; 1211 goto out;
1212 1212
1213 im->users=1; 1213 im->users = 1;
1214 im->interface=in_dev; 1214 im->interface = in_dev;
1215 in_dev_hold(in_dev); 1215 in_dev_hold(in_dev);
1216 im->multiaddr=addr; 1216 im->multiaddr = addr;
1217 /* initial mode is (EX, empty) */ 1217 /* initial mode is (EX, empty) */
1218 im->sfmode = MCAST_EXCLUDE; 1218 im->sfmode = MCAST_EXCLUDE;
1219 im->sfcount[MCAST_INCLUDE] = 0; 1219 im->sfcount[MCAST_INCLUDE] = 0;
@@ -1224,7 +1224,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1224 atomic_set(&im->refcnt, 1); 1224 atomic_set(&im->refcnt, 1);
1225 spin_lock_init(&im->lock); 1225 spin_lock_init(&im->lock);
1226#ifdef CONFIG_IP_MULTICAST 1226#ifdef CONFIG_IP_MULTICAST
1227 im->tm_running=0; 1227 im->tm_running = 0;
1228 setup_timer(&im->timer, &igmp_timer_expire, (unsigned long)im); 1228 setup_timer(&im->timer, &igmp_timer_expire, (unsigned long)im);
1229 im->unsolicit_count = IGMP_Unsolicited_Report_Count; 1229 im->unsolicit_count = IGMP_Unsolicited_Report_Count;
1230 im->reporter = 0; 1230 im->reporter = 0;
@@ -1232,8 +1232,8 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1232#endif 1232#endif
1233 im->loaded = 0; 1233 im->loaded = 0;
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 in_dev->mc_count++;
1238 write_unlock_bh(&in_dev->mc_list_lock); 1238 write_unlock_bh(&in_dev->mc_list_lock);
1239#ifdef CONFIG_IP_MULTICAST 1239#ifdef CONFIG_IP_MULTICAST
@@ -1279,7 +1279,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
1279 ASSERT_RTNL(); 1279 ASSERT_RTNL();
1280 1280
1281 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { 1281 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
1282 if (i->multiaddr==addr) { 1282 if (i->multiaddr == addr) {
1283 if (--i->users == 0) { 1283 if (--i->users == 0) {
1284 write_lock_bh(&in_dev->mc_list_lock); 1284 write_lock_bh(&in_dev->mc_list_lock);
1285 *ip = i->next; 1285 *ip = i->next;
@@ -1738,7 +1738,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
1738{ 1738{
1739 int err; 1739 int err;
1740 __be32 addr = imr->imr_multiaddr.s_addr; 1740 __be32 addr = imr->imr_multiaddr.s_addr;
1741 struct ip_mc_socklist *iml=NULL, *i; 1741 struct ip_mc_socklist *iml = NULL, *i;
1742 struct in_device *in_dev; 1742 struct in_device *in_dev;
1743 struct inet_sock *inet = inet_sk(sk); 1743 struct inet_sock *inet = inet_sk(sk);
1744 struct net *net = sock_net(sk); 1744 struct net *net = sock_net(sk);
@@ -1769,7 +1769,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
1769 err = -ENOBUFS; 1769 err = -ENOBUFS;
1770 if (count >= sysctl_igmp_max_memberships) 1770 if (count >= sysctl_igmp_max_memberships)
1771 goto done; 1771 goto done;
1772 iml = sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL); 1772 iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL);
1773 if (iml == NULL) 1773 if (iml == NULL)
1774 goto done; 1774 goto done;
1775 1775