aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv6/ip6mr.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 433042114148..94ede696da2a 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -27,27 +27,18 @@
27#include <linux/fcntl.h> 27#include <linux/fcntl.h>
28#include <linux/stat.h> 28#include <linux/stat.h>
29#include <linux/socket.h> 29#include <linux/socket.h>
30#include <linux/in.h>
31#include <linux/inet.h> 30#include <linux/inet.h>
32#include <linux/netdevice.h> 31#include <linux/netdevice.h>
33#include <linux/inetdevice.h> 32#include <linux/inetdevice.h>
34#include <linux/igmp.h>
35#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 34#include <linux/seq_file.h>
37#include <linux/mroute.h>
38#include <linux/init.h> 35#include <linux/init.h>
39#include <net/ip.h>
40#include <net/protocol.h> 36#include <net/protocol.h>
41#include <linux/skbuff.h> 37#include <linux/skbuff.h>
42#include <net/sock.h> 38#include <net/sock.h>
43#include <net/icmp.h>
44#include <net/udp.h>
45#include <net/raw.h> 39#include <net/raw.h>
46#include <net/route.h>
47#include <linux/notifier.h> 40#include <linux/notifier.h>
48#include <linux/if_arp.h> 41#include <linux/if_arp.h>
49#include <linux/netfilter_ipv4.h>
50#include <net/ipip.h>
51#include <net/checksum.h> 42#include <net/checksum.h>
52#include <net/netlink.h> 43#include <net/netlink.h>
53 44
@@ -83,7 +74,7 @@ static int mroute_do_pim;
83#define mroute_do_pim 0 74#define mroute_do_pim 0
84#endif 75#endif
85 76
86static struct mfc6_cache *mfc6_cache_array[MFC_LINES]; /* Forwarding cache */ 77static struct mfc6_cache *mfc6_cache_array[MFC6_LINES]; /* Forwarding cache */
87 78
88static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */ 79static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */
89static atomic_t cache_resolve_queue_len; /* Size of unresolved */ 80static atomic_t cache_resolve_queue_len; /* Size of unresolved */
@@ -102,7 +93,7 @@ static DEFINE_SPINLOCK(mfc_unres_lock);
102static struct kmem_cache *mrt_cachep __read_mostly; 93static struct kmem_cache *mrt_cachep __read_mostly;
103 94
104static int ip6_mr_forward(struct sk_buff *skb, struct mfc6_cache *cache); 95static int ip6_mr_forward(struct sk_buff *skb, struct mfc6_cache *cache);
105static int ip6mr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert); 96static int ip6mr_cache_report(struct sk_buff *pkt, mifi_t mifi, int assert);
106static int ip6mr_fill_mroute(struct sk_buff *skb, struct mfc6_cache *c, struct rtmsg *rtm); 97static int ip6mr_fill_mroute(struct sk_buff *skb, struct mfc6_cache *c, struct rtmsg *rtm);
107 98
108#ifdef CONFIG_IPV6_PIMSM_V2 99#ifdef CONFIG_IPV6_PIMSM_V2
@@ -597,9 +588,9 @@ static void ip6mr_update_thresholds(struct mfc6_cache *cache, unsigned char *ttl
597{ 588{
598 int vifi; 589 int vifi;
599 590
600 cache->mfc_un.res.minvif = MAXVIFS; 591 cache->mfc_un.res.minvif = MAXMIFS;
601 cache->mfc_un.res.maxvif = 0; 592 cache->mfc_un.res.maxvif = 0;
602 memset(cache->mfc_un.res.ttls, 255, MAXVIFS); 593 memset(cache->mfc_un.res.ttls, 255, MAXMIFS);
603 594
604 for (vifi = 0; vifi < maxvif; vifi++) { 595 for (vifi = 0; vifi < maxvif; vifi++) {
605 if (MIF_EXISTS(vifi) && ttls[vifi] && ttls[vifi] < 255) { 596 if (MIF_EXISTS(vifi) && ttls[vifi] && ttls[vifi] < 255) {
@@ -700,7 +691,7 @@ static struct mfc6_cache *ip6mr_cache_alloc(void)
700 if (c == NULL) 691 if (c == NULL)
701 return NULL; 692 return NULL;
702 memset(c, 0, sizeof(*c)); 693 memset(c, 0, sizeof(*c));
703 c->mfc_un.res.minvif = MAXVIFS; 694 c->mfc_un.res.minvif = MAXMIFS;
704 return c; 695 return c;
705} 696}
706 697
@@ -753,7 +744,7 @@ static void ip6mr_cache_resolve(struct mfc6_cache *uc, struct mfc6_cache *c)
753 * Called under mrt_lock. 744 * Called under mrt_lock.
754 */ 745 */
755 746
756static int ip6mr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) 747static int ip6mr_cache_report(struct sk_buff *pkt, mifi_t mifi, int assert)
757{ 748{
758 struct sk_buff *skb; 749 struct sk_buff *skb;
759 struct mrt6msg *msg; 750 struct mrt6msg *msg;
@@ -815,7 +806,7 @@ static int ip6mr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
815 806
816 msg->im6_mbz = 0; 807 msg->im6_mbz = 0;
817 msg->im6_msgtype = assert; 808 msg->im6_msgtype = assert;
818 msg->im6_mif = vifi; 809 msg->im6_mif = mifi;
819 msg->im6_pad = 0; 810 msg->im6_pad = 0;
820 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr); 811 ipv6_addr_copy(&msg->im6_src, &ipv6_hdr(pkt)->saddr);
821 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr); 812 ipv6_addr_copy(&msg->im6_dst, &ipv6_hdr(pkt)->daddr);
@@ -848,7 +839,7 @@ static int ip6mr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
848 */ 839 */
849 840
850static int 841static int
851ip6mr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) 842ip6mr_cache_unresolved(mifi_t mifi, struct sk_buff *skb)
852{ 843{
853 int err; 844 int err;
854 struct mfc6_cache *c; 845 struct mfc6_cache *c;
@@ -883,7 +874,7 @@ ip6mr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
883 /* 874 /*
884 * Reflect first query at pim6sd 875 * Reflect first query at pim6sd
885 */ 876 */
886 if ((err = ip6mr_cache_report(skb, vifi, MRT6MSG_NOCACHE)) < 0) { 877 if ((err = ip6mr_cache_report(skb, mifi, MRT6MSG_NOCACHE)) < 0) {
887 /* If the report failed throw the cache entry 878 /* If the report failed throw the cache entry
888 out - Brad Parker 879 out - Brad Parker
889 */ 880 */
@@ -992,11 +983,11 @@ static int ip6mr_mfc_add(struct mf6cctl *mfc, int mrtsock)
992{ 983{
993 int line; 984 int line;
994 struct mfc6_cache *uc, *c, **cp; 985 struct mfc6_cache *uc, *c, **cp;
995 unsigned char ttls[MAXVIFS]; 986 unsigned char ttls[MAXMIFS];
996 int i; 987 int i;
997 988
998 memset(ttls, 255, MAXVIFS); 989 memset(ttls, 255, MAXMIFS);
999 for (i = 0; i < MAXVIFS; i++) { 990 for (i = 0; i < MAXMIFS; i++) {
1000 if (IF_ISSET(i, &mfc->mf6cc_ifset)) 991 if (IF_ISSET(i, &mfc->mf6cc_ifset))
1001 ttls[i] = 1; 992 ttls[i] = 1;
1002 993
@@ -1188,7 +1179,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
1188 return -EINVAL; 1179 return -EINVAL;
1189 if (copy_from_user(&vif, optval, sizeof(vif))) 1180 if (copy_from_user(&vif, optval, sizeof(vif)))
1190 return -EFAULT; 1181 return -EFAULT;
1191 if (vif.mif6c_mifi >= MAXVIFS) 1182 if (vif.mif6c_mifi >= MAXMIFS)
1192 return -ENFILE; 1183 return -ENFILE;
1193 rtnl_lock(); 1184 rtnl_lock();
1194 ret = mif6_add(&vif, sk == mroute6_socket); 1185 ret = mif6_add(&vif, sk == mroute6_socket);