aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipmr.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-05 00:47:09 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-05 00:55:31 -0500
commit5e2b61f78411be25f0b84f97d5b5d312f184dfd1 (patch)
tree6a5faa5fb7a2242bebacba4cdb5722b988d3e909 /net/ipv4/ipmr.c
parent1018b5c01636c7c6bda31a719bda34fc631db29a (diff)
ipv4: Remove flowi from struct rtable.
The only necessary parts are the src/dst addresses, the interface indexes, the TOS, and the mark. The rest is unnecessary bloat, which amounts to nearly 50 bytes on 64-bit. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r--net/ipv4/ipmr.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 26ca2f2d37ce..9d5f6340af13 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1813,12 +1813,22 @@ int ip_mr_input(struct sk_buff *skb)
1813 if (IPCB(skb)->flags & IPSKB_FORWARDED) 1813 if (IPCB(skb)->flags & IPSKB_FORWARDED)
1814 goto dont_forward; 1814 goto dont_forward;
1815 1815
1816 err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt); 1816 {
1817 if (err < 0) { 1817 struct rtable *rt = skb_rtable(skb);
1818 kfree_skb(skb); 1818 struct flowi fl = {
1819 return err; 1819 .fl4_dst = rt->rt_key_dst,
1820 .fl4_src = rt->rt_key_src,
1821 .fl4_tos = rt->rt_tos,
1822 .oif = rt->rt_oif,
1823 .iif = rt->rt_iif,
1824 .mark = rt->rt_mark,
1825 };
1826 err = ipmr_fib_lookup(net, &fl, &mrt);
1827 if (err < 0) {
1828 kfree_skb(skb);
1829 return err;
1830 }
1820 } 1831 }
1821
1822 if (!local) { 1832 if (!local) {
1823 if (IPCB(skb)->opt.router_alert) { 1833 if (IPCB(skb)->opt.router_alert) {
1824 if (ip_call_ra_chain(skb)) 1834 if (ip_call_ra_chain(skb))
@@ -1946,9 +1956,19 @@ int pim_rcv_v1(struct sk_buff *skb)
1946 1956
1947 pim = igmp_hdr(skb); 1957 pim = igmp_hdr(skb);
1948 1958
1949 if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0) 1959 {
1950 goto drop; 1960 struct rtable *rt = skb_rtable(skb);
1951 1961 struct flowi fl = {
1962 .fl4_dst = rt->rt_key_dst,
1963 .fl4_src = rt->rt_key_src,
1964 .fl4_tos = rt->rt_tos,
1965 .oif = rt->rt_oif,
1966 .iif = rt->rt_iif,
1967 .mark = rt->rt_mark,
1968 };
1969 if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
1970 goto drop;
1971 }
1952 if (!mrt->mroute_do_pim || 1972 if (!mrt->mroute_do_pim ||
1953 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) 1973 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
1954 goto drop; 1974 goto drop;
@@ -1978,9 +1998,19 @@ static int pim_rcv(struct sk_buff *skb)
1978 csum_fold(skb_checksum(skb, 0, skb->len, 0)))) 1998 csum_fold(skb_checksum(skb, 0, skb->len, 0))))
1979 goto drop; 1999 goto drop;
1980 2000
1981 if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0) 2001 {
1982 goto drop; 2002 struct rtable *rt = skb_rtable(skb);
1983 2003 struct flowi fl = {
2004 .fl4_dst = rt->rt_key_dst,
2005 .fl4_src = rt->rt_key_src,
2006 .fl4_tos = rt->rt_tos,
2007 .oif = rt->rt_oif,
2008 .iif = rt->rt_iif,
2009 .mark = rt->rt_mark,
2010 };
2011 if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
2012 goto drop;
2013 }
1984 if (__pim_rcv(mrt, skb, sizeof(*pim))) { 2014 if (__pim_rcv(mrt, skb, sizeof(*pim))) {
1985drop: 2015drop:
1986 kfree_skb(skb); 2016 kfree_skb(skb);