aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-04 15:18:54 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-04 15:18:54 -0400
commit9a1b9496cd2b013f74885218947fa7120d53e74c (patch)
treea48d2fdf14a7445a15a7553ef8b7a8732b5bcac1
parentdd927a2694ee412b440284dd72dd8e32caada3fc (diff)
ipv4: Pass explicit saddr/daddr args to ipmr_get_route().
This eliminates the need to use rt->rt_{src,dst}. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/mroute.h1
-rw-r--r--net/ipv4/ipmr.c16
-rw-r--r--net/ipv4/route.c4
3 files changed, 12 insertions, 9 deletions
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index b21d567692b2..46caaf44339d 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -244,6 +244,7 @@ struct mfc_cache {
244#ifdef __KERNEL__ 244#ifdef __KERNEL__
245struct rtmsg; 245struct rtmsg;
246extern int ipmr_get_route(struct net *net, struct sk_buff *skb, 246extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
247 __be32 saddr, __be32 daddr,
247 struct rtmsg *rtm, int nowait); 248 struct rtmsg *rtm, int nowait);
248#endif 249#endif
249 250
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 86033b7a05ba..30a7763c400e 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2041,20 +2041,20 @@ rtattr_failure:
2041 return -EMSGSIZE; 2041 return -EMSGSIZE;
2042} 2042}
2043 2043
2044int ipmr_get_route(struct net *net, 2044int ipmr_get_route(struct net *net, struct sk_buff *skb,
2045 struct sk_buff *skb, struct rtmsg *rtm, int nowait) 2045 __be32 saddr, __be32 daddr,
2046 struct rtmsg *rtm, int nowait)
2046{ 2047{
2047 int err;
2048 struct mr_table *mrt;
2049 struct mfc_cache *cache; 2048 struct mfc_cache *cache;
2050 struct rtable *rt = skb_rtable(skb); 2049 struct mr_table *mrt;
2050 int err;
2051 2051
2052 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); 2052 mrt = ipmr_get_table(net, RT_TABLE_DEFAULT);
2053 if (mrt == NULL) 2053 if (mrt == NULL)
2054 return -ENOENT; 2054 return -ENOENT;
2055 2055
2056 rcu_read_lock(); 2056 rcu_read_lock();
2057 cache = ipmr_cache_find(mrt, rt->rt_src, rt->rt_dst); 2057 cache = ipmr_cache_find(mrt, saddr, daddr);
2058 2058
2059 if (cache == NULL) { 2059 if (cache == NULL) {
2060 struct sk_buff *skb2; 2060 struct sk_buff *skb2;
@@ -2087,8 +2087,8 @@ int ipmr_get_route(struct net *net,
2087 skb_reset_network_header(skb2); 2087 skb_reset_network_header(skb2);
2088 iph = ip_hdr(skb2); 2088 iph = ip_hdr(skb2);
2089 iph->ihl = sizeof(struct iphdr) >> 2; 2089 iph->ihl = sizeof(struct iphdr) >> 2;
2090 iph->saddr = rt->rt_src; 2090 iph->saddr = saddr;
2091 iph->daddr = rt->rt_dst; 2091 iph->daddr = daddr;
2092 iph->version = 0; 2092 iph->version = 0;
2093 err = ipmr_cache_unresolved(mrt, vif, skb2); 2093 err = ipmr_cache_unresolved(mrt, vif, skb2);
2094 read_unlock(&mrt_lock); 2094 read_unlock(&mrt_lock);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 3bc685454b5b..6a83840b16af 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2857,7 +2857,9 @@ static int rt_fill_info(struct net *net,
2857 2857
2858 if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) && 2858 if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
2859 IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { 2859 IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
2860 int err = ipmr_get_route(net, skb, r, nowait); 2860 int err = ipmr_get_route(net, skb,
2861 rt->rt_src, rt->rt_dst,
2862 r, nowait);
2861 if (err <= 0) { 2863 if (err <= 0) {
2862 if (!nowait) { 2864 if (!nowait) {
2863 if (err == 0) 2865 if (err == 0)