diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 00:00:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:42 -0500 |
commit | 78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch) | |
tree | 9dccc5c16bf269d53d8499064ec95a998e84c646 /net/ipv4/arp.c | |
parent | 1561747ddf9d28185548687b11aae7074d6129c4 (diff) |
ipv4: Create and use route lookup helpers.
The idea here is this minimizes the number of places one has to edit
in order to make changes to how flows are defined and used.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r-- | net/ipv4/arp.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index fa9988da1da4..090d273d7865 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -433,14 +433,12 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) | |||
433 | 433 | ||
434 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) | 434 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) |
435 | { | 435 | { |
436 | struct flowi fl = { .fl4_dst = sip, | ||
437 | .fl4_src = tip }; | ||
438 | struct rtable *rt; | 436 | struct rtable *rt; |
439 | int flag = 0; | 437 | int flag = 0; |
440 | /*unsigned long now; */ | 438 | /*unsigned long now; */ |
441 | struct net *net = dev_net(dev); | 439 | struct net *net = dev_net(dev); |
442 | 440 | ||
443 | rt = ip_route_output_key(net, &fl); | 441 | rt = ip_route_output(net, sip, tip, 0, 0); |
444 | if (IS_ERR(rt)) | 442 | if (IS_ERR(rt)) |
445 | return 1; | 443 | return 1; |
446 | if (rt->dst.dev != dev) { | 444 | if (rt->dst.dev != dev) { |
@@ -1062,9 +1060,7 @@ static int arp_req_set(struct net *net, struct arpreq *r, | |||
1062 | if (r->arp_flags & ATF_PERM) | 1060 | if (r->arp_flags & ATF_PERM) |
1063 | r->arp_flags |= ATF_COM; | 1061 | r->arp_flags |= ATF_COM; |
1064 | if (dev == NULL) { | 1062 | if (dev == NULL) { |
1065 | struct flowi fl = { .fl4_dst = ip, | 1063 | struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0); |
1066 | .fl4_tos = RTO_ONLINK }; | ||
1067 | struct rtable *rt = ip_route_output_key(net, &fl); | ||
1068 | 1064 | ||
1069 | if (IS_ERR(rt)) | 1065 | if (IS_ERR(rt)) |
1070 | return PTR_ERR(rt); | 1066 | return PTR_ERR(rt); |
@@ -1185,9 +1181,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, | |||
1185 | 1181 | ||
1186 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1182 | ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1187 | if (dev == NULL) { | 1183 | if (dev == NULL) { |
1188 | struct flowi fl = { .fl4_dst = ip, | 1184 | struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0); |
1189 | .fl4_tos = RTO_ONLINK }; | ||
1190 | struct rtable *rt = ip_route_output_key(net, &fl); | ||
1191 | if (IS_ERR(rt)) | 1185 | if (IS_ERR(rt)) |
1192 | return PTR_ERR(rt); | 1186 | return PTR_ERR(rt); |
1193 | dev = rt->dst.dev; | 1187 | dev = rt->dst.dev; |