aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/transport.c
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2011-04-26 17:54:17 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-27 16:14:06 -0400
commitda0420bee24a1ba54e55a61e95b1a53205d7e62d (patch)
treeb17401ad5e6d97f8e3c8649725d5ca0a20e1b765 /net/sctp/transport.c
parentaf1384703f8a4ff3d245925d6596ef1c5c6e469e (diff)
sctp: clean up route lookup calls
Change the call to take the transport parameter and set the cached 'dst' appropriately inside the get_dst() function calls. This will allow us in the future to clean up source address storage as well. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/transport.c')
-rw-r--r--net/sctp/transport.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 1fbb920f8dfb..d8595dd1a8a7 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -213,17 +213,17 @@ void sctp_transport_set_owner(struct sctp_transport *transport,
213/* Initialize the pmtu of a transport. */ 213/* Initialize the pmtu of a transport. */
214void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) 214void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
215{ 215{
216 struct dst_entry *dst;
217 struct flowi fl; 216 struct flowi fl;
218 217
219 dst = transport->af_specific->get_dst(transport->asoc, 218 /* If we don't have a fresh route, look one up */
220 &transport->ipaddr, 219 if (!transport->dst || transport->dst->obsolete > 1) {
221 &transport->saddr, 220 dst_release(transport->dst);
221 transport->af_specific->get_dst(transport, &transport->saddr,
222 &fl, sk); 222 &fl, sk);
223 }
223 224
224 if (dst) { 225 if (transport->dst) {
225 transport->pathmtu = dst_mtu(dst); 226 transport->pathmtu = dst_mtu(transport->dst);
226 dst_release(dst);
227 } else 227 } else
228 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; 228 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
229} 229}
@@ -274,12 +274,9 @@ void sctp_transport_route(struct sctp_transport *transport,
274{ 274{
275 struct sctp_association *asoc = transport->asoc; 275 struct sctp_association *asoc = transport->asoc;
276 struct sctp_af *af = transport->af_specific; 276 struct sctp_af *af = transport->af_specific;
277 union sctp_addr *daddr = &transport->ipaddr;
278 struct dst_entry *dst;
279 struct flowi fl; 277 struct flowi fl;
280 278
281 dst = af->get_dst(asoc, daddr, saddr, &fl, sctp_opt2sk(opt)); 279 af->get_dst(transport, saddr, &fl, sctp_opt2sk(opt));
282 transport->dst = dst;
283 280
284 if (saddr) 281 if (saddr)
285 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr)); 282 memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
@@ -289,8 +286,8 @@ void sctp_transport_route(struct sctp_transport *transport,
289 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) { 286 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
290 return; 287 return;
291 } 288 }
292 if (dst) { 289 if (transport->dst) {
293 transport->pathmtu = dst_mtu(dst); 290 transport->pathmtu = dst_mtu(transport->dst);
294 291
295 /* Initialize sk->sk_rcv_saddr, if the transport is the 292 /* Initialize sk->sk_rcv_saddr, if the transport is the
296 * association's active path for getsockname(). 293 * association's active path for getsockname().