aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipmr.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r--net/ipv4/ipmr.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index ecb5422ea237..a099000cd132 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -241,7 +241,7 @@ failure:
241/* 241/*
242 * Delete a VIF entry 242 * Delete a VIF entry
243 */ 243 */
244 244
245static int vif_delete(int vifi) 245static int vif_delete(int vifi)
246{ 246{
247 struct vif_device *v; 247 struct vif_device *v;
@@ -409,7 +409,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
409 return -ENOBUFS; 409 return -ENOBUFS;
410 break; 410 break;
411#endif 411#endif
412 case VIFF_TUNNEL: 412 case VIFF_TUNNEL:
413 dev = ipmr_new_tunnel(vifc); 413 dev = ipmr_new_tunnel(vifc);
414 if (!dev) 414 if (!dev)
415 return -ENOBUFS; 415 return -ENOBUFS;
@@ -501,7 +501,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void)
501/* 501/*
502 * A cache entry has gone into a resolved state from queued 502 * A cache entry has gone into a resolved state from queued
503 */ 503 */
504 504
505static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) 505static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
506{ 506{
507 struct sk_buff *skb; 507 struct sk_buff *skb;
@@ -538,7 +538,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
538 * 538 *
539 * Called under mrt_lock. 539 * Called under mrt_lock.
540 */ 540 */
541 541
542static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) 542static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
543{ 543{
544 struct sk_buff *skb; 544 struct sk_buff *skb;
@@ -569,13 +569,13 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
569 memcpy(msg, pkt->nh.raw, sizeof(struct iphdr)); 569 memcpy(msg, pkt->nh.raw, sizeof(struct iphdr));
570 msg->im_msgtype = IGMPMSG_WHOLEPKT; 570 msg->im_msgtype = IGMPMSG_WHOLEPKT;
571 msg->im_mbz = 0; 571 msg->im_mbz = 0;
572 msg->im_vif = reg_vif_num; 572 msg->im_vif = reg_vif_num;
573 skb->nh.iph->ihl = sizeof(struct iphdr) >> 2; 573 skb->nh.iph->ihl = sizeof(struct iphdr) >> 2;
574 skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr)); 574 skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr));
575 } else 575 } else
576#endif 576#endif
577 { 577 {
578 578
579 /* 579 /*
580 * Copy the IP header 580 * Copy the IP header
581 */ 581 */
@@ -597,7 +597,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
597 igmp->code = 0; 597 igmp->code = 0;
598 skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */ 598 skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */
599 skb->h.raw = skb->nh.raw; 599 skb->h.raw = skb->nh.raw;
600 } 600 }
601 601
602 if (mroute_socket == NULL) { 602 if (mroute_socket == NULL) {
603 kfree_skb(skb); 603 kfree_skb(skb);
@@ -619,7 +619,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
619/* 619/*
620 * Queue a packet for resolution. It gets locked cache entry! 620 * Queue a packet for resolution. It gets locked cache entry!
621 */ 621 */
622 622
623static int 623static int
624ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) 624ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
625{ 625{
@@ -657,7 +657,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
657 * Reflect first query at mrouted. 657 * Reflect first query at mrouted.
658 */ 658 */
659 if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) { 659 if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) {
660 /* If the report failed throw the cache entry 660 /* If the report failed throw the cache entry
661 out - Brad Parker 661 out - Brad Parker
662 */ 662 */
663 spin_unlock_bh(&mfc_unres_lock); 663 spin_unlock_bh(&mfc_unres_lock);
@@ -783,11 +783,11 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
783/* 783/*
784 * Close the multicast socket, and clear the vif tables etc 784 * Close the multicast socket, and clear the vif tables etc
785 */ 785 */
786 786
787static void mroute_clean_tables(struct sock *sk) 787static void mroute_clean_tables(struct sock *sk)
788{ 788{
789 int i; 789 int i;
790 790
791 /* 791 /*
792 * Shut down all active vif entries 792 * Shut down all active vif entries
793 */ 793 */
@@ -854,13 +854,13 @@ static void mrtsock_destruct(struct sock *sk)
854 * that's how BSD mrouted happens to think. Maybe one day with a proper 854 * that's how BSD mrouted happens to think. Maybe one day with a proper
855 * MOSPF/PIM router set up we can clean this up. 855 * MOSPF/PIM router set up we can clean this up.
856 */ 856 */
857 857
858int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen) 858int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen)
859{ 859{
860 int ret; 860 int ret;
861 struct vifctl vif; 861 struct vifctl vif;
862 struct mfcctl mfc; 862 struct mfcctl mfc;
863 863
864 if(optname!=MRT_INIT) 864 if(optname!=MRT_INIT)
865 { 865 {
866 if(sk!=mroute_socket && !capable(CAP_NET_ADMIN)) 866 if(sk!=mroute_socket && !capable(CAP_NET_ADMIN))
@@ -901,7 +901,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
901 if(optlen!=sizeof(vif)) 901 if(optlen!=sizeof(vif))
902 return -EINVAL; 902 return -EINVAL;
903 if (copy_from_user(&vif,optval,sizeof(vif))) 903 if (copy_from_user(&vif,optval,sizeof(vif)))
904 return -EFAULT; 904 return -EFAULT;
905 if(vif.vifc_vifi >= MAXVIFS) 905 if(vif.vifc_vifi >= MAXVIFS)
906 return -ENFILE; 906 return -ENFILE;
907 rtnl_lock(); 907 rtnl_lock();
@@ -980,13 +980,13 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
980/* 980/*
981 * Getsock opt support for the multicast routing system. 981 * Getsock opt support for the multicast routing system.
982 */ 982 */
983 983
984int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen) 984int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen)
985{ 985{
986 int olr; 986 int olr;
987 int val; 987 int val;
988 988
989 if(optname!=MRT_VERSION && 989 if(optname!=MRT_VERSION &&
990#ifdef CONFIG_IP_PIMSM 990#ifdef CONFIG_IP_PIMSM
991 optname!=MRT_PIM && 991 optname!=MRT_PIM &&
992#endif 992#endif
@@ -999,7 +999,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
999 olr = min_t(unsigned int, olr, sizeof(int)); 999 olr = min_t(unsigned int, olr, sizeof(int));
1000 if (olr < 0) 1000 if (olr < 0)
1001 return -EINVAL; 1001 return -EINVAL;
1002 1002
1003 if(put_user(olr,optlen)) 1003 if(put_user(olr,optlen))
1004 return -EFAULT; 1004 return -EFAULT;
1005 if(optname==MRT_VERSION) 1005 if(optname==MRT_VERSION)
@@ -1018,19 +1018,19 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
1018/* 1018/*
1019 * The IP multicast ioctl support routines. 1019 * The IP multicast ioctl support routines.
1020 */ 1020 */
1021 1021
1022int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) 1022int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
1023{ 1023{
1024 struct sioc_sg_req sr; 1024 struct sioc_sg_req sr;
1025 struct sioc_vif_req vr; 1025 struct sioc_vif_req vr;
1026 struct vif_device *vif; 1026 struct vif_device *vif;
1027 struct mfc_cache *c; 1027 struct mfc_cache *c;
1028 1028
1029 switch(cmd) 1029 switch(cmd)
1030 { 1030 {
1031 case SIOCGETVIFCNT: 1031 case SIOCGETVIFCNT:
1032 if (copy_from_user(&vr,arg,sizeof(vr))) 1032 if (copy_from_user(&vr,arg,sizeof(vr)))
1033 return -EFAULT; 1033 return -EFAULT;
1034 if(vr.vifi>=maxvif) 1034 if(vr.vifi>=maxvif)
1035 return -EINVAL; 1035 return -EINVAL;
1036 read_lock(&mrt_lock); 1036 read_lock(&mrt_lock);
@@ -1096,7 +1096,7 @@ static struct notifier_block ip_mr_notifier={
1096 * This avoids tunnel drivers and other mess and gives us the speed so 1096 * This avoids tunnel drivers and other mess and gives us the speed so
1097 * important for multicast video. 1097 * important for multicast video.
1098 */ 1098 */
1099 1099
1100static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) 1100static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
1101{ 1101{
1102 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); 1102 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
@@ -1194,7 +1194,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1194 encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len; 1194 encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len;
1195 1195
1196 if (skb_cow(skb, encap)) { 1196 if (skb_cow(skb, encap)) {
1197 ip_rt_put(rt); 1197 ip_rt_put(rt);
1198 goto out_free; 1198 goto out_free;
1199 } 1199 }
1200 1200
@@ -1228,7 +1228,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1228 * not mrouter) cannot join to more than one interface - it will 1228 * not mrouter) cannot join to more than one interface - it will
1229 * result in receiving multiple packets. 1229 * result in receiving multiple packets.
1230 */ 1230 */
1231 NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev, 1231 NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev,
1232 ipmr_forward_finish); 1232 ipmr_forward_finish);
1233 return; 1233 return;
1234 1234
@@ -1289,7 +1289,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
1289 large chunk of pimd to kernel. Ough... --ANK 1289 large chunk of pimd to kernel. Ough... --ANK
1290 */ 1290 */
1291 (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && 1291 (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) &&
1292 time_after(jiffies, 1292 time_after(jiffies,
1293 cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { 1293 cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) {
1294 cache->mfc_un.res.last_assert = jiffies; 1294 cache->mfc_un.res.last_assert = jiffies;
1295 ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF); 1295 ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF);
@@ -1426,14 +1426,14 @@ int pim_rcv_v1(struct sk_buff * skb)
1426 struct iphdr *encap; 1426 struct iphdr *encap;
1427 struct net_device *reg_dev = NULL; 1427 struct net_device *reg_dev = NULL;
1428 1428
1429 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 1429 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
1430 goto drop; 1430 goto drop;
1431 1431
1432 pim = (struct igmphdr*)skb->h.raw; 1432 pim = (struct igmphdr*)skb->h.raw;
1433 1433
1434 if (!mroute_do_pim || 1434 if (!mroute_do_pim ||
1435 skb->len < sizeof(*pim) + sizeof(*encap) || 1435 skb->len < sizeof(*pim) + sizeof(*encap) ||
1436 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) 1436 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
1437 goto drop; 1437 goto drop;
1438 1438
1439 encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); 1439 encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr));
@@ -1445,7 +1445,7 @@ int pim_rcv_v1(struct sk_buff * skb)
1445 */ 1445 */
1446 if (!MULTICAST(encap->daddr) || 1446 if (!MULTICAST(encap->daddr) ||
1447 encap->tot_len == 0 || 1447 encap->tot_len == 0 ||
1448 ntohs(encap->tot_len) + sizeof(*pim) > skb->len) 1448 ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
1449 goto drop; 1449 goto drop;
1450 1450
1451 read_lock(&mrt_lock); 1451 read_lock(&mrt_lock);
@@ -1455,7 +1455,7 @@ int pim_rcv_v1(struct sk_buff * skb)
1455 dev_hold(reg_dev); 1455 dev_hold(reg_dev);
1456 read_unlock(&mrt_lock); 1456 read_unlock(&mrt_lock);
1457 1457
1458 if (reg_dev == NULL) 1458 if (reg_dev == NULL)
1459 goto drop; 1459 goto drop;
1460 1460
1461 skb->mac.raw = skb->nh.raw; 1461 skb->mac.raw = skb->nh.raw;
@@ -1486,13 +1486,13 @@ static int pim_rcv(struct sk_buff * skb)
1486 struct iphdr *encap; 1486 struct iphdr *encap;
1487 struct net_device *reg_dev = NULL; 1487 struct net_device *reg_dev = NULL;
1488 1488
1489 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 1489 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
1490 goto drop; 1490 goto drop;
1491 1491
1492 pim = (struct pimreghdr*)skb->h.raw; 1492 pim = (struct pimreghdr*)skb->h.raw;
1493 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || 1493 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
1494 (pim->flags&PIM_NULL_REGISTER) || 1494 (pim->flags&PIM_NULL_REGISTER) ||
1495 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && 1495 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
1496 csum_fold(skb_checksum(skb, 0, skb->len, 0)))) 1496 csum_fold(skb_checksum(skb, 0, skb->len, 0))))
1497 goto drop; 1497 goto drop;
1498 1498
@@ -1500,7 +1500,7 @@ static int pim_rcv(struct sk_buff * skb)
1500 encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); 1500 encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr));
1501 if (!MULTICAST(encap->daddr) || 1501 if (!MULTICAST(encap->daddr) ||
1502 encap->tot_len == 0 || 1502 encap->tot_len == 0 ||
1503 ntohs(encap->tot_len) + sizeof(*pim) > skb->len) 1503 ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
1504 goto drop; 1504 goto drop;
1505 1505
1506 read_lock(&mrt_lock); 1506 read_lock(&mrt_lock);
@@ -1510,7 +1510,7 @@ static int pim_rcv(struct sk_buff * skb)
1510 dev_hold(reg_dev); 1510 dev_hold(reg_dev);
1511 read_unlock(&mrt_lock); 1511 read_unlock(&mrt_lock);
1512 1512
1513 if (reg_dev == NULL) 1513 if (reg_dev == NULL)
1514 goto drop; 1514 goto drop;
1515 1515
1516 skb->mac.raw = skb->nh.raw; 1516 skb->mac.raw = skb->nh.raw;
@@ -1616,7 +1616,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1616 return err; 1616 return err;
1617} 1617}
1618 1618
1619#ifdef CONFIG_PROC_FS 1619#ifdef CONFIG_PROC_FS
1620/* 1620/*
1621 * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif 1621 * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif
1622 */ 1622 */
@@ -1630,7 +1630,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
1630 for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) { 1630 for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) {
1631 if(!VIF_EXISTS(iter->ct)) 1631 if(!VIF_EXISTS(iter->ct))
1632 continue; 1632 continue;
1633 if (pos-- == 0) 1633 if (pos-- == 0)
1634 return &vif_table[iter->ct]; 1634 return &vif_table[iter->ct];
1635 } 1635 }
1636 return NULL; 1636 return NULL;
@@ -1639,7 +1639,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
1639static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos) 1639static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos)
1640{ 1640{
1641 read_lock(&mrt_lock); 1641 read_lock(&mrt_lock);
1642 return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1) 1642 return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1)
1643 : SEQ_START_TOKEN; 1643 : SEQ_START_TOKEN;
1644} 1644}
1645 1645
@@ -1650,7 +1650,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1650 ++*pos; 1650 ++*pos;
1651 if (v == SEQ_START_TOKEN) 1651 if (v == SEQ_START_TOKEN)
1652 return ipmr_vif_seq_idx(iter, 0); 1652 return ipmr_vif_seq_idx(iter, 0);
1653 1653
1654 while (++iter->ct < maxvif) { 1654 while (++iter->ct < maxvif) {
1655 if(!VIF_EXISTS(iter->ct)) 1655 if(!VIF_EXISTS(iter->ct))
1656 continue; 1656 continue;
@@ -1667,7 +1667,7 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v)
1667static int ipmr_vif_seq_show(struct seq_file *seq, void *v) 1667static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
1668{ 1668{
1669 if (v == SEQ_START_TOKEN) { 1669 if (v == SEQ_START_TOKEN) {
1670 seq_puts(seq, 1670 seq_puts(seq,
1671 "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n"); 1671 "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n");
1672 } else { 1672 } else {
1673 const struct vif_device *vif = v; 1673 const struct vif_device *vif = v;
@@ -1676,7 +1676,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
1676 seq_printf(seq, 1676 seq_printf(seq,
1677 "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n", 1677 "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n",
1678 vif - vif_table, 1678 vif - vif_table,
1679 name, vif->bytes_in, vif->pkt_in, 1679 name, vif->bytes_in, vif->pkt_in,
1680 vif->bytes_out, vif->pkt_out, 1680 vif->bytes_out, vif->pkt_out,
1681 vif->flags, vif->local, vif->remote); 1681 vif->flags, vif->local, vif->remote);
1682 } 1682 }
@@ -1695,7 +1695,7 @@ static int ipmr_vif_open(struct inode *inode, struct file *file)
1695 struct seq_file *seq; 1695 struct seq_file *seq;
1696 int rc = -ENOMEM; 1696 int rc = -ENOMEM;
1697 struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); 1697 struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1698 1698
1699 if (!s) 1699 if (!s)
1700 goto out; 1700 goto out;
1701 1701
@@ -1734,15 +1734,15 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
1734 1734
1735 it->cache = mfc_cache_array; 1735 it->cache = mfc_cache_array;
1736 read_lock(&mrt_lock); 1736 read_lock(&mrt_lock);
1737 for (it->ct = 0; it->ct < MFC_LINES; it->ct++) 1737 for (it->ct = 0; it->ct < MFC_LINES; it->ct++)
1738 for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next) 1738 for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next)
1739 if (pos-- == 0) 1739 if (pos-- == 0)
1740 return mfc; 1740 return mfc;
1741 read_unlock(&mrt_lock); 1741 read_unlock(&mrt_lock);
1742 1742
1743 it->cache = &mfc_unres_queue; 1743 it->cache = &mfc_unres_queue;
1744 spin_lock_bh(&mfc_unres_lock); 1744 spin_lock_bh(&mfc_unres_lock);
1745 for(mfc = mfc_unres_queue; mfc; mfc = mfc->next) 1745 for(mfc = mfc_unres_queue; mfc; mfc = mfc->next)
1746 if (pos-- == 0) 1746 if (pos-- == 0)
1747 return mfc; 1747 return mfc;
1748 spin_unlock_bh(&mfc_unres_lock); 1748 spin_unlock_bh(&mfc_unres_lock);
@@ -1757,7 +1757,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
1757 struct ipmr_mfc_iter *it = seq->private; 1757 struct ipmr_mfc_iter *it = seq->private;
1758 it->cache = NULL; 1758 it->cache = NULL;
1759 it->ct = 0; 1759 it->ct = 0;
1760 return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) 1760 return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
1761 : SEQ_START_TOKEN; 1761 : SEQ_START_TOKEN;
1762} 1762}
1763 1763
@@ -1773,8 +1773,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1773 1773
1774 if (mfc->next) 1774 if (mfc->next)
1775 return mfc->next; 1775 return mfc->next;
1776 1776
1777 if (it->cache == &mfc_unres_queue) 1777 if (it->cache == &mfc_unres_queue)
1778 goto end_of_list; 1778 goto end_of_list;
1779 1779
1780 BUG_ON(it->cache != mfc_cache_array); 1780 BUG_ON(it->cache != mfc_cache_array);
@@ -1789,10 +1789,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1789 read_unlock(&mrt_lock); 1789 read_unlock(&mrt_lock);
1790 it->cache = &mfc_unres_queue; 1790 it->cache = &mfc_unres_queue;
1791 it->ct = 0; 1791 it->ct = 0;
1792 1792
1793 spin_lock_bh(&mfc_unres_lock); 1793 spin_lock_bh(&mfc_unres_lock);
1794 mfc = mfc_unres_queue; 1794 mfc = mfc_unres_queue;
1795 if (mfc) 1795 if (mfc)
1796 return mfc; 1796 return mfc;
1797 1797
1798 end_of_list: 1798 end_of_list:
@@ -1817,12 +1817,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
1817 int n; 1817 int n;
1818 1818
1819 if (v == SEQ_START_TOKEN) { 1819 if (v == SEQ_START_TOKEN) {
1820 seq_puts(seq, 1820 seq_puts(seq,
1821 "Group Origin Iif Pkts Bytes Wrong Oifs\n"); 1821 "Group Origin Iif Pkts Bytes Wrong Oifs\n");
1822 } else { 1822 } else {
1823 const struct mfc_cache *mfc = v; 1823 const struct mfc_cache *mfc = v;
1824 const struct ipmr_mfc_iter *it = seq->private; 1824 const struct ipmr_mfc_iter *it = seq->private;
1825 1825
1826 seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld", 1826 seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld",
1827 (unsigned long) mfc->mfc_mcastgrp, 1827 (unsigned long) mfc->mfc_mcastgrp,
1828 (unsigned long) mfc->mfc_origin, 1828 (unsigned long) mfc->mfc_origin,
@@ -1832,12 +1832,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
1832 mfc->mfc_un.res.wrong_if); 1832 mfc->mfc_un.res.wrong_if);
1833 1833
1834 if (it->cache != &mfc_unres_queue) { 1834 if (it->cache != &mfc_unres_queue) {
1835 for(n = mfc->mfc_un.res.minvif; 1835 for(n = mfc->mfc_un.res.minvif;
1836 n < mfc->mfc_un.res.maxvif; n++ ) { 1836 n < mfc->mfc_un.res.maxvif; n++ ) {
1837 if(VIF_EXISTS(n) 1837 if(VIF_EXISTS(n)
1838 && mfc->mfc_un.res.ttls[n] < 255) 1838 && mfc->mfc_un.res.ttls[n] < 255)
1839 seq_printf(seq, 1839 seq_printf(seq,
1840 " %2d:%-3d", 1840 " %2d:%-3d",
1841 n, mfc->mfc_un.res.ttls[n]); 1841 n, mfc->mfc_un.res.ttls[n]);
1842 } 1842 }
1843 } 1843 }
@@ -1858,7 +1858,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
1858 struct seq_file *seq; 1858 struct seq_file *seq;
1859 int rc = -ENOMEM; 1859 int rc = -ENOMEM;
1860 struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); 1860 struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1861 1861
1862 if (!s) 1862 if (!s)
1863 goto out; 1863 goto out;
1864 1864
@@ -1883,7 +1883,7 @@ static struct file_operations ipmr_mfc_fops = {
1883 .llseek = seq_lseek, 1883 .llseek = seq_lseek,
1884 .release = seq_release_private, 1884 .release = seq_release_private,
1885}; 1885};
1886#endif 1886#endif
1887 1887
1888#ifdef CONFIG_IP_PIMSM_V2 1888#ifdef CONFIG_IP_PIMSM_V2
1889static struct net_protocol pim_protocol = { 1889static struct net_protocol pim_protocol = {
@@ -1895,7 +1895,7 @@ static struct net_protocol pim_protocol = {
1895/* 1895/*
1896 * Setup for IP multicast routing 1896 * Setup for IP multicast routing
1897 */ 1897 */
1898 1898
1899void __init ip_mr_init(void) 1899void __init ip_mr_init(void)
1900{ 1900{
1901 mrt_cachep = kmem_cache_create("ip_mrt_cache", 1901 mrt_cachep = kmem_cache_create("ip_mrt_cache",
@@ -1905,8 +1905,8 @@ void __init ip_mr_init(void)
1905 init_timer(&ipmr_expire_timer); 1905 init_timer(&ipmr_expire_timer);
1906 ipmr_expire_timer.function=ipmr_expire_process; 1906 ipmr_expire_timer.function=ipmr_expire_process;
1907 register_netdevice_notifier(&ip_mr_notifier); 1907 register_netdevice_notifier(&ip_mr_notifier);
1908#ifdef CONFIG_PROC_FS 1908#ifdef CONFIG_PROC_FS
1909 proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops); 1909 proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops);
1910 proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops); 1910 proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops);
1911#endif 1911#endif
1912} 1912}