107 do { |
107 do { |
108 head = &hashinfo->bhash[inet_bhashfn(net, rover, |
108 head = &hashinfo->bhash[inet_bhashfn(net, rover, |
109 hashinfo->bhash_size)]; |
109 hashinfo->bhash_size)]; |
110 spin_lock(&head->lock); |
110 spin_lock(&head->lock); |
111 inet_bind_bucket_for_each(tb, node, &head->chain) |
111 inet_bind_bucket_for_each(tb, node, &head->chain) |
112 if (tb->ib_net == net && tb->port == rover) |
112 if (ib_net(tb) == net && tb->port == rover) |
113 goto next; |
113 goto next; |
114 break; |
114 break; |
115 next: |
115 next: |
116 spin_unlock(&head->lock); |
116 spin_unlock(&head->lock); |
117 if (++rover > high) |
117 if (++rover > high) |
135 } else { |
135 } else { |
136 head = &hashinfo->bhash[inet_bhashfn(net, snum, |
136 head = &hashinfo->bhash[inet_bhashfn(net, snum, |
137 hashinfo->bhash_size)]; |
137 hashinfo->bhash_size)]; |
138 spin_lock(&head->lock); |
138 spin_lock(&head->lock); |
139 inet_bind_bucket_for_each(tb, node, &head->chain) |
139 inet_bind_bucket_for_each(tb, node, &head->chain) |
140 if (tb->ib_net == net && tb->port == snum) |
140 if (ib_net(tb) == net && tb->port == snum) |
141 goto tb_found; |
141 goto tb_found; |
142 } |
142 } |
143 tb = NULL; |
143 tb = NULL; |
144 goto tb_not_found; |
144 goto tb_not_found; |
145 tb_found: |
145 tb_found: |
321 sk_reset_timer(sk, &sk->sk_timer, jiffies + len); |
321 sk_reset_timer(sk, &sk->sk_timer, jiffies + len); |
322 } |
322 } |
323 |
323 |
324 EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); |
324 EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); |
325 |
325 |
326 struct dst_entry* inet_csk_route_req(struct sock *sk, |
326 struct dst_entry *inet_csk_route_req(struct sock *sk, |
327 const struct request_sock *req) |
327 const struct request_sock *req) |
328 { |
328 { |
329 struct rtable *rt; |
329 struct rtable *rt; |
330 const struct inet_request_sock *ireq = inet_rsk(req); |
330 const struct inet_request_sock *ireq = inet_rsk(req); |
331 struct ip_options *opt = inet_rsk(req)->opt; |
331 struct ip_options *opt = inet_rsk(req)->opt; |
342 { .sport = inet_sk(sk)->sport, |
342 { .sport = inet_sk(sk)->sport, |
343 .dport = ireq->rmt_port } } }; |
343 .dport = ireq->rmt_port } } }; |
344 struct net *net = sock_net(sk); |
344 struct net *net = sock_net(sk); |
345 |
345 |
346 security_req_classify_flow(req, &fl); |
346 security_req_classify_flow(req, &fl); |
347 if (ip_route_output_flow(net, &rt, &fl, sk, 0)) { |
347 if (ip_route_output_flow(net, &rt, &fl, sk, 0)) |
348 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
348 goto no_route; |
349 return NULL; |
349 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) |
350 } |
350 goto route_err; |
351 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { |
|
352 ip_rt_put(rt); |
|
353 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
|
354 return NULL; |
|
355 } |
|
356 return &rt->u.dst; |
351 return &rt->u.dst; |
|
352 |
|
353 route_err: |
|
354 ip_rt_put(rt); |
|
355 no_route: |
|
356 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
|
357 return NULL; |
357 } |
358 } |
358 |
359 |
359 EXPORT_SYMBOL_GPL(inet_csk_route_req); |
360 EXPORT_SYMBOL_GPL(inet_csk_route_req); |
360 |
361 |
361 static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport, |
362 static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport, |