diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-02 17:31:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-02 17:31:35 -0500 |
commit | b23dd4fe42b455af5c6e20966b7d6959fa8352ea (patch) | |
tree | bf97323eae9a8d084170e573ff2c0c40bc72c3cd /net/dccp/ipv4.c | |
parent | 452edd598f60522c11f7f88fdbab27eb36509d1a (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/dccp/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index a8ff95502081..7882377bc62e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -46,7 +46,6 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
46 | __be16 orig_sport, orig_dport; | 46 | __be16 orig_sport, orig_dport; |
47 | struct rtable *rt; | 47 | struct rtable *rt; |
48 | __be32 daddr, nexthop; | 48 | __be32 daddr, nexthop; |
49 | int tmp; | ||
50 | int err; | 49 | int err; |
51 | 50 | ||
52 | dp->dccps_role = DCCP_ROLE_CLIENT; | 51 | dp->dccps_role = DCCP_ROLE_CLIENT; |
@@ -66,12 +65,12 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
66 | 65 | ||
67 | orig_sport = inet->inet_sport; | 66 | orig_sport = inet->inet_sport; |
68 | orig_dport = usin->sin_port; | 67 | orig_dport = usin->sin_port; |
69 | tmp = ip_route_connect(&rt, nexthop, inet->inet_saddr, | 68 | rt = ip_route_connect(nexthop, inet->inet_saddr, |
70 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, | 69 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, |
71 | IPPROTO_DCCP, | 70 | IPPROTO_DCCP, |
72 | orig_sport, orig_dport, sk, true); | 71 | orig_sport, orig_dport, sk, true); |
73 | if (tmp < 0) | 72 | if (IS_ERR(rt)) |
74 | return tmp; | 73 | return PTR_ERR(rt); |
75 | 74 | ||
76 | if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { | 75 | if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { |
77 | ip_rt_put(rt); | 76 | ip_rt_put(rt); |
@@ -102,12 +101,13 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
102 | if (err != 0) | 101 | if (err != 0) |
103 | goto failure; | 102 | goto failure; |
104 | 103 | ||
105 | err = ip_route_newports(&rt, IPPROTO_DCCP, | 104 | rt = ip_route_newports(rt, IPPROTO_DCCP, |
106 | orig_sport, orig_dport, | 105 | orig_sport, orig_dport, |
107 | inet->inet_sport, inet->inet_dport, sk); | 106 | inet->inet_sport, inet->inet_dport, sk); |
108 | if (err != 0) | 107 | if (IS_ERR(rt)) { |
108 | rt = NULL; | ||
109 | goto failure; | 109 | goto failure; |
110 | 110 | } | |
111 | /* OK, now commit destination to socket. */ | 111 | /* OK, now commit destination to socket. */ |
112 | sk_setup_caps(sk, &rt->dst); | 112 | sk_setup_caps(sk, &rt->dst); |
113 | 113 | ||
@@ -475,7 +475,8 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, | |||
475 | }; | 475 | }; |
476 | 476 | ||
477 | security_skb_classify_flow(skb, &fl); | 477 | security_skb_classify_flow(skb, &fl); |
478 | if (ip_route_output_flow(net, &rt, &fl, sk)) { | 478 | rt = ip_route_output_flow(net, &fl, sk); |
479 | if (IS_ERR(rt)) { | ||
479 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | 480 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
480 | return NULL; | 481 | return NULL; |
481 | } | 482 | } |