diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-03 22:42:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-03 22:42:43 -0400 |
commit | 417da66fa9d2f14b1a90b04095413b87907d8183 (patch) | |
tree | a116f41ccc3d0d0341efdfc8c0c35eac7cddcf27 /net/ipv4/ipmr.c | |
parent | 57a503c61db077b923e23f36050c02166a4a1db2 (diff) |
ipv4: Rework ipmr_rt_fib_lookup() flow key initialization.
Use information from the skb as much as possible, currently
this means daddr, saddr, and TOS.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index c81b9b661d26..3ad38a449588 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1788,12 +1788,14 @@ dont_forward: | |||
1788 | return 0; | 1788 | return 0; |
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct rtable *rt) | 1791 | static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb) |
1792 | { | 1792 | { |
1793 | struct rtable *rt = skb_rtable(skb); | ||
1794 | struct iphdr *iph = ip_hdr(skb); | ||
1793 | struct flowi4 fl4 = { | 1795 | struct flowi4 fl4 = { |
1794 | .daddr = rt->rt_key_dst, | 1796 | .daddr = iph->daddr, |
1795 | .saddr = rt->rt_key_src, | 1797 | .saddr = iph->saddr, |
1796 | .flowi4_tos = rt->rt_tos, | 1798 | .flowi4_tos = iph->tos, |
1797 | .flowi4_oif = rt->rt_oif, | 1799 | .flowi4_oif = rt->rt_oif, |
1798 | .flowi4_iif = rt->rt_iif, | 1800 | .flowi4_iif = rt->rt_iif, |
1799 | .flowi4_mark = rt->rt_mark, | 1801 | .flowi4_mark = rt->rt_mark, |
@@ -1825,7 +1827,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
1825 | if (IPCB(skb)->flags & IPSKB_FORWARDED) | 1827 | if (IPCB(skb)->flags & IPSKB_FORWARDED) |
1826 | goto dont_forward; | 1828 | goto dont_forward; |
1827 | 1829 | ||
1828 | mrt = ipmr_rt_fib_lookup(net, skb_rtable(skb)); | 1830 | mrt = ipmr_rt_fib_lookup(net, skb); |
1829 | if (IS_ERR(mrt)) { | 1831 | if (IS_ERR(mrt)) { |
1830 | kfree_skb(skb); | 1832 | kfree_skb(skb); |
1831 | return PTR_ERR(mrt); | 1833 | return PTR_ERR(mrt); |
@@ -1957,7 +1959,7 @@ int pim_rcv_v1(struct sk_buff *skb) | |||
1957 | 1959 | ||
1958 | pim = igmp_hdr(skb); | 1960 | pim = igmp_hdr(skb); |
1959 | 1961 | ||
1960 | mrt = ipmr_rt_fib_lookup(net, skb_rtable(skb)); | 1962 | mrt = ipmr_rt_fib_lookup(net, skb); |
1961 | if (IS_ERR(mrt)) | 1963 | if (IS_ERR(mrt)) |
1962 | goto drop; | 1964 | goto drop; |
1963 | if (!mrt->mroute_do_pim || | 1965 | if (!mrt->mroute_do_pim || |
@@ -1989,7 +1991,7 @@ static int pim_rcv(struct sk_buff *skb) | |||
1989 | csum_fold(skb_checksum(skb, 0, skb->len, 0)))) | 1991 | csum_fold(skb_checksum(skb, 0, skb->len, 0)))) |
1990 | goto drop; | 1992 | goto drop; |
1991 | 1993 | ||
1992 | mrt = ipmr_rt_fib_lookup(net, skb_rtable(skb)); | 1994 | mrt = ipmr_rt_fib_lookup(net, skb); |
1993 | if (IS_ERR(mrt)) | 1995 | if (IS_ERR(mrt)) |
1994 | goto drop; | 1996 | goto drop; |
1995 | if (__pim_rcv(mrt, skb, sizeof(*pim))) { | 1997 | if (__pim_rcv(mrt, skb, sizeof(*pim))) { |