aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipmr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/ipv4/ipmr.c
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
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 d7e1e60f51d5..604f5b585104 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;
@@ -499,7 +499,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void)
499/* 499/*
500 * A cache entry has gone into a resolved state from queued 500 * A cache entry has gone into a resolved state from queued
501 */ 501 */
502 502
503static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) 503static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
504{ 504{
505 struct sk_buff *skb; 505 struct sk_buff *skb;
@@ -536,7 +536,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
536 * 536 *
537 * Called under mrt_lock. 537 * Called under mrt_lock.
538 */ 538 */
539 539
540static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) 540static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
541{ 541{
542 struct sk_buff *skb; 542 struct sk_buff *skb;
@@ -567,13 +567,13 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
567 memcpy(msg, pkt->nh.raw, sizeof(struct iphdr)); 567 memcpy(msg, pkt->nh.raw, sizeof(struct iphdr));
568 msg->im_msgtype = IGMPMSG_WHOLEPKT; 568 msg->im_msgtype = IGMPMSG_WHOLEPKT;
569 msg->im_mbz = 0; 569 msg->im_mbz = 0;
570 msg->im_vif = reg_vif_num; 570 msg->im_vif = reg_vif_num;
571 skb->nh.iph->ihl = sizeof(struct iphdr) >> 2; 571 skb->nh.iph->ihl = sizeof(struct iphdr) >> 2;
572 skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr)); 572 skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr));
573 } else 573 } else
574#endif 574#endif
575 { 575 {
576 576
577 /* 577 /*
578 * Copy the IP header 578 * Copy the IP header
579 */ 579 */
@@ -595,7 +595,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
595 igmp->code = 0; 595 igmp->code = 0;
596 skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */ 596 skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */
597 skb->h.raw = skb->nh.raw; 597 skb->h.raw = skb->nh.raw;
598 } 598 }
599 599
600 if (mroute_socket == NULL) { 600 if (mroute_socket == NULL) {
601 kfree_skb(skb); 601 kfree_skb(skb);
@@ -617,7 +617,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
617/* 617/*
618 * Queue a packet for resolution. It gets locked cache entry! 618 * Queue a packet for resolution. It gets locked cache entry!
619 */ 619 */
620 620
621static int 621static int
622ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) 622ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
623{ 623{
@@ -655,7 +655,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
655 * Reflect first query at mrouted. 655 * Reflect first query at mrouted.
656 */ 656 */
657 if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) { 657 if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) {
658 /* If the report failed throw the cache entry 658 /* If the report failed throw the cache entry
659 out - Brad Parker 659 out - Brad Parker
660 */ 660 */
661 spin_unlock_bh(&mfc_unres_lock); 661 spin_unlock_bh(&mfc_unres_lock);
@@ -781,11 +781,11 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
781/* 781/*
782 * Close the multicast socket, and clear the vif tables etc 782 * Close the multicast socket, and clear the vif tables etc
783 */ 783 */
784 784
785static void mroute_clean_tables(struct sock *sk) 785static void mroute_clean_tables(struct sock *sk)
786{ 786{
787 int i; 787 int i;
788 788
789 /* 789 /*
790 * Shut down all active vif entries 790 * Shut down all active vif entries
791 */ 791 */
@@ -852,13 +852,13 @@ static void mrtsock_destruct(struct sock *sk)
852 * that's how BSD mrouted happens to think. Maybe one day with a proper 852 * that's how BSD mrouted happens to think. Maybe one day with a proper
853 * MOSPF/PIM router set up we can clean this up. 853 * MOSPF/PIM router set up we can clean this up.
854 */ 854 */
855 855
856int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen) 856int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen)
857{ 857{
858 int ret; 858 int ret;
859 struct vifctl vif; 859 struct vifctl vif;
860 struct mfcctl mfc; 860 struct mfcctl mfc;
861 861
862 if(optname!=MRT_INIT) 862 if(optname!=MRT_INIT)
863 { 863 {
864 if(sk!=mroute_socket && !capable(CAP_NET_ADMIN)) 864 if(sk!=mroute_socket && !capable(CAP_NET_ADMIN))
@@ -899,7 +899,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
899 if(optlen!=sizeof(vif)) 899 if(optlen!=sizeof(vif))
900 return -EINVAL; 900 return -EINVAL;
901 if (copy_from_user(&vif,optval,sizeof(vif))) 901 if (copy_from_user(&vif,optval,sizeof(vif)))
902 return -EFAULT; 902 return -EFAULT;
903 if(vif.vifc_vifi >= MAXVIFS) 903 if(vif.vifc_vifi >= MAXVIFS)
904 return -ENFILE; 904 return -ENFILE;
905 rtnl_lock(); 905 rtnl_lock();
@@ -978,13 +978,13 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
978/* 978/*
979 * Getsock opt support for the multicast routing system. 979 * Getsock opt support for the multicast routing system.
980 */ 980 */
981 981
982int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen) 982int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen)
983{ 983{
984 int olr; 984 int olr;
985 int val; 985 int val;
986 986
987 if(optname!=MRT_VERSION && 987 if(optname!=MRT_VERSION &&
988#ifdef CONFIG_IP_PIMSM 988#ifdef CONFIG_IP_PIMSM
989 optname!=MRT_PIM && 989 optname!=MRT_PIM &&
990#endif 990#endif
@@ -997,7 +997,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
997 olr = min_t(unsigned int, olr, sizeof(int)); 997 olr = min_t(unsigned int, olr, sizeof(int));
998 if (olr < 0) 998 if (olr < 0)
999 return -EINVAL; 999 return -EINVAL;
1000 1000
1001 if(put_user(olr,optlen)) 1001 if(put_user(olr,optlen))
1002 return -EFAULT; 1002 return -EFAULT;
1003 if(optname==MRT_VERSION) 1003 if(optname==MRT_VERSION)
@@ -1016,19 +1016,19 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
1016/* 1016/*
1017 * The IP multicast ioctl support routines. 1017 * The IP multicast ioctl support routines.
1018 */ 1018 */
1019 1019
1020int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) 1020int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
1021{ 1021{
1022 struct sioc_sg_req sr; 1022 struct sioc_sg_req sr;
1023 struct sioc_vif_req vr; 1023 struct sioc_vif_req vr;
1024 struct vif_device *vif; 1024 struct vif_device *vif;
1025 struct mfc_cache *c; 1025 struct mfc_cache *c;
1026 1026
1027 switch(cmd) 1027 switch(cmd)
1028 { 1028 {
1029 case SIOCGETVIFCNT: 1029 case SIOCGETVIFCNT:
1030 if (copy_from_user(&vr,arg,sizeof(vr))) 1030 if (copy_from_user(&vr,arg,sizeof(vr)))
1031 return -EFAULT; 1031 return -EFAULT;
1032 if(vr.vifi>=maxvif) 1032 if(vr.vifi>=maxvif)
1033 return -EINVAL; 1033 return -EINVAL;
1034 read_lock(&mrt_lock); 1034 read_lock(&mrt_lock);
@@ -1094,7 +1094,7 @@ static struct notifier_block ip_mr_notifier={
1094 * This avoids tunnel drivers and other mess and gives us the speed so 1094 * This avoids tunnel drivers and other mess and gives us the speed so
1095 * important for multicast video. 1095 * important for multicast video.
1096 */ 1096 */
1097 1097
1098static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) 1098static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
1099{ 1099{
1100 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); 1100 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
@@ -1192,7 +1192,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1192 encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len; 1192 encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len;
1193 1193
1194 if (skb_cow(skb, encap)) { 1194 if (skb_cow(skb, encap)) {
1195 ip_rt_put(rt); 1195 ip_rt_put(rt);
1196 goto out_free; 1196 goto out_free;
1197 } 1197 }
1198 1198
@@ -1226,7 +1226,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
1226 * not mrouter) cannot join to more than one interface - it will 1226 * not mrouter) cannot join to more than one interface - it will
1227 * result in receiving multiple packets. 1227 * result in receiving multiple packets.
1228 */ 1228 */
1229 NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev, 1229 NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev,
1230 ipmr_forward_finish); 1230 ipmr_forward_finish);
1231 return; 1231 return;
1232 1232
@@ -1287,7 +1287,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
1287 large chunk of pimd to kernel. Ough... --ANK 1287 large chunk of pimd to kernel. Ough... --ANK
1288 */ 1288 */
1289 (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && 1289 (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) &&
1290 time_after(jiffies, 1290 time_after(jiffies,
1291 cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { 1291 cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) {
1292 cache->mfc_un.res.last_assert = jiffies; 1292 cache->mfc_un.res.last_assert = jiffies;
1293 ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF); 1293 ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF);
@@ -1424,14 +1424,14 @@ int pim_rcv_v1(struct sk_buff * skb)
1424 struct iphdr *encap; 1424 struct iphdr *encap;
1425 struct net_device *reg_dev = NULL; 1425 struct net_device *reg_dev = NULL;
1426 1426
1427 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 1427 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
1428 goto drop; 1428 goto drop;
1429 1429
1430 pim = (struct igmphdr*)skb->h.raw; 1430 pim = (struct igmphdr*)skb->h.raw;
1431 1431
1432 if (!mroute_do_pim || 1432 if (!mroute_do_pim ||
1433 skb->len < sizeof(*pim) + sizeof(*encap) || 1433 skb->len < sizeof(*pim) + sizeof(*encap) ||
1434 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) 1434 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
1435 goto drop; 1435 goto drop;
1436 1436
1437 encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); 1437 encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr));
@@ -1443,7 +1443,7 @@ int pim_rcv_v1(struct sk_buff * skb)
1443 */ 1443 */
1444 if (!MULTICAST(encap->daddr) || 1444 if (!MULTICAST(encap->daddr) ||
1445 encap->tot_len == 0 || 1445 encap->tot_len == 0 ||
1446 ntohs(encap->tot_len) + sizeof(*pim) > skb->len) 1446 ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
1447 goto drop; 1447 goto drop;
1448 1448
1449 read_lock(&mrt_lock); 1449 read_lock(&mrt_lock);
@@ -1453,7 +1453,7 @@ int pim_rcv_v1(struct sk_buff * skb)
1453 dev_hold(reg_dev); 1453 dev_hold(reg_dev);
1454 read_unlock(&mrt_lock); 1454 read_unlock(&mrt_lock);
1455 1455
1456 if (reg_dev == NULL) 1456 if (reg_dev == NULL)
1457 goto drop; 1457 goto drop;
1458 1458
1459 skb->mac.raw = skb->nh.raw; 1459 skb->mac.raw = skb->nh.raw;
@@ -1484,13 +1484,13 @@ static int pim_rcv(struct sk_buff * skb)
1484 struct iphdr *encap; 1484 struct iphdr *encap;
1485 struct net_device *reg_dev = NULL; 1485 struct net_device *reg_dev = NULL;
1486 1486
1487 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 1487 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
1488 goto drop; 1488 goto drop;
1489 1489
1490 pim = (struct pimreghdr*)skb->h.raw; 1490 pim = (struct pimreghdr*)skb->h.raw;
1491 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || 1491 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
1492 (pim->flags&PIM_NULL_REGISTER) || 1492 (pim->flags&PIM_NULL_REGISTER) ||
1493 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && 1493 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
1494 csum_fold(skb_checksum(skb, 0, skb->len, 0)))) 1494 csum_fold(skb_checksum(skb, 0, skb->len, 0))))
1495 goto drop; 1495 goto drop;
1496 1496
@@ -1498,7 +1498,7 @@ static int pim_rcv(struct sk_buff * skb)
1498 encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); 1498 encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr));
1499 if (!MULTICAST(encap->daddr) || 1499 if (!MULTICAST(encap->daddr) ||
1500 encap->tot_len == 0 || 1500 encap->tot_len == 0 ||
1501 ntohs(encap->tot_len) + sizeof(*pim) > skb->len) 1501 ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
1502 goto drop; 1502 goto drop;
1503 1503
1504 read_lock(&mrt_lock); 1504 read_lock(&mrt_lock);
@@ -1508,7 +1508,7 @@ static int pim_rcv(struct sk_buff * skb)
1508 dev_hold(reg_dev); 1508 dev_hold(reg_dev);
1509 read_unlock(&mrt_lock); 1509 read_unlock(&mrt_lock);
1510 1510
1511 if (reg_dev == NULL) 1511 if (reg_dev == NULL)
1512 goto drop; 1512 goto drop;
1513 1513
1514 skb->mac.raw = skb->nh.raw; 1514 skb->mac.raw = skb->nh.raw;
@@ -1614,7 +1614,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1614 return err; 1614 return err;
1615} 1615}
1616 1616
1617#ifdef CONFIG_PROC_FS 1617#ifdef CONFIG_PROC_FS
1618/* 1618/*
1619 * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif 1619 * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif
1620 */ 1620 */
@@ -1628,7 +1628,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
1628 for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) { 1628 for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) {
1629 if(!VIF_EXISTS(iter->ct)) 1629 if(!VIF_EXISTS(iter->ct))
1630 continue; 1630 continue;
1631 if (pos-- == 0) 1631 if (pos-- == 0)
1632 return &vif_table[iter->ct]; 1632 return &vif_table[iter->ct];
1633 } 1633 }
1634 return NULL; 1634 return NULL;
@@ -1637,7 +1637,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
1637static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos) 1637static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos)
1638{ 1638{
1639 read_lock(&mrt_lock); 1639 read_lock(&mrt_lock);
1640 return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1) 1640 return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1)
1641 : SEQ_START_TOKEN; 1641 : SEQ_START_TOKEN;
1642} 1642}
1643 1643
@@ -1648,7 +1648,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1648 ++*pos; 1648 ++*pos;
1649 if (v == SEQ_START_TOKEN) 1649 if (v == SEQ_START_TOKEN)
1650 return ipmr_vif_seq_idx(iter, 0); 1650 return ipmr_vif_seq_idx(iter, 0);
1651 1651
1652 while (++iter->ct < maxvif) { 1652 while (++iter->ct < maxvif) {
1653 if(!VIF_EXISTS(iter->ct)) 1653 if(!VIF_EXISTS(iter->ct))
1654 continue; 1654 continue;
@@ -1665,7 +1665,7 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v)
1665static int ipmr_vif_seq_show(struct seq_file *seq, void *v) 1665static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
1666{ 1666{
1667 if (v == SEQ_START_TOKEN) { 1667 if (v == SEQ_START_TOKEN) {
1668 seq_puts(seq, 1668 seq_puts(seq,
1669 "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n"); 1669 "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n");
1670 } else { 1670 } else {
1671 const struct vif_device *vif = v; 1671 const struct vif_device *vif = v;
@@ -1674,7 +1674,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
1674 seq_printf(seq, 1674 seq_printf(seq,
1675 "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n", 1675 "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n",
1676 vif - vif_table, 1676 vif - vif_table,
1677 name, vif->bytes_in, vif->pkt_in, 1677 name, vif->bytes_in, vif->pkt_in,
1678 vif->bytes_out, vif->pkt_out, 1678 vif->bytes_out, vif->pkt_out,
1679 vif->flags, vif->local, vif->remote); 1679 vif->flags, vif->local, vif->remote);
1680 } 1680 }
@@ -1693,7 +1693,7 @@ static int ipmr_vif_open(struct inode *inode, struct file *file)
1693 struct seq_file *seq; 1693 struct seq_file *seq;
1694 int rc = -ENOMEM; 1694 int rc = -ENOMEM;
1695 struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); 1695 struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1696 1696
1697 if (!s) 1697 if (!s)
1698 goto out; 1698 goto out;
1699 1699
@@ -1732,15 +1732,15 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
1732 1732
1733 it->cache = mfc_cache_array; 1733 it->cache = mfc_cache_array;
1734 read_lock(&mrt_lock); 1734 read_lock(&mrt_lock);
1735 for (it->ct = 0; it->ct < MFC_LINES; it->ct++) 1735 for (it->ct = 0; it->ct < MFC_LINES; it->ct++)
1736 for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next) 1736 for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next)
1737 if (pos-- == 0) 1737 if (pos-- == 0)
1738 return mfc; 1738 return mfc;
1739 read_unlock(&mrt_lock); 1739 read_unlock(&mrt_lock);
1740 1740
1741 it->cache = &mfc_unres_queue; 1741 it->cache = &mfc_unres_queue;
1742 spin_lock_bh(&mfc_unres_lock); 1742 spin_lock_bh(&mfc_unres_lock);
1743 for(mfc = mfc_unres_queue; mfc; mfc = mfc->next) 1743 for(mfc = mfc_unres_queue; mfc; mfc = mfc->next)
1744 if (pos-- == 0) 1744 if (pos-- == 0)
1745 return mfc; 1745 return mfc;
1746 spin_unlock_bh(&mfc_unres_lock); 1746 spin_unlock_bh(&mfc_unres_lock);
@@ -1755,7 +1755,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
1755 struct ipmr_mfc_iter *it = seq->private; 1755 struct ipmr_mfc_iter *it = seq->private;
1756 it->cache = NULL; 1756 it->cache = NULL;
1757 it->ct = 0; 1757 it->ct = 0;
1758 return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) 1758 return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
1759 : SEQ_START_TOKEN; 1759 : SEQ_START_TOKEN;
1760} 1760}
1761 1761
@@ -1771,8 +1771,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1771 1771
1772 if (mfc->next) 1772 if (mfc->next)
1773 return mfc->next; 1773 return mfc->next;
1774 1774
1775 if (it->cache == &mfc_unres_queue) 1775 if (it->cache == &mfc_unres_queue)
1776 goto end_of_list; 1776 goto end_of_list;
1777 1777
1778 BUG_ON(it->cache != mfc_cache_array); 1778 BUG_ON(it->cache != mfc_cache_array);
@@ -1787,10 +1787,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1787 read_unlock(&mrt_lock); 1787 read_unlock(&mrt_lock);
1788 it->cache = &mfc_unres_queue; 1788 it->cache = &mfc_unres_queue;
1789 it->ct = 0; 1789 it->ct = 0;
1790 1790
1791 spin_lock_bh(&mfc_unres_lock); 1791 spin_lock_bh(&mfc_unres_lock);
1792 mfc = mfc_unres_queue; 1792 mfc = mfc_unres_queue;
1793 if (mfc) 1793 if (mfc)
1794 return mfc; 1794 return mfc;
1795 1795
1796 end_of_list: 1796 end_of_list:
@@ -1815,12 +1815,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
1815 int n; 1815 int n;
1816 1816
1817 if (v == SEQ_START_TOKEN) { 1817 if (v == SEQ_START_TOKEN) {
1818 seq_puts(seq, 1818 seq_puts(seq,
1819 "Group Origin Iif Pkts Bytes Wrong Oifs\n"); 1819 "Group Origin Iif Pkts Bytes Wrong Oifs\n");
1820 } else { 1820 } else {
1821 const struct mfc_cache *mfc = v; 1821 const struct mfc_cache *mfc = v;
1822 const struct ipmr_mfc_iter *it = seq->private; 1822 const struct ipmr_mfc_iter *it = seq->private;
1823 1823
1824 seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld", 1824 seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld",
1825 (unsigned long) mfc->mfc_mcastgrp, 1825 (unsigned long) mfc->mfc_mcastgrp,
1826 (unsigned long) mfc->mfc_origin, 1826 (unsigned long) mfc->mfc_origin,
@@ -1830,12 +1830,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
1830 mfc->mfc_un.res.wrong_if); 1830 mfc->mfc_un.res.wrong_if);
1831 1831
1832 if (it->cache != &mfc_unres_queue) { 1832 if (it->cache != &mfc_unres_queue) {
1833 for(n = mfc->mfc_un.res.minvif; 1833 for(n = mfc->mfc_un.res.minvif;
1834 n < mfc->mfc_un.res.maxvif; n++ ) { 1834 n < mfc->mfc_un.res.maxvif; n++ ) {
1835 if(VIF_EXISTS(n) 1835 if(VIF_EXISTS(n)
1836 && mfc->mfc_un.res.ttls[n] < 255) 1836 && mfc->mfc_un.res.ttls[n] < 255)
1837 seq_printf(seq, 1837 seq_printf(seq,
1838 " %2d:%-3d", 1838 " %2d:%-3d",
1839 n, mfc->mfc_un.res.ttls[n]); 1839 n, mfc->mfc_un.res.ttls[n]);
1840 } 1840 }
1841 } 1841 }
@@ -1856,7 +1856,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
1856 struct seq_file *seq; 1856 struct seq_file *seq;
1857 int rc = -ENOMEM; 1857 int rc = -ENOMEM;
1858 struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); 1858 struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1859 1859
1860 if (!s) 1860 if (!s)
1861 goto out; 1861 goto out;
1862 1862
@@ -1881,7 +1881,7 @@ static struct file_operations ipmr_mfc_fops = {
1881 .llseek = seq_lseek, 1881 .llseek = seq_lseek,
1882 .release = seq_release_private, 1882 .release = seq_release_private,
1883}; 1883};
1884#endif 1884#endif
1885 1885
1886#ifdef CONFIG_IP_PIMSM_V2 1886#ifdef CONFIG_IP_PIMSM_V2
1887static struct net_protocol pim_protocol = { 1887static struct net_protocol pim_protocol = {
@@ -1893,7 +1893,7 @@ static struct net_protocol pim_protocol = {
1893/* 1893/*
1894 * Setup for IP multicast routing 1894 * Setup for IP multicast routing
1895 */ 1895 */
1896 1896
1897void __init ip_mr_init(void) 1897void __init ip_mr_init(void)
1898{ 1898{
1899 mrt_cachep = kmem_cache_create("ip_mrt_cache", 1899 mrt_cachep = kmem_cache_create("ip_mrt_cache",
@@ -1903,8 +1903,8 @@ void __init ip_mr_init(void)
1903 init_timer(&ipmr_expire_timer); 1903 init_timer(&ipmr_expire_timer);
1904 ipmr_expire_timer.function=ipmr_expire_process; 1904 ipmr_expire_timer.function=ipmr_expire_process;
1905 register_netdevice_notifier(&ip_mr_notifier); 1905 register_netdevice_notifier(&ip_mr_notifier);
1906#ifdef CONFIG_PROC_FS 1906#ifdef CONFIG_PROC_FS
1907 proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops); 1907 proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops);
1908 proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops); 1908 proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops);
1909#endif 1909#endif
1910} 1910}