mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 07:23:14 +00:00
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>
This commit is contained in:
parent
dd927a2694
commit
9a1b9496cd
@ -244,6 +244,7 @@ struct mfc_cache {
|
|||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
struct rtmsg;
|
struct rtmsg;
|
||||||
extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
|
extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
|
||||||
|
__be32 saddr, __be32 daddr,
|
||||||
struct rtmsg *rtm, int nowait);
|
struct rtmsg *rtm, int nowait);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2041,20 +2041,20 @@ rtattr_failure:
|
|||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ipmr_get_route(struct net *net,
|
int ipmr_get_route(struct net *net, struct sk_buff *skb,
|
||||||
struct sk_buff *skb, struct rtmsg *rtm, int nowait)
|
__be32 saddr, __be32 daddr,
|
||||||
|
struct rtmsg *rtm, int nowait)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
struct mr_table *mrt;
|
|
||||||
struct mfc_cache *cache;
|
struct mfc_cache *cache;
|
||||||
struct rtable *rt = skb_rtable(skb);
|
struct mr_table *mrt;
|
||||||
|
int err;
|
||||||
|
|
||||||
mrt = ipmr_get_table(net, RT_TABLE_DEFAULT);
|
mrt = ipmr_get_table(net, RT_TABLE_DEFAULT);
|
||||||
if (mrt == NULL)
|
if (mrt == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
cache = ipmr_cache_find(mrt, rt->rt_src, rt->rt_dst);
|
cache = ipmr_cache_find(mrt, saddr, daddr);
|
||||||
|
|
||||||
if (cache == NULL) {
|
if (cache == NULL) {
|
||||||
struct sk_buff *skb2;
|
struct sk_buff *skb2;
|
||||||
@ -2087,8 +2087,8 @@ int ipmr_get_route(struct net *net,
|
|||||||
skb_reset_network_header(skb2);
|
skb_reset_network_header(skb2);
|
||||||
iph = ip_hdr(skb2);
|
iph = ip_hdr(skb2);
|
||||||
iph->ihl = sizeof(struct iphdr) >> 2;
|
iph->ihl = sizeof(struct iphdr) >> 2;
|
||||||
iph->saddr = rt->rt_src;
|
iph->saddr = saddr;
|
||||||
iph->daddr = rt->rt_dst;
|
iph->daddr = daddr;
|
||||||
iph->version = 0;
|
iph->version = 0;
|
||||||
err = ipmr_cache_unresolved(mrt, vif, skb2);
|
err = ipmr_cache_unresolved(mrt, vif, skb2);
|
||||||
read_unlock(&mrt_lock);
|
read_unlock(&mrt_lock);
|
||||||
|
@ -2857,7 +2857,9 @@ static int rt_fill_info(struct net *net,
|
|||||||
|
|
||||||
if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
|
if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
|
||||||
IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
|
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 (err <= 0) {
|
||||||
if (!nowait) {
|
if (!nowait) {
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user