ipv4: Pass explicit saddr/daddr args to ipmr_get_route().
authorDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2011 19:18:54 +0000 (12:18 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2011 19:18:54 +0000 (12:18 -0700)
This eliminates the need to use rt->rt_{src,dst}.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/mroute.h
net/ipv4/ipmr.c
net/ipv4/route.c

index b21d567692b2271165a8fe9bccfed0ba3bf60223..46caaf44339d6e706bd822218f4d56616eb51671 100644 (file)
@@ -244,6 +244,7 @@ struct mfc_cache {
 #ifdef __KERNEL__
 struct rtmsg;
 extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
+                         __be32 saddr, __be32 daddr,
                          struct rtmsg *rtm, int nowait);
 #endif
 
index 86033b7a05ba4d78cd92922094915f6ab6232149..30a7763c400e963d4771f0eafcc4897eea623181 100644 (file)
@@ -2041,20 +2041,20 @@ rtattr_failure:
        return -EMSGSIZE;
 }
 
-int ipmr_get_route(struct net *net,
-                  struct sk_buff *skb, struct rtmsg *rtm, int nowait)
+int ipmr_get_route(struct net *net, struct sk_buff *skb,
+                  __be32 saddr, __be32 daddr,
+                  struct rtmsg *rtm, int nowait)
 {
-       int err;
-       struct mr_table *mrt;
        struct mfc_cache *cache;
-       struct rtable *rt = skb_rtable(skb);
+       struct mr_table *mrt;
+       int err;
 
        mrt = ipmr_get_table(net, RT_TABLE_DEFAULT);
        if (mrt == NULL)
                return -ENOENT;
 
        rcu_read_lock();
-       cache = ipmr_cache_find(mrt, rt->rt_src, rt->rt_dst);
+       cache = ipmr_cache_find(mrt, saddr, daddr);
 
        if (cache == NULL) {
                struct sk_buff *skb2;
@@ -2087,8 +2087,8 @@ int ipmr_get_route(struct net *net,
                skb_reset_network_header(skb2);
                iph = ip_hdr(skb2);
                iph->ihl = sizeof(struct iphdr) >> 2;
-               iph->saddr = rt->rt_src;
-               iph->daddr = rt->rt_dst;
+               iph->saddr = saddr;
+               iph->daddr = daddr;
                iph->version = 0;
                err = ipmr_cache_unresolved(mrt, vif, skb2);
                read_unlock(&mrt_lock);
index 3bc685454b5be2db7f1fbb7e924bb4acf26931df..6a83840b16af7657076ed8c14fd42c0c4a7904ab 100644 (file)
@@ -2857,7 +2857,9 @@ static int rt_fill_info(struct net *net,
 
                if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
                    IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
-                       int err = ipmr_get_route(net, skb, r, nowait);
+                       int err = ipmr_get_route(net, skb,
+                                                rt->rt_src, rt->rt_dst,
+                                                r, nowait);
                        if (err <= 0) {
                                if (!nowait) {
                                        if (err == 0)