diff options
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index ec834480abe7..bb81c958b744 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -103,7 +103,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) | |||
103 | rover = net_random() % remaining + low; | 103 | rover = net_random() % remaining + low; |
104 | 104 | ||
105 | do { | 105 | do { |
106 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; | 106 | head = &hashinfo->bhash[inet_bhashfn(net, rover, |
107 | hashinfo->bhash_size)]; | ||
107 | spin_lock(&head->lock); | 108 | spin_lock(&head->lock); |
108 | inet_bind_bucket_for_each(tb, node, &head->chain) | 109 | inet_bind_bucket_for_each(tb, node, &head->chain) |
109 | if (tb->ib_net == net && tb->port == rover) | 110 | if (tb->ib_net == net && tb->port == rover) |
@@ -130,7 +131,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) | |||
130 | */ | 131 | */ |
131 | snum = rover; | 132 | snum = rover; |
132 | } else { | 133 | } else { |
133 | head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; | 134 | head = &hashinfo->bhash[inet_bhashfn(net, snum, |
135 | hashinfo->bhash_size)]; | ||
134 | spin_lock(&head->lock); | 136 | spin_lock(&head->lock); |
135 | inet_bind_bucket_for_each(tb, node, &head->chain) | 137 | inet_bind_bucket_for_each(tb, node, &head->chain) |
136 | if (tb->ib_net == net && tb->port == snum) | 138 | if (tb->ib_net == net && tb->port == snum) |
@@ -336,15 +338,16 @@ struct dst_entry* inet_csk_route_req(struct sock *sk, | |||
336 | .uli_u = { .ports = | 338 | .uli_u = { .ports = |
337 | { .sport = inet_sk(sk)->sport, | 339 | { .sport = inet_sk(sk)->sport, |
338 | .dport = ireq->rmt_port } } }; | 340 | .dport = ireq->rmt_port } } }; |
341 | struct net *net = sock_net(sk); | ||
339 | 342 | ||
340 | security_req_classify_flow(req, &fl); | 343 | security_req_classify_flow(req, &fl); |
341 | if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0)) { | 344 | if (ip_route_output_flow(net, &rt, &fl, sk, 0)) { |
342 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | 345 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
343 | return NULL; | 346 | return NULL; |
344 | } | 347 | } |
345 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { | 348 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { |
346 | ip_rt_put(rt); | 349 | ip_rt_put(rt); |
347 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | 350 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); |
348 | return NULL; | 351 | return NULL; |
349 | } | 352 | } |
350 | return &rt->u.dst; | 353 | return &rt->u.dst; |