aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorChangli Gao <xiaosuo@gmail.com>2010-11-12 13:43:55 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-17 15:27:45 -0500
commit5811662b15db018c740c57d037523683fd3e6123 (patch)
treef820610a6024799a26699f22dc9a4ef5dee07978 /net/ipv4/route.c
parentdd68ad2235b4625e0dc928b2b4c614d265f976d3 (diff)
net: use the macros defined for the members of flowi
Use the macros defined for the members of flowi to clean the code up. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 66610ea3c87..ec2333fb637 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -684,17 +684,17 @@ static inline bool rt_caching(const struct net *net)
684static inline bool compare_hash_inputs(const struct flowi *fl1, 684static inline bool compare_hash_inputs(const struct flowi *fl1,
685 const struct flowi *fl2) 685 const struct flowi *fl2)
686{ 686{
687 return ((((__force u32)fl1->nl_u.ip4_u.daddr ^ (__force u32)fl2->nl_u.ip4_u.daddr) | 687 return ((((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
688 ((__force u32)fl1->nl_u.ip4_u.saddr ^ (__force u32)fl2->nl_u.ip4_u.saddr) | 688 ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
689 (fl1->iif ^ fl2->iif)) == 0); 689 (fl1->iif ^ fl2->iif)) == 0);
690} 690}
691 691
692static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) 692static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
693{ 693{
694 return (((__force u32)fl1->nl_u.ip4_u.daddr ^ (__force u32)fl2->nl_u.ip4_u.daddr) | 694 return (((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
695 ((__force u32)fl1->nl_u.ip4_u.saddr ^ (__force u32)fl2->nl_u.ip4_u.saddr) | 695 ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
696 (fl1->mark ^ fl2->mark) | 696 (fl1->mark ^ fl2->mark) |
697 (*(u16 *)&fl1->nl_u.ip4_u.tos ^ *(u16 *)&fl2->nl_u.ip4_u.tos) | 697 (*(u16 *)&fl1->fl4_tos ^ *(u16 *)&fl2->fl4_tos) |
698 (fl1->oif ^ fl2->oif) | 698 (fl1->oif ^ fl2->oif) |
699 (fl1->iif ^ fl2->iif)) == 0; 699 (fl1->iif ^ fl2->iif)) == 0;
700} 700}
@@ -2089,12 +2089,10 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2089{ 2089{
2090 struct fib_result res; 2090 struct fib_result res;
2091 struct in_device *in_dev = __in_dev_get_rcu(dev); 2091 struct in_device *in_dev = __in_dev_get_rcu(dev);
2092 struct flowi fl = { .nl_u = { .ip4_u = 2092 struct flowi fl = { .fl4_dst = daddr,
2093 { .daddr = daddr, 2093 .fl4_src = saddr,
2094 .saddr = saddr, 2094 .fl4_tos = tos,
2095 .tos = tos, 2095 .fl4_scope = RT_SCOPE_UNIVERSE,
2096 .scope = RT_SCOPE_UNIVERSE,
2097 } },
2098 .mark = skb->mark, 2096 .mark = skb->mark,
2099 .iif = dev->ifindex }; 2097 .iif = dev->ifindex };
2100 unsigned flags = 0; 2098 unsigned flags = 0;
@@ -2480,14 +2478,11 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
2480 const struct flowi *oldflp) 2478 const struct flowi *oldflp)
2481{ 2479{
2482 u32 tos = RT_FL_TOS(oldflp); 2480 u32 tos = RT_FL_TOS(oldflp);
2483 struct flowi fl = { .nl_u = { .ip4_u = 2481 struct flowi fl = { .fl4_dst = oldflp->fl4_dst,
2484 { .daddr = oldflp->fl4_dst, 2482 .fl4_src = oldflp->fl4_src,
2485 .saddr = oldflp->fl4_src, 2483 .fl4_tos = tos & IPTOS_RT_MASK,
2486 .tos = tos & IPTOS_RT_MASK, 2484 .fl4_scope = ((tos & RTO_ONLINK) ?
2487 .scope = ((tos & RTO_ONLINK) ? 2485 RT_SCOPE_LINK : RT_SCOPE_UNIVERSE),
2488 RT_SCOPE_LINK :
2489 RT_SCOPE_UNIVERSE),
2490 } },
2491 .mark = oldflp->mark, 2486 .mark = oldflp->mark,
2492 .iif = net->loopback_dev->ifindex, 2487 .iif = net->loopback_dev->ifindex,
2493 .oif = oldflp->oif }; 2488 .oif = oldflp->oif };
@@ -2944,13 +2939,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2944 err = -rt->dst.error; 2939 err = -rt->dst.error;
2945 } else { 2940 } else {
2946 struct flowi fl = { 2941 struct flowi fl = {
2947 .nl_u = { 2942 .fl4_dst = dst,
2948 .ip4_u = { 2943 .fl4_src = src,
2949 .daddr = dst, 2944 .fl4_tos = rtm->rtm_tos,
2950 .saddr = src,
2951 .tos = rtm->rtm_tos,
2952 },
2953 },
2954 .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, 2945 .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
2955 .mark = mark, 2946 .mark = mark,
2956 }; 2947 };