diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-05 00:47:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-05 00:55:31 -0500 |
commit | 5e2b61f78411be25f0b84f97d5b5d312f184dfd1 (patch) | |
tree | 6a5faa5fb7a2242bebacba4cdb5722b988d3e909 | |
parent | 1018b5c01636c7c6bda31a719bda34fc631db29a (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>
-rw-r--r-- | include/net/route.h | 22 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 52 | ||||
-rw-r--r-- | net/ipv4/route.c | 153 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 7 | ||||
-rw-r--r-- | net/sched/cls_route.c | 2 | ||||
-rw-r--r-- | net/sched/em_meta.c | 2 |
7 files changed, 146 insertions, 94 deletions
diff --git a/include/net/route.h b/include/net/route.h index 8905d90e0044..9257f5f17337 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -53,16 +53,20 @@ struct fib_info; | |||
53 | struct rtable { | 53 | struct rtable { |
54 | struct dst_entry dst; | 54 | struct dst_entry dst; |
55 | 55 | ||
56 | /* Cache lookup keys */ | 56 | /* Lookup key. */ |
57 | struct flowi fl; | 57 | __be32 rt_key_dst; |
58 | __be32 rt_key_src; | ||
58 | 59 | ||
59 | int rt_genid; | 60 | int rt_genid; |
60 | unsigned rt_flags; | 61 | unsigned rt_flags; |
61 | __u16 rt_type; | 62 | __u16 rt_type; |
63 | __u8 rt_tos; | ||
62 | 64 | ||
63 | __be32 rt_dst; /* Path destination */ | 65 | __be32 rt_dst; /* Path destination */ |
64 | __be32 rt_src; /* Path source */ | 66 | __be32 rt_src; /* Path source */ |
65 | int rt_iif; | 67 | int rt_iif; |
68 | int rt_oif; | ||
69 | __u32 rt_mark; | ||
66 | 70 | ||
67 | /* Info on neighbour */ | 71 | /* Info on neighbour */ |
68 | __be32 rt_gateway; | 72 | __be32 rt_gateway; |
@@ -76,12 +80,12 @@ struct rtable { | |||
76 | 80 | ||
77 | static inline bool rt_is_input_route(struct rtable *rt) | 81 | static inline bool rt_is_input_route(struct rtable *rt) |
78 | { | 82 | { |
79 | return rt->fl.iif != 0; | 83 | return rt->rt_iif != 0; |
80 | } | 84 | } |
81 | 85 | ||
82 | static inline bool rt_is_output_route(struct rtable *rt) | 86 | static inline bool rt_is_output_route(struct rtable *rt) |
83 | { | 87 | { |
84 | return rt->fl.iif == 0; | 88 | return rt->rt_iif == 0; |
85 | } | 89 | } |
86 | 90 | ||
87 | struct ip_rt_acct { | 91 | struct ip_rt_acct { |
@@ -212,11 +216,11 @@ static inline struct rtable *ip_route_newports(struct rtable *rt, | |||
212 | __be16 dport, struct sock *sk) | 216 | __be16 dport, struct sock *sk) |
213 | { | 217 | { |
214 | if (sport != orig_sport || dport != orig_dport) { | 218 | if (sport != orig_sport || dport != orig_dport) { |
215 | struct flowi fl = { .oif = rt->fl.oif, | 219 | struct flowi fl = { .oif = rt->rt_oif, |
216 | .mark = rt->fl.mark, | 220 | .mark = rt->rt_mark, |
217 | .fl4_dst = rt->fl.fl4_dst, | 221 | .fl4_dst = rt->rt_key_dst, |
218 | .fl4_src = rt->fl.fl4_src, | 222 | .fl4_src = rt->rt_key_src, |
219 | .fl4_tos = rt->fl.fl4_tos, | 223 | .fl4_tos = rt->rt_tos, |
220 | .proto = protocol, | 224 | .proto = protocol, |
221 | .fl_ip_sport = sport, | 225 | .fl_ip_sport = sport, |
222 | .fl_ip_dport = dport }; | 226 | .fl_ip_dport = dport }; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 994a785d98f9..1771ce662548 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -563,7 +563,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
563 | rcu_read_lock(); | 563 | rcu_read_lock(); |
564 | if (rt_is_input_route(rt) && | 564 | if (rt_is_input_route(rt) && |
565 | net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) | 565 | net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) |
566 | dev = dev_get_by_index_rcu(net, rt->fl.iif); | 566 | dev = dev_get_by_index_rcu(net, rt->rt_iif); |
567 | 567 | ||
568 | if (dev) | 568 | if (dev) |
569 | saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK); | 569 | saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK); |
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))) { |
1985 | drop: | 2015 | drop: |
1986 | kfree_skb(skb); | 2016 | kfree_skb(skb); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 602473c92019..92a24ea34c1b 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -424,7 +424,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
424 | dst_metric(&r->dst, RTAX_WINDOW), | 424 | dst_metric(&r->dst, RTAX_WINDOW), |
425 | (int)((dst_metric(&r->dst, RTAX_RTT) >> 3) + | 425 | (int)((dst_metric(&r->dst, RTAX_RTT) >> 3) + |
426 | dst_metric(&r->dst, RTAX_RTTVAR)), | 426 | dst_metric(&r->dst, RTAX_RTTVAR)), |
427 | r->fl.fl4_tos, | 427 | r->rt_tos, |
428 | r->dst.hh ? atomic_read(&r->dst.hh->hh_refcnt) : -1, | 428 | r->dst.hh ? atomic_read(&r->dst.hh->hh_refcnt) : -1, |
429 | r->dst.hh ? (r->dst.hh->hh_output == | 429 | r->dst.hh ? (r->dst.hh->hh_output == |
430 | dev_queue_xmit) : 0, | 430 | dev_queue_xmit) : 0, |
@@ -711,22 +711,22 @@ static inline bool rt_caching(const struct net *net) | |||
711 | net->ipv4.sysctl_rt_cache_rebuild_count; | 711 | net->ipv4.sysctl_rt_cache_rebuild_count; |
712 | } | 712 | } |
713 | 713 | ||
714 | static inline bool compare_hash_inputs(const struct flowi *fl1, | 714 | static inline bool compare_hash_inputs(const struct rtable *rt1, |
715 | const struct flowi *fl2) | 715 | const struct rtable *rt2) |
716 | { | 716 | { |
717 | return ((((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) | | 717 | return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) | |
718 | ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) | | 718 | ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) | |
719 | (fl1->iif ^ fl2->iif)) == 0); | 719 | (rt1->rt_iif ^ rt2->rt_iif)) == 0); |
720 | } | 720 | } |
721 | 721 | ||
722 | static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | 722 | static inline int compare_keys(struct rtable *rt1, struct rtable *rt2) |
723 | { | 723 | { |
724 | return (((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) | | 724 | return (((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) | |
725 | ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) | | 725 | ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) | |
726 | (fl1->mark ^ fl2->mark) | | 726 | (rt1->rt_mark ^ rt2->rt_mark) | |
727 | (*(u16 *)&fl1->fl4_tos ^ *(u16 *)&fl2->fl4_tos) | | 727 | (rt1->rt_tos ^ rt2->rt_tos) | |
728 | (fl1->oif ^ fl2->oif) | | 728 | (rt1->rt_oif ^ rt2->rt_oif) | |
729 | (fl1->iif ^ fl2->iif)) == 0; | 729 | (rt1->rt_iif ^ rt2->rt_iif)) == 0; |
730 | } | 730 | } |
731 | 731 | ||
732 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) | 732 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) |
@@ -813,7 +813,7 @@ static int has_noalias(const struct rtable *head, const struct rtable *rth) | |||
813 | const struct rtable *aux = head; | 813 | const struct rtable *aux = head; |
814 | 814 | ||
815 | while (aux != rth) { | 815 | while (aux != rth) { |
816 | if (compare_hash_inputs(&aux->fl, &rth->fl)) | 816 | if (compare_hash_inputs(aux, rth)) |
817 | return 0; | 817 | return 0; |
818 | aux = rcu_dereference_protected(aux->dst.rt_next, 1); | 818 | aux = rcu_dereference_protected(aux->dst.rt_next, 1); |
819 | } | 819 | } |
@@ -1073,7 +1073,7 @@ restart: | |||
1073 | rt_free(rth); | 1073 | rt_free(rth); |
1074 | continue; | 1074 | continue; |
1075 | } | 1075 | } |
1076 | if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) { | 1076 | if (compare_keys(rth, rt) && compare_netns(rth, rt)) { |
1077 | /* Put it first */ | 1077 | /* Put it first */ |
1078 | *rthp = rth->dst.rt_next; | 1078 | *rthp = rth->dst.rt_next; |
1079 | /* | 1079 | /* |
@@ -1136,7 +1136,7 @@ restart: | |||
1136 | rt_emergency_hash_rebuild(net); | 1136 | rt_emergency_hash_rebuild(net); |
1137 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1137 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1138 | 1138 | ||
1139 | hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, | 1139 | hash = rt_hash(rt->rt_key_dst, rt->rt_key_src, |
1140 | ifindex, rt_genid(net)); | 1140 | ifindex, rt_genid(net)); |
1141 | goto restart; | 1141 | goto restart; |
1142 | } | 1142 | } |
@@ -1344,12 +1344,12 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
1344 | ip_rt_put(rt); | 1344 | ip_rt_put(rt); |
1345 | ret = NULL; | 1345 | ret = NULL; |
1346 | } else if (rt->rt_flags & RTCF_REDIRECTED) { | 1346 | } else if (rt->rt_flags & RTCF_REDIRECTED) { |
1347 | unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, | 1347 | unsigned hash = rt_hash(rt->rt_key_dst, rt->rt_key_src, |
1348 | rt->fl.oif, | 1348 | rt->rt_oif, |
1349 | rt_genid(dev_net(dst->dev))); | 1349 | rt_genid(dev_net(dst->dev))); |
1350 | #if RT_CACHE_DEBUG >= 1 | 1350 | #if RT_CACHE_DEBUG >= 1 |
1351 | printk(KERN_DEBUG "ipv4_negative_advice: redirect to %pI4/%02x dropped\n", | 1351 | printk(KERN_DEBUG "ipv4_negative_advice: redirect to %pI4/%02x dropped\n", |
1352 | &rt->rt_dst, rt->fl.fl4_tos); | 1352 | &rt->rt_dst, rt->rt_tos); |
1353 | #endif | 1353 | #endif |
1354 | rt_del(hash, rt); | 1354 | rt_del(hash, rt); |
1355 | ret = NULL; | 1355 | ret = NULL; |
@@ -1697,8 +1697,17 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt) | |||
1697 | if (rt_is_output_route(rt)) | 1697 | if (rt_is_output_route(rt)) |
1698 | src = rt->rt_src; | 1698 | src = rt->rt_src; |
1699 | else { | 1699 | else { |
1700 | struct flowi fl = { | ||
1701 | .fl4_dst = rt->rt_key_dst, | ||
1702 | .fl4_src = rt->rt_key_src, | ||
1703 | .fl4_tos = rt->rt_tos, | ||
1704 | .oif = rt->rt_oif, | ||
1705 | .iif = rt->rt_iif, | ||
1706 | .mark = rt->rt_mark, | ||
1707 | }; | ||
1708 | |||
1700 | rcu_read_lock(); | 1709 | rcu_read_lock(); |
1701 | if (fib_lookup(dev_net(rt->dst.dev), &rt->fl, &res) == 0) | 1710 | if (fib_lookup(dev_net(rt->dst.dev), &fl, &res) == 0) |
1702 | src = FIB_RES_PREFSRC(res); | 1711 | src = FIB_RES_PREFSRC(res); |
1703 | else | 1712 | else |
1704 | src = inet_select_addr(rt->dst.dev, rt->rt_gateway, | 1713 | src = inet_select_addr(rt->dst.dev, rt->rt_gateway, |
@@ -1748,7 +1757,8 @@ static unsigned int ipv4_default_mtu(const struct dst_entry *dst) | |||
1748 | return mtu; | 1757 | return mtu; |
1749 | } | 1758 | } |
1750 | 1759 | ||
1751 | static void rt_init_metrics(struct rtable *rt, struct fib_info *fi) | 1760 | static void rt_init_metrics(struct rtable *rt, const struct flowi *oldflp, |
1761 | struct fib_info *fi) | ||
1752 | { | 1762 | { |
1753 | struct inet_peer *peer; | 1763 | struct inet_peer *peer; |
1754 | int create = 0; | 1764 | int create = 0; |
@@ -1756,7 +1766,7 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi) | |||
1756 | /* If a peer entry exists for this destination, we must hook | 1766 | /* If a peer entry exists for this destination, we must hook |
1757 | * it up in order to get at cached metrics. | 1767 | * it up in order to get at cached metrics. |
1758 | */ | 1768 | */ |
1759 | if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS) | 1769 | if (oldflp && (oldflp->flags & FLOWI_FLAG_PRECOW_METRICS)) |
1760 | create = 1; | 1770 | create = 1; |
1761 | 1771 | ||
1762 | rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create); | 1772 | rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create); |
@@ -1783,7 +1793,8 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi) | |||
1783 | } | 1793 | } |
1784 | } | 1794 | } |
1785 | 1795 | ||
1786 | static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res, | 1796 | static void rt_set_nexthop(struct rtable *rt, const struct flowi *oldflp, |
1797 | const struct fib_result *res, | ||
1787 | struct fib_info *fi, u16 type, u32 itag) | 1798 | struct fib_info *fi, u16 type, u32 itag) |
1788 | { | 1799 | { |
1789 | struct dst_entry *dst = &rt->dst; | 1800 | struct dst_entry *dst = &rt->dst; |
@@ -1792,7 +1803,7 @@ static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res, | |||
1792 | if (FIB_RES_GW(*res) && | 1803 | if (FIB_RES_GW(*res) && |
1793 | FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) | 1804 | FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) |
1794 | rt->rt_gateway = FIB_RES_GW(*res); | 1805 | rt->rt_gateway = FIB_RES_GW(*res); |
1795 | rt_init_metrics(rt, fi); | 1806 | rt_init_metrics(rt, oldflp, fi); |
1796 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1807 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1797 | dst->tclassid = FIB_RES_NH(*res).nh_tclassid; | 1808 | dst->tclassid = FIB_RES_NH(*res).nh_tclassid; |
1798 | #endif | 1809 | #endif |
@@ -1861,20 +1872,19 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1861 | 1872 | ||
1862 | rth->dst.output = ip_rt_bug; | 1873 | rth->dst.output = ip_rt_bug; |
1863 | 1874 | ||
1864 | rth->fl.fl4_dst = daddr; | 1875 | rth->rt_key_dst = daddr; |
1865 | rth->rt_dst = daddr; | 1876 | rth->rt_dst = daddr; |
1866 | rth->fl.fl4_tos = tos; | 1877 | rth->rt_tos = tos; |
1867 | rth->fl.mark = skb->mark; | 1878 | rth->rt_mark = skb->mark; |
1868 | rth->fl.fl4_src = saddr; | 1879 | rth->rt_key_src = saddr; |
1869 | rth->rt_src = saddr; | 1880 | rth->rt_src = saddr; |
1870 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1881 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1871 | rth->dst.tclassid = itag; | 1882 | rth->dst.tclassid = itag; |
1872 | #endif | 1883 | #endif |
1873 | rth->rt_iif = | 1884 | rth->rt_iif = dev->ifindex; |
1874 | rth->fl.iif = dev->ifindex; | ||
1875 | rth->dst.dev = init_net.loopback_dev; | 1885 | rth->dst.dev = init_net.loopback_dev; |
1876 | dev_hold(rth->dst.dev); | 1886 | dev_hold(rth->dst.dev); |
1877 | rth->fl.oif = 0; | 1887 | rth->rt_oif = 0; |
1878 | rth->rt_gateway = daddr; | 1888 | rth->rt_gateway = daddr; |
1879 | rth->rt_spec_dst= spec_dst; | 1889 | rth->rt_spec_dst= spec_dst; |
1880 | rth->rt_genid = rt_genid(dev_net(dev)); | 1890 | rth->rt_genid = rt_genid(dev_net(dev)); |
@@ -1999,25 +2009,24 @@ static int __mkroute_input(struct sk_buff *skb, | |||
1999 | goto cleanup; | 2009 | goto cleanup; |
2000 | } | 2010 | } |
2001 | 2011 | ||
2002 | rth->fl.fl4_dst = daddr; | 2012 | rth->rt_key_dst = daddr; |
2003 | rth->rt_dst = daddr; | 2013 | rth->rt_dst = daddr; |
2004 | rth->fl.fl4_tos = tos; | 2014 | rth->rt_tos = tos; |
2005 | rth->fl.mark = skb->mark; | 2015 | rth->rt_mark = skb->mark; |
2006 | rth->fl.fl4_src = saddr; | 2016 | rth->rt_key_src = saddr; |
2007 | rth->rt_src = saddr; | 2017 | rth->rt_src = saddr; |
2008 | rth->rt_gateway = daddr; | 2018 | rth->rt_gateway = daddr; |
2009 | rth->rt_iif = | 2019 | rth->rt_iif = in_dev->dev->ifindex; |
2010 | rth->fl.iif = in_dev->dev->ifindex; | ||
2011 | rth->dst.dev = (out_dev)->dev; | 2020 | rth->dst.dev = (out_dev)->dev; |
2012 | dev_hold(rth->dst.dev); | 2021 | dev_hold(rth->dst.dev); |
2013 | rth->fl.oif = 0; | 2022 | rth->rt_oif = 0; |
2014 | rth->rt_spec_dst= spec_dst; | 2023 | rth->rt_spec_dst= spec_dst; |
2015 | 2024 | ||
2016 | rth->dst.input = ip_forward; | 2025 | rth->dst.input = ip_forward; |
2017 | rth->dst.output = ip_output; | 2026 | rth->dst.output = ip_output; |
2018 | rth->rt_genid = rt_genid(dev_net(rth->dst.dev)); | 2027 | rth->rt_genid = rt_genid(dev_net(rth->dst.dev)); |
2019 | 2028 | ||
2020 | rt_set_nexthop(rth, res, res->fi, res->type, itag); | 2029 | rt_set_nexthop(rth, NULL, res, res->fi, res->type, itag); |
2021 | 2030 | ||
2022 | rth->rt_flags = flags; | 2031 | rth->rt_flags = flags; |
2023 | 2032 | ||
@@ -2172,17 +2181,16 @@ local_input: | |||
2172 | rth->dst.output= ip_rt_bug; | 2181 | rth->dst.output= ip_rt_bug; |
2173 | rth->rt_genid = rt_genid(net); | 2182 | rth->rt_genid = rt_genid(net); |
2174 | 2183 | ||
2175 | rth->fl.fl4_dst = daddr; | 2184 | rth->rt_key_dst = daddr; |
2176 | rth->rt_dst = daddr; | 2185 | rth->rt_dst = daddr; |
2177 | rth->fl.fl4_tos = tos; | 2186 | rth->rt_tos = tos; |
2178 | rth->fl.mark = skb->mark; | 2187 | rth->rt_mark = skb->mark; |
2179 | rth->fl.fl4_src = saddr; | 2188 | rth->rt_key_src = saddr; |
2180 | rth->rt_src = saddr; | 2189 | rth->rt_src = saddr; |
2181 | #ifdef CONFIG_IP_ROUTE_CLASSID | 2190 | #ifdef CONFIG_IP_ROUTE_CLASSID |
2182 | rth->dst.tclassid = itag; | 2191 | rth->dst.tclassid = itag; |
2183 | #endif | 2192 | #endif |
2184 | rth->rt_iif = | 2193 | rth->rt_iif = dev->ifindex; |
2185 | rth->fl.iif = dev->ifindex; | ||
2186 | rth->dst.dev = net->loopback_dev; | 2194 | rth->dst.dev = net->loopback_dev; |
2187 | dev_hold(rth->dst.dev); | 2195 | dev_hold(rth->dst.dev); |
2188 | rth->rt_gateway = daddr; | 2196 | rth->rt_gateway = daddr; |
@@ -2261,12 +2269,12 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2261 | 2269 | ||
2262 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2270 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
2263 | rth = rcu_dereference(rth->dst.rt_next)) { | 2271 | rth = rcu_dereference(rth->dst.rt_next)) { |
2264 | if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) | | 2272 | if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) | |
2265 | ((__force u32)rth->fl.fl4_src ^ (__force u32)saddr) | | 2273 | ((__force u32)rth->rt_key_src ^ (__force u32)saddr) | |
2266 | (rth->fl.iif ^ iif) | | 2274 | (rth->rt_iif ^ iif) | |
2267 | rth->fl.oif | | 2275 | rth->rt_oif | |
2268 | (rth->fl.fl4_tos ^ tos)) == 0 && | 2276 | (rth->rt_tos ^ tos)) == 0 && |
2269 | rth->fl.mark == skb->mark && | 2277 | rth->rt_mark == skb->mark && |
2270 | net_eq(dev_net(rth->dst.dev), net) && | 2278 | net_eq(dev_net(rth->dst.dev), net) && |
2271 | !rt_is_expired(rth)) { | 2279 | !rt_is_expired(rth)) { |
2272 | if (noref) { | 2280 | if (noref) { |
@@ -2374,11 +2382,11 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2374 | if (!rth) | 2382 | if (!rth) |
2375 | return ERR_PTR(-ENOBUFS); | 2383 | return ERR_PTR(-ENOBUFS); |
2376 | 2384 | ||
2377 | rth->fl.fl4_dst = oldflp->fl4_dst; | 2385 | rth->rt_key_dst = oldflp->fl4_dst; |
2378 | rth->fl.fl4_tos = tos; | 2386 | rth->rt_tos = tos; |
2379 | rth->fl.fl4_src = oldflp->fl4_src; | 2387 | rth->rt_key_src = oldflp->fl4_src; |
2380 | rth->fl.oif = oldflp->oif; | 2388 | rth->rt_oif = oldflp->oif; |
2381 | rth->fl.mark = oldflp->mark; | 2389 | rth->rt_mark = oldflp->mark; |
2382 | rth->rt_dst = fl->fl4_dst; | 2390 | rth->rt_dst = fl->fl4_dst; |
2383 | rth->rt_src = fl->fl4_src; | 2391 | rth->rt_src = fl->fl4_src; |
2384 | rth->rt_iif = 0; | 2392 | rth->rt_iif = 0; |
@@ -2416,7 +2424,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2416 | #endif | 2424 | #endif |
2417 | } | 2425 | } |
2418 | 2426 | ||
2419 | rt_set_nexthop(rth, res, fi, type, 0); | 2427 | rt_set_nexthop(rth, oldflp, res, fi, type, 0); |
2420 | 2428 | ||
2421 | rth->rt_flags = flags; | 2429 | rth->rt_flags = flags; |
2422 | return rth; | 2430 | return rth; |
@@ -2629,12 +2637,12 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *flp) | |||
2629 | rcu_read_lock_bh(); | 2637 | rcu_read_lock_bh(); |
2630 | for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth; | 2638 | for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth; |
2631 | rth = rcu_dereference_bh(rth->dst.rt_next)) { | 2639 | rth = rcu_dereference_bh(rth->dst.rt_next)) { |
2632 | if (rth->fl.fl4_dst == flp->fl4_dst && | 2640 | if (rth->rt_key_dst == flp->fl4_dst && |
2633 | rth->fl.fl4_src == flp->fl4_src && | 2641 | rth->rt_key_src == flp->fl4_src && |
2634 | rt_is_output_route(rth) && | 2642 | rt_is_output_route(rth) && |
2635 | rth->fl.oif == flp->oif && | 2643 | rth->rt_oif == flp->oif && |
2636 | rth->fl.mark == flp->mark && | 2644 | rth->rt_mark == flp->mark && |
2637 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & | 2645 | !((rth->rt_tos ^ flp->fl4_tos) & |
2638 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2646 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
2639 | net_eq(dev_net(rth->dst.dev), net) && | 2647 | net_eq(dev_net(rth->dst.dev), net) && |
2640 | !rt_is_expired(rth)) { | 2648 | !rt_is_expired(rth)) { |
@@ -2693,7 +2701,12 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or | |||
2693 | if (new->dev) | 2701 | if (new->dev) |
2694 | dev_hold(new->dev); | 2702 | dev_hold(new->dev); |
2695 | 2703 | ||
2696 | rt->fl = ort->fl; | 2704 | rt->rt_key_dst = ort->rt_key_dst; |
2705 | rt->rt_key_src = ort->rt_key_src; | ||
2706 | rt->rt_tos = ort->rt_tos; | ||
2707 | rt->rt_iif = ort->rt_iif; | ||
2708 | rt->rt_oif = ort->rt_oif; | ||
2709 | rt->rt_mark = ort->rt_mark; | ||
2697 | 2710 | ||
2698 | rt->rt_genid = rt_genid(net); | 2711 | rt->rt_genid = rt_genid(net); |
2699 | rt->rt_flags = ort->rt_flags; | 2712 | rt->rt_flags = ort->rt_flags; |
@@ -2756,7 +2769,7 @@ static int rt_fill_info(struct net *net, | |||
2756 | r->rtm_family = AF_INET; | 2769 | r->rtm_family = AF_INET; |
2757 | r->rtm_dst_len = 32; | 2770 | r->rtm_dst_len = 32; |
2758 | r->rtm_src_len = 0; | 2771 | r->rtm_src_len = 0; |
2759 | r->rtm_tos = rt->fl.fl4_tos; | 2772 | r->rtm_tos = rt->rt_tos; |
2760 | r->rtm_table = RT_TABLE_MAIN; | 2773 | r->rtm_table = RT_TABLE_MAIN; |
2761 | NLA_PUT_U32(skb, RTA_TABLE, RT_TABLE_MAIN); | 2774 | NLA_PUT_U32(skb, RTA_TABLE, RT_TABLE_MAIN); |
2762 | r->rtm_type = rt->rt_type; | 2775 | r->rtm_type = rt->rt_type; |
@@ -2768,9 +2781,9 @@ static int rt_fill_info(struct net *net, | |||
2768 | 2781 | ||
2769 | NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst); | 2782 | NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst); |
2770 | 2783 | ||
2771 | if (rt->fl.fl4_src) { | 2784 | if (rt->rt_key_src) { |
2772 | r->rtm_src_len = 32; | 2785 | r->rtm_src_len = 32; |
2773 | NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src); | 2786 | NLA_PUT_BE32(skb, RTA_SRC, rt->rt_key_src); |
2774 | } | 2787 | } |
2775 | if (rt->dst.dev) | 2788 | if (rt->dst.dev) |
2776 | NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex); | 2789 | NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex); |
@@ -2780,7 +2793,7 @@ static int rt_fill_info(struct net *net, | |||
2780 | #endif | 2793 | #endif |
2781 | if (rt_is_input_route(rt)) | 2794 | if (rt_is_input_route(rt)) |
2782 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst); | 2795 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst); |
2783 | else if (rt->rt_src != rt->fl.fl4_src) | 2796 | else if (rt->rt_src != rt->rt_key_src) |
2784 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src); | 2797 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src); |
2785 | 2798 | ||
2786 | if (rt->rt_dst != rt->rt_gateway) | 2799 | if (rt->rt_dst != rt->rt_gateway) |
@@ -2789,8 +2802,8 @@ static int rt_fill_info(struct net *net, | |||
2789 | if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) | 2802 | if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) |
2790 | goto nla_put_failure; | 2803 | goto nla_put_failure; |
2791 | 2804 | ||
2792 | if (rt->fl.mark) | 2805 | if (rt->rt_mark) |
2793 | NLA_PUT_BE32(skb, RTA_MARK, rt->fl.mark); | 2806 | NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark); |
2794 | 2807 | ||
2795 | error = rt->dst.error; | 2808 | error = rt->dst.error; |
2796 | expires = (rt->peer && rt->peer->pmtu_expires) ? | 2809 | expires = (rt->peer && rt->peer->pmtu_expires) ? |
@@ -2824,7 +2837,7 @@ static int rt_fill_info(struct net *net, | |||
2824 | } | 2837 | } |
2825 | } else | 2838 | } else |
2826 | #endif | 2839 | #endif |
2827 | NLA_PUT_U32(skb, RTA_IIF, rt->fl.iif); | 2840 | NLA_PUT_U32(skb, RTA_IIF, rt->rt_iif); |
2828 | } | 2841 | } |
2829 | 2842 | ||
2830 | if (rtnl_put_cacheinfo(skb, &rt->dst, id, ts, tsage, | 2843 | if (rtnl_put_cacheinfo(skb, &rt->dst, id, ts, tsage, |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 45b821480427..c70c42e7e77b 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -70,7 +70,12 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
70 | { | 70 | { |
71 | struct rtable *rt = (struct rtable *)xdst->route; | 71 | struct rtable *rt = (struct rtable *)xdst->route; |
72 | 72 | ||
73 | xdst->u.rt.fl = *fl; | 73 | rt->rt_key_dst = fl->fl4_dst; |
74 | rt->rt_key_src = fl->fl4_src; | ||
75 | rt->rt_tos = fl->fl4_tos; | ||
76 | rt->rt_iif = fl->iif; | ||
77 | rt->rt_oif = fl->oif; | ||
78 | rt->rt_mark = fl->mark; | ||
74 | 79 | ||
75 | xdst->u.dst.dev = dev; | 80 | xdst->u.dst.dev = dev; |
76 | dev_hold(dev); | 81 | dev_hold(dev); |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index d580cdfca093..a907905376df 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -143,7 +143,7 @@ static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
143 | if (head == NULL) | 143 | if (head == NULL) |
144 | goto old_method; | 144 | goto old_method; |
145 | 145 | ||
146 | iif = ((struct rtable *)dst)->fl.iif; | 146 | iif = ((struct rtable *)dst)->rt_iif; |
147 | 147 | ||
148 | h = route4_fastmap_hash(id, iif); | 148 | h = route4_fastmap_hash(id, iif); |
149 | if (id == head->fastmap[h].id && | 149 | if (id == head->fastmap[h].id && |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index e5e174782677..a4de67eca824 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -264,7 +264,7 @@ META_COLLECTOR(int_rtiif) | |||
264 | if (unlikely(skb_rtable(skb) == NULL)) | 264 | if (unlikely(skb_rtable(skb) == NULL)) |
265 | *err = -1; | 265 | *err = -1; |
266 | else | 266 | else |
267 | dst->value = skb_rtable(skb)->fl.iif; | 267 | dst->value = skb_rtable(skb)->rt_iif; |
268 | } | 268 | } |
269 | 269 | ||
270 | /************************************************************************** | 270 | /************************************************************************** |