diff options
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r-- | net/ipv4/igmp.c | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 7defdc9ba167..97e4d1655d26 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -211,7 +211,7 @@ static void igmp_stop_timer(struct ip_mc_list *im) | |||
211 | /* It must be called with locked im->lock */ | 211 | /* It must be called with locked im->lock */ |
212 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | 212 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) |
213 | { | 213 | { |
214 | int tv = net_random() % max_delay; | 214 | int tv = prandom_u32() % max_delay; |
215 | 215 | ||
216 | im->tm_running = 1; | 216 | im->tm_running = 1; |
217 | if (!mod_timer(&im->timer, jiffies+tv+2)) | 217 | if (!mod_timer(&im->timer, jiffies+tv+2)) |
@@ -220,7 +220,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | |||
220 | 220 | ||
221 | static void igmp_gq_start_timer(struct in_device *in_dev) | 221 | static void igmp_gq_start_timer(struct in_device *in_dev) |
222 | { | 222 | { |
223 | int tv = net_random() % in_dev->mr_maxdelay; | 223 | int tv = prandom_u32() % in_dev->mr_maxdelay; |
224 | 224 | ||
225 | in_dev->mr_gq_running = 1; | 225 | in_dev->mr_gq_running = 1; |
226 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) | 226 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) |
@@ -229,7 +229,7 @@ static void igmp_gq_start_timer(struct in_device *in_dev) | |||
229 | 229 | ||
230 | static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) | 230 | static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) |
231 | { | 231 | { |
232 | int tv = net_random() % delay; | 232 | int tv = prandom_u32() % delay; |
233 | 233 | ||
234 | if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) | 234 | if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) |
235 | in_dev_hold(in_dev); | 235 | in_dev_hold(in_dev); |
@@ -310,7 +310,7 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted) | |||
310 | struct ip_sf_list *psf; | 310 | struct ip_sf_list *psf; |
311 | int scount = 0; | 311 | int scount = 0; |
312 | 312 | ||
313 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 313 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
314 | if (!is_in(pmc, psf, type, gdeleted, sdeleted)) | 314 | if (!is_in(pmc, psf, type, gdeleted, sdeleted)) |
315 | continue; | 315 | continue; |
316 | scount++; | 316 | scount++; |
@@ -463,7 +463,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
463 | } | 463 | } |
464 | first = 1; | 464 | first = 1; |
465 | psf_prev = NULL; | 465 | psf_prev = NULL; |
466 | for (psf=*psf_list; psf; psf=psf_next) { | 466 | for (psf = *psf_list; psf; psf = psf_next) { |
467 | __be32 *psrc; | 467 | __be32 *psrc; |
468 | 468 | ||
469 | psf_next = psf->sf_next; | 469 | psf_next = psf->sf_next; |
@@ -520,7 +520,7 @@ empty_source: | |||
520 | return skb; | 520 | return skb; |
521 | if (pmc->crcount || isquery) { | 521 | if (pmc->crcount || isquery) { |
522 | /* make sure we have room for group header */ | 522 | /* make sure we have room for group header */ |
523 | if (skb && AVAILABLE(skb)<sizeof(struct igmpv3_grec)) { | 523 | if (skb && AVAILABLE(skb) < sizeof(struct igmpv3_grec)) { |
524 | igmpv3_sendpack(skb); | 524 | igmpv3_sendpack(skb); |
525 | skb = NULL; /* add_grhead will get a new one */ | 525 | skb = NULL; /* add_grhead will get a new one */ |
526 | } | 526 | } |
@@ -576,7 +576,7 @@ static void igmpv3_clear_zeros(struct ip_sf_list **ppsf) | |||
576 | struct ip_sf_list *psf_prev, *psf_next, *psf; | 576 | struct ip_sf_list *psf_prev, *psf_next, *psf; |
577 | 577 | ||
578 | psf_prev = NULL; | 578 | psf_prev = NULL; |
579 | for (psf=*ppsf; psf; psf = psf_next) { | 579 | for (psf = *ppsf; psf; psf = psf_next) { |
580 | psf_next = psf->sf_next; | 580 | psf_next = psf->sf_next; |
581 | if (psf->sf_crcount == 0) { | 581 | if (psf->sf_crcount == 0) { |
582 | if (psf_prev) | 582 | if (psf_prev) |
@@ -600,7 +600,7 @@ static void igmpv3_send_cr(struct in_device *in_dev) | |||
600 | 600 | ||
601 | /* deleted MCA's */ | 601 | /* deleted MCA's */ |
602 | pmc_prev = NULL; | 602 | pmc_prev = NULL; |
603 | for (pmc=in_dev->mc_tomb; pmc; pmc=pmc_next) { | 603 | for (pmc = in_dev->mc_tomb; pmc; pmc = pmc_next) { |
604 | pmc_next = pmc->next; | 604 | pmc_next = pmc->next; |
605 | if (pmc->sfmode == MCAST_INCLUDE) { | 605 | if (pmc->sfmode == MCAST_INCLUDE) { |
606 | type = IGMPV3_BLOCK_OLD_SOURCES; | 606 | type = IGMPV3_BLOCK_OLD_SOURCES; |
@@ -764,7 +764,7 @@ static void igmp_ifc_event(struct in_device *in_dev) | |||
764 | 764 | ||
765 | static void igmp_timer_expire(unsigned long data) | 765 | static void igmp_timer_expire(unsigned long data) |
766 | { | 766 | { |
767 | struct ip_mc_list *im=(struct ip_mc_list *)data; | 767 | struct ip_mc_list *im = (struct ip_mc_list *)data; |
768 | struct in_device *in_dev = im->interface; | 768 | struct in_device *in_dev = im->interface; |
769 | 769 | ||
770 | spin_lock(&im->lock); | 770 | spin_lock(&im->lock); |
@@ -794,10 +794,10 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) | |||
794 | int i, scount; | 794 | int i, scount; |
795 | 795 | ||
796 | scount = 0; | 796 | scount = 0; |
797 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 797 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
798 | if (scount == nsrcs) | 798 | if (scount == nsrcs) |
799 | break; | 799 | break; |
800 | for (i=0; i<nsrcs; i++) { | 800 | for (i = 0; i < nsrcs; i++) { |
801 | /* skip inactive filters */ | 801 | /* skip inactive filters */ |
802 | if (psf->sf_count[MCAST_INCLUDE] || | 802 | if (psf->sf_count[MCAST_INCLUDE] || |
803 | pmc->sfcount[MCAST_EXCLUDE] != | 803 | pmc->sfcount[MCAST_EXCLUDE] != |
@@ -825,10 +825,10 @@ static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) | |||
825 | 825 | ||
826 | /* mark INCLUDE-mode sources */ | 826 | /* mark INCLUDE-mode sources */ |
827 | scount = 0; | 827 | scount = 0; |
828 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 828 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
829 | if (scount == nsrcs) | 829 | if (scount == nsrcs) |
830 | break; | 830 | break; |
831 | for (i=0; i<nsrcs; i++) | 831 | for (i = 0; i < nsrcs; i++) |
832 | if (srcs[i] == psf->sf_inaddr) { | 832 | if (srcs[i] == psf->sf_inaddr) { |
833 | psf->sf_gsresp = 1; | 833 | psf->sf_gsresp = 1; |
834 | scount++; | 834 | scount++; |
@@ -1103,7 +1103,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
1103 | pmc->tomb = im->tomb; | 1103 | pmc->tomb = im->tomb; |
1104 | pmc->sources = im->sources; | 1104 | pmc->sources = im->sources; |
1105 | im->tomb = im->sources = NULL; | 1105 | im->tomb = im->sources = NULL; |
1106 | for (psf=pmc->sources; psf; psf=psf->sf_next) | 1106 | for (psf = pmc->sources; psf; psf = psf->sf_next) |
1107 | psf->sf_crcount = pmc->crcount; | 1107 | psf->sf_crcount = pmc->crcount; |
1108 | } | 1108 | } |
1109 | spin_unlock_bh(&im->lock); | 1109 | spin_unlock_bh(&im->lock); |
@@ -1121,7 +1121,7 @@ static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr) | |||
1121 | 1121 | ||
1122 | spin_lock_bh(&in_dev->mc_tomb_lock); | 1122 | spin_lock_bh(&in_dev->mc_tomb_lock); |
1123 | pmc_prev = NULL; | 1123 | pmc_prev = NULL; |
1124 | for (pmc=in_dev->mc_tomb; pmc; pmc=pmc->next) { | 1124 | for (pmc = in_dev->mc_tomb; pmc; pmc = pmc->next) { |
1125 | if (pmc->multiaddr == multiaddr) | 1125 | if (pmc->multiaddr == multiaddr) |
1126 | break; | 1126 | break; |
1127 | pmc_prev = pmc; | 1127 | pmc_prev = pmc; |
@@ -1134,7 +1134,7 @@ static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr) | |||
1134 | } | 1134 | } |
1135 | spin_unlock_bh(&in_dev->mc_tomb_lock); | 1135 | spin_unlock_bh(&in_dev->mc_tomb_lock); |
1136 | if (pmc) { | 1136 | if (pmc) { |
1137 | for (psf=pmc->tomb; psf; psf=psf_next) { | 1137 | for (psf = pmc->tomb; psf; psf = psf_next) { |
1138 | psf_next = psf->sf_next; | 1138 | psf_next = psf->sf_next; |
1139 | kfree(psf); | 1139 | kfree(psf); |
1140 | } | 1140 | } |
@@ -1167,7 +1167,7 @@ static void igmpv3_clear_delrec(struct in_device *in_dev) | |||
1167 | psf = pmc->tomb; | 1167 | psf = pmc->tomb; |
1168 | pmc->tomb = NULL; | 1168 | pmc->tomb = NULL; |
1169 | spin_unlock_bh(&pmc->lock); | 1169 | spin_unlock_bh(&pmc->lock); |
1170 | for (; psf; psf=psf_next) { | 1170 | for (; psf; psf = psf_next) { |
1171 | psf_next = psf->sf_next; | 1171 | psf_next = psf->sf_next; |
1172 | kfree(psf); | 1172 | kfree(psf); |
1173 | } | 1173 | } |
@@ -1557,7 +1557,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, | |||
1557 | int rv = 0; | 1557 | int rv = 0; |
1558 | 1558 | ||
1559 | psf_prev = NULL; | 1559 | psf_prev = NULL; |
1560 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 1560 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
1561 | if (psf->sf_inaddr == *psfsrc) | 1561 | if (psf->sf_inaddr == *psfsrc) |
1562 | break; | 1562 | break; |
1563 | psf_prev = psf; | 1563 | psf_prev = psf; |
@@ -1630,7 +1630,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1630 | pmc->sfcount[sfmode]--; | 1630 | pmc->sfcount[sfmode]--; |
1631 | } | 1631 | } |
1632 | err = 0; | 1632 | err = 0; |
1633 | for (i=0; i<sfcount; i++) { | 1633 | for (i = 0; i < sfcount; i++) { |
1634 | int rv = ip_mc_del1_src(pmc, sfmode, &psfsrc[i]); | 1634 | int rv = ip_mc_del1_src(pmc, sfmode, &psfsrc[i]); |
1635 | 1635 | ||
1636 | changerec |= rv > 0; | 1636 | changerec |= rv > 0; |
@@ -1650,7 +1650,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1650 | pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : | 1650 | pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : |
1651 | IGMP_Unsolicited_Report_Count; | 1651 | IGMP_Unsolicited_Report_Count; |
1652 | in_dev->mr_ifc_count = pmc->crcount; | 1652 | in_dev->mr_ifc_count = pmc->crcount; |
1653 | for (psf=pmc->sources; psf; psf = psf->sf_next) | 1653 | for (psf = pmc->sources; psf; psf = psf->sf_next) |
1654 | psf->sf_crcount = 0; | 1654 | psf->sf_crcount = 0; |
1655 | igmp_ifc_event(pmc->interface); | 1655 | igmp_ifc_event(pmc->interface); |
1656 | } else if (sf_setstate(pmc) || changerec) { | 1656 | } else if (sf_setstate(pmc) || changerec) { |
@@ -1671,7 +1671,7 @@ static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, | |||
1671 | struct ip_sf_list *psf, *psf_prev; | 1671 | struct ip_sf_list *psf, *psf_prev; |
1672 | 1672 | ||
1673 | psf_prev = NULL; | 1673 | psf_prev = NULL; |
1674 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 1674 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
1675 | if (psf->sf_inaddr == *psfsrc) | 1675 | if (psf->sf_inaddr == *psfsrc) |
1676 | break; | 1676 | break; |
1677 | psf_prev = psf; | 1677 | psf_prev = psf; |
@@ -1699,7 +1699,7 @@ static void sf_markstate(struct ip_mc_list *pmc) | |||
1699 | struct ip_sf_list *psf; | 1699 | struct ip_sf_list *psf; |
1700 | int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; | 1700 | int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; |
1701 | 1701 | ||
1702 | for (psf=pmc->sources; psf; psf=psf->sf_next) | 1702 | for (psf = pmc->sources; psf; psf = psf->sf_next) |
1703 | if (pmc->sfcount[MCAST_EXCLUDE]) { | 1703 | if (pmc->sfcount[MCAST_EXCLUDE]) { |
1704 | psf->sf_oldin = mca_xcount == | 1704 | psf->sf_oldin = mca_xcount == |
1705 | psf->sf_count[MCAST_EXCLUDE] && | 1705 | psf->sf_count[MCAST_EXCLUDE] && |
@@ -1716,7 +1716,7 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1716 | int new_in, rv; | 1716 | int new_in, rv; |
1717 | 1717 | ||
1718 | rv = 0; | 1718 | rv = 0; |
1719 | for (psf=pmc->sources; psf; psf=psf->sf_next) { | 1719 | for (psf = pmc->sources; psf; psf = psf->sf_next) { |
1720 | if (pmc->sfcount[MCAST_EXCLUDE]) { | 1720 | if (pmc->sfcount[MCAST_EXCLUDE]) { |
1721 | new_in = mca_xcount == psf->sf_count[MCAST_EXCLUDE] && | 1721 | new_in = mca_xcount == psf->sf_count[MCAST_EXCLUDE] && |
1722 | !psf->sf_count[MCAST_INCLUDE]; | 1722 | !psf->sf_count[MCAST_INCLUDE]; |
@@ -1726,7 +1726,7 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1726 | if (!psf->sf_oldin) { | 1726 | if (!psf->sf_oldin) { |
1727 | struct ip_sf_list *prev = NULL; | 1727 | struct ip_sf_list *prev = NULL; |
1728 | 1728 | ||
1729 | for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { | 1729 | for (dpsf = pmc->tomb; dpsf; dpsf = dpsf->sf_next) { |
1730 | if (dpsf->sf_inaddr == psf->sf_inaddr) | 1730 | if (dpsf->sf_inaddr == psf->sf_inaddr) |
1731 | break; | 1731 | break; |
1732 | prev = dpsf; | 1732 | prev = dpsf; |
@@ -1748,7 +1748,7 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1748 | * add or update "delete" records if an active filter | 1748 | * add or update "delete" records if an active filter |
1749 | * is now inactive | 1749 | * is now inactive |
1750 | */ | 1750 | */ |
1751 | for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) | 1751 | for (dpsf = pmc->tomb; dpsf; dpsf = dpsf->sf_next) |
1752 | if (dpsf->sf_inaddr == psf->sf_inaddr) | 1752 | if (dpsf->sf_inaddr == psf->sf_inaddr) |
1753 | break; | 1753 | break; |
1754 | if (!dpsf) { | 1754 | if (!dpsf) { |
@@ -1800,7 +1800,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1800 | if (!delta) | 1800 | if (!delta) |
1801 | pmc->sfcount[sfmode]++; | 1801 | pmc->sfcount[sfmode]++; |
1802 | err = 0; | 1802 | err = 0; |
1803 | for (i=0; i<sfcount; i++) { | 1803 | for (i = 0; i < sfcount; i++) { |
1804 | err = ip_mc_add1_src(pmc, sfmode, &psfsrc[i]); | 1804 | err = ip_mc_add1_src(pmc, sfmode, &psfsrc[i]); |
1805 | if (err) | 1805 | if (err) |
1806 | break; | 1806 | break; |
@@ -1810,7 +1810,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1810 | 1810 | ||
1811 | if (!delta) | 1811 | if (!delta) |
1812 | pmc->sfcount[sfmode]--; | 1812 | pmc->sfcount[sfmode]--; |
1813 | for (j=0; j<i; j++) | 1813 | for (j = 0; j < i; j++) |
1814 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); | 1814 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
1815 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { | 1815 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { |
1816 | #ifdef CONFIG_IP_MULTICAST | 1816 | #ifdef CONFIG_IP_MULTICAST |
@@ -1829,7 +1829,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1829 | pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : | 1829 | pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : |
1830 | IGMP_Unsolicited_Report_Count; | 1830 | IGMP_Unsolicited_Report_Count; |
1831 | in_dev->mr_ifc_count = pmc->crcount; | 1831 | in_dev->mr_ifc_count = pmc->crcount; |
1832 | for (psf=pmc->sources; psf; psf = psf->sf_next) | 1832 | for (psf = pmc->sources; psf; psf = psf->sf_next) |
1833 | psf->sf_crcount = 0; | 1833 | psf->sf_crcount = 0; |
1834 | igmp_ifc_event(in_dev); | 1834 | igmp_ifc_event(in_dev); |
1835 | } else if (sf_setstate(pmc)) { | 1835 | } else if (sf_setstate(pmc)) { |
@@ -1844,12 +1844,12 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc) | |||
1844 | { | 1844 | { |
1845 | struct ip_sf_list *psf, *nextpsf; | 1845 | struct ip_sf_list *psf, *nextpsf; |
1846 | 1846 | ||
1847 | for (psf=pmc->tomb; psf; psf=nextpsf) { | 1847 | for (psf = pmc->tomb; psf; psf = nextpsf) { |
1848 | nextpsf = psf->sf_next; | 1848 | nextpsf = psf->sf_next; |
1849 | kfree(psf); | 1849 | kfree(psf); |
1850 | } | 1850 | } |
1851 | pmc->tomb = NULL; | 1851 | pmc->tomb = NULL; |
1852 | for (psf=pmc->sources; psf; psf=nextpsf) { | 1852 | for (psf = pmc->sources; psf; psf = nextpsf) { |
1853 | nextpsf = psf->sf_next; | 1853 | nextpsf = psf->sf_next; |
1854 | kfree(psf); | 1854 | kfree(psf); |
1855 | } | 1855 | } |
@@ -2043,7 +2043,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
2043 | if (!psl) | 2043 | if (!psl) |
2044 | goto done; /* err = -EADDRNOTAVAIL */ | 2044 | goto done; /* err = -EADDRNOTAVAIL */ |
2045 | rv = !0; | 2045 | rv = !0; |
2046 | for (i=0; i<psl->sl_count; i++) { | 2046 | for (i = 0; i < psl->sl_count; i++) { |
2047 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 2047 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
2048 | sizeof(__be32)); | 2048 | sizeof(__be32)); |
2049 | if (rv == 0) | 2049 | if (rv == 0) |
@@ -2062,7 +2062,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
2062 | ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1, | 2062 | ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1, |
2063 | &mreqs->imr_sourceaddr, 1); | 2063 | &mreqs->imr_sourceaddr, 1); |
2064 | 2064 | ||
2065 | for (j=i+1; j<psl->sl_count; j++) | 2065 | for (j = i+1; j < psl->sl_count; j++) |
2066 | psl->sl_addr[j-1] = psl->sl_addr[j]; | 2066 | psl->sl_addr[j-1] = psl->sl_addr[j]; |
2067 | psl->sl_count--; | 2067 | psl->sl_count--; |
2068 | err = 0; | 2068 | err = 0; |
@@ -2088,7 +2088,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
2088 | newpsl->sl_max = count; | 2088 | newpsl->sl_max = count; |
2089 | newpsl->sl_count = count - IP_SFBLOCK; | 2089 | newpsl->sl_count = count - IP_SFBLOCK; |
2090 | if (psl) { | 2090 | if (psl) { |
2091 | for (i=0; i<psl->sl_count; i++) | 2091 | for (i = 0; i < psl->sl_count; i++) |
2092 | newpsl->sl_addr[i] = psl->sl_addr[i]; | 2092 | newpsl->sl_addr[i] = psl->sl_addr[i]; |
2093 | /* decrease mem now to avoid the memleak warning */ | 2093 | /* decrease mem now to avoid the memleak warning */ |
2094 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); | 2094 | atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); |
@@ -2098,7 +2098,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
2098 | psl = newpsl; | 2098 | psl = newpsl; |
2099 | } | 2099 | } |
2100 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ | 2100 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ |
2101 | for (i=0; i<psl->sl_count; i++) { | 2101 | for (i = 0; i < psl->sl_count; i++) { |
2102 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 2102 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
2103 | sizeof(__be32)); | 2103 | sizeof(__be32)); |
2104 | if (rv == 0) | 2104 | if (rv == 0) |
@@ -2106,7 +2106,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
2106 | } | 2106 | } |
2107 | if (rv == 0) /* address already there is an error */ | 2107 | if (rv == 0) /* address already there is an error */ |
2108 | goto done; | 2108 | goto done; |
2109 | for (j=psl->sl_count-1; j>=i; j--) | 2109 | for (j = psl->sl_count-1; j >= i; j--) |
2110 | psl->sl_addr[j+1] = psl->sl_addr[j]; | 2110 | psl->sl_addr[j+1] = psl->sl_addr[j]; |
2111 | psl->sl_addr[i] = mreqs->imr_sourceaddr; | 2111 | psl->sl_addr[i] = mreqs->imr_sourceaddr; |
2112 | psl->sl_count++; | 2112 | psl->sl_count++; |
@@ -2305,7 +2305,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | |||
2305 | copy_to_user(optval, gsf, GROUP_FILTER_SIZE(0))) { | 2305 | copy_to_user(optval, gsf, GROUP_FILTER_SIZE(0))) { |
2306 | return -EFAULT; | 2306 | return -EFAULT; |
2307 | } | 2307 | } |
2308 | for (i=0; i<copycount; i++) { | 2308 | for (i = 0; i < copycount; i++) { |
2309 | struct sockaddr_storage ss; | 2309 | struct sockaddr_storage ss; |
2310 | 2310 | ||
2311 | psin = (struct sockaddr_in *)&ss; | 2311 | psin = (struct sockaddr_in *)&ss; |
@@ -2350,7 +2350,7 @@ int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif) | |||
2350 | if (!psl) | 2350 | if (!psl) |
2351 | goto unlock; | 2351 | goto unlock; |
2352 | 2352 | ||
2353 | for (i=0; i<psl->sl_count; i++) { | 2353 | for (i = 0; i < psl->sl_count; i++) { |
2354 | if (psl->sl_addr[i] == rmt_addr) | 2354 | if (psl->sl_addr[i] == rmt_addr) |
2355 | break; | 2355 | break; |
2356 | } | 2356 | } |
@@ -2423,7 +2423,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u | |||
2423 | rv = 1; | 2423 | rv = 1; |
2424 | } else if (im) { | 2424 | } else if (im) { |
2425 | if (src_addr) { | 2425 | if (src_addr) { |
2426 | for (psf=im->sources; psf; psf=psf->sf_next) { | 2426 | for (psf = im->sources; psf; psf = psf->sf_next) { |
2427 | if (psf->sf_inaddr == src_addr) | 2427 | if (psf->sf_inaddr == src_addr) |
2428 | break; | 2428 | break; |
2429 | } | 2429 | } |
@@ -2762,6 +2762,7 @@ static struct pernet_operations igmp_net_ops = { | |||
2762 | .init = igmp_net_init, | 2762 | .init = igmp_net_init, |
2763 | .exit = igmp_net_exit, | 2763 | .exit = igmp_net_exit, |
2764 | }; | 2764 | }; |
2765 | #endif | ||
2765 | 2766 | ||
2766 | static int igmp_netdev_event(struct notifier_block *this, | 2767 | static int igmp_netdev_event(struct notifier_block *this, |
2767 | unsigned long event, void *ptr) | 2768 | unsigned long event, void *ptr) |
@@ -2785,8 +2786,9 @@ static struct notifier_block igmp_notifier = { | |||
2785 | .notifier_call = igmp_netdev_event, | 2786 | .notifier_call = igmp_netdev_event, |
2786 | }; | 2787 | }; |
2787 | 2788 | ||
2788 | int __init igmp_mc_proc_init(void) | 2789 | int __init igmp_mc_init(void) |
2789 | { | 2790 | { |
2791 | #if defined(CONFIG_PROC_FS) | ||
2790 | int err; | 2792 | int err; |
2791 | 2793 | ||
2792 | err = register_pernet_subsys(&igmp_net_ops); | 2794 | err = register_pernet_subsys(&igmp_net_ops); |
@@ -2800,5 +2802,7 @@ int __init igmp_mc_proc_init(void) | |||
2800 | reg_notif_fail: | 2802 | reg_notif_fail: |
2801 | unregister_pernet_subsys(&igmp_net_ops); | 2803 | unregister_pernet_subsys(&igmp_net_ops); |
2802 | return err; | 2804 | return err; |
2803 | } | 2805 | #else |
2806 | return register_netdevice_notifier(&igmp_notifier); | ||
2804 | #endif | 2807 | #endif |
2808 | } | ||