aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/arp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-02 17:31:35 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-02 17:31:35 -0500
commitb23dd4fe42b455af5c6e20966b7d6959fa8352ea (patch)
treebf97323eae9a8d084170e573ff2c0c40bc72c3cd /net/ipv4/arp.c
parent452edd598f60522c11f7f88fdbab27eb36509d1a (diff)
ipv4: Make output route lookup return rtable directly.
Instead of on the stack. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r--net/ipv4/arp.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 7927589813b5..fa9988da1da4 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -440,7 +440,8 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
440 /*unsigned long now; */ 440 /*unsigned long now; */
441 struct net *net = dev_net(dev); 441 struct net *net = dev_net(dev);
442 442
443 if (ip_route_output_key(net, &rt, &fl) < 0) 443 rt = ip_route_output_key(net, &fl);
444 if (IS_ERR(rt))
444 return 1; 445 return 1;
445 if (rt->dst.dev != dev) { 446 if (rt->dst.dev != dev) {
446 NET_INC_STATS_BH(net, LINUX_MIB_ARPFILTER); 447 NET_INC_STATS_BH(net, LINUX_MIB_ARPFILTER);
@@ -1063,10 +1064,10 @@ static int arp_req_set(struct net *net, struct arpreq *r,
1063 if (dev == NULL) { 1064 if (dev == NULL) {
1064 struct flowi fl = { .fl4_dst = ip, 1065 struct flowi fl = { .fl4_dst = ip,
1065 .fl4_tos = RTO_ONLINK }; 1066 .fl4_tos = RTO_ONLINK };
1066 struct rtable *rt; 1067 struct rtable *rt = ip_route_output_key(net, &fl);
1067 err = ip_route_output_key(net, &rt, &fl); 1068
1068 if (err != 0) 1069 if (IS_ERR(rt))
1069 return err; 1070 return PTR_ERR(rt);
1070 dev = rt->dst.dev; 1071 dev = rt->dst.dev;
1071 ip_rt_put(rt); 1072 ip_rt_put(rt);
1072 if (!dev) 1073 if (!dev)
@@ -1177,7 +1178,6 @@ static int arp_req_delete_public(struct net *net, struct arpreq *r,
1177static int arp_req_delete(struct net *net, struct arpreq *r, 1178static int arp_req_delete(struct net *net, struct arpreq *r,
1178 struct net_device *dev) 1179 struct net_device *dev)
1179{ 1180{
1180 int err;
1181 __be32 ip; 1181 __be32 ip;
1182 1182
1183 if (r->arp_flags & ATF_PUBL) 1183 if (r->arp_flags & ATF_PUBL)
@@ -1187,10 +1187,9 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
1187 if (dev == NULL) { 1187 if (dev == NULL) {
1188 struct flowi fl = { .fl4_dst = ip, 1188 struct flowi fl = { .fl4_dst = ip,
1189 .fl4_tos = RTO_ONLINK }; 1189 .fl4_tos = RTO_ONLINK };
1190 struct rtable *rt; 1190 struct rtable *rt = ip_route_output_key(net, &fl);
1191 err = ip_route_output_key(net, &rt, &fl); 1191 if (IS_ERR(rt))
1192 if (err != 0) 1192 return PTR_ERR(rt);
1193 return err;
1194 dev = rt->dst.dev; 1193 dev = rt->dst.dev;
1195 ip_rt_put(rt); 1194 ip_rt_put(rt);
1196 if (!dev) 1195 if (!dev)