aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/icmp.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/icmp.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/icmp.c')
-rw-r--r--net/ipv4/icmp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index c23bd8cdeee0..994a785d98f9 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -358,7 +358,8 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
358 .fl4_tos = RT_TOS(ip_hdr(skb)->tos), 358 .fl4_tos = RT_TOS(ip_hdr(skb)->tos),
359 .proto = IPPROTO_ICMP }; 359 .proto = IPPROTO_ICMP };
360 security_skb_classify_flow(skb, &fl); 360 security_skb_classify_flow(skb, &fl);
361 if (ip_route_output_key(net, &rt, &fl)) 361 rt = ip_route_output_key(net, &fl);
362 if (IS_ERR(rt))
362 goto out_unlock; 363 goto out_unlock;
363 } 364 }
364 if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, 365 if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type,
@@ -388,9 +389,9 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
388 int err; 389 int err;
389 390
390 security_skb_classify_flow(skb_in, &fl); 391 security_skb_classify_flow(skb_in, &fl);
391 err = __ip_route_output_key(net, &rt, &fl); 392 rt = __ip_route_output_key(net, &fl);
392 if (err) 393 if (IS_ERR(rt))
393 return ERR_PTR(err); 394 return rt;
394 395
395 /* No need to clone since we're just using its address. */ 396 /* No need to clone since we're just using its address. */
396 rt2 = rt; 397 rt2 = rt;
@@ -412,15 +413,19 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
412 goto relookup_failed; 413 goto relookup_failed;
413 414
414 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) { 415 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) {
415 err = __ip_route_output_key(net, &rt2, &fl); 416 rt2 = __ip_route_output_key(net, &fl);
417 if (IS_ERR(rt2))
418 err = PTR_ERR(rt2);
416 } else { 419 } else {
417 struct flowi fl2 = {}; 420 struct flowi fl2 = {};
418 unsigned long orefdst; 421 unsigned long orefdst;
419 422
420 fl2.fl4_dst = fl.fl4_src; 423 fl2.fl4_dst = fl.fl4_src;
421 err = ip_route_output_key(net, &rt2, &fl2); 424 rt2 = ip_route_output_key(net, &fl2);
422 if (err) 425 if (IS_ERR(rt2)) {
426 err = PTR_ERR(rt2);
423 goto relookup_failed; 427 goto relookup_failed;
428 }
424 /* Ugh! */ 429 /* Ugh! */
425 orefdst = skb_in->_skb_refdst; /* save old refdst */ 430 orefdst = skb_in->_skb_refdst; /* save old refdst */
426 err = ip_route_input(skb_in, fl.fl4_dst, fl.fl4_src, 431 err = ip_route_input(skb_in, fl.fl4_dst, fl.fl4_src,