Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25-rc7 /net/ipv4/inet_connection_sock.c

Filename:/net/ipv4/inet_connection_sock.c
Lines Added:14
Lines Deleted:21
Also changed in: (Previous) 2.6.25-rc6  2.6.25-rc5  2.6.25-rc4  2.6.25-rc3  2.6.25-rc2  2.6.25-rc1 
(Following) 2.6.25-rc8  2.6.25-rc9  2.6.25  2.6.25-git2  2.6.25-git3  2.6.25-git4 

Location
[  2.6.25-rc7
  [  net
    [  ipv4
       o  inet_connection_sock.c

Patch

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 8fb6ca2..b189278 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -78,15 +78,14 @@ EXPORT_SYMBOL_GPL(inet_csk_bind_conflict);
 /* Obtain a reference to a local port for the given sock,
  * if snum is zero it means select any available local port.
  */
-int inet_csk_get_port(struct inet_hashinfo *hashinfo,
-            struct sock *sk, unsigned short snum,
-            int (*bind_conflict)(const struct sock *sk,
-                  const struct inet_bind_bucket *tb))
+int inet_csk_get_port(struct sock *sk, unsigned short snum)
 {
+   struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo;
    struct inet_bind_hashbucket *head;
    struct hlist_node *node;
    struct inet_bind_bucket *tb;
    int ret;
+   struct net *net = sk->sk_net;
 
    local_bh_disable();
    if (!snum) {
@@ -100,7 +99,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
          head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];
          spin_lock(&head->lock);
          inet_bind_bucket_for_each(tb, node, &head->chain)
-            if (tb->port == rover)
+            if (tb->ib_net == net && tb->port == rover)
                goto next;
          break;
       next:
@@ -127,7 +126,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
       head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)];
       spin_lock(&head->lock);
       inet_bind_bucket_for_each(tb, node, &head->chain)
-         if (tb->port == snum)
+         if (tb->ib_net == net && tb->port == snum)
             goto tb_found;
    }
    tb = NULL;
@@ -141,13 +140,14 @@ tb_found:
          goto success;
       } else {
          ret = 1;
-         if (bind_conflict(sk, tb))
+         if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb))
             goto fail_unlock;
       }
    }
 tb_not_found:
    ret = 1;
-   if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, head, snum)) == NULL)
+   if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep,
+               net, head, snum)) == NULL)
       goto fail_unlock;
    if (hlist_empty(&tb->owners)) {
       if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
@@ -277,18 +277,11 @@ void inet_csk_init_xmit_timers(struct sock *sk,
 {
    struct inet_connection_sock *icsk = inet_csk(sk);
 
-   init_timer(&icsk->icsk_retransmit_timer);
-   init_timer(&icsk->icsk_delack_timer);
-   init_timer(&sk->sk_timer);
-
-   icsk->icsk_retransmit_timer.function = retransmit_handler;
-   icsk->icsk_delack_timer.function     = delack_handler;
-   sk->sk_timer.function           = keepalive_handler;
-
-   icsk->icsk_retransmit_timer.data =
-      icsk->icsk_delack_timer.data =
-         sk->sk_timer.data  = (unsigned long)sk;
-
+   setup_timer(&icsk->icsk_retransmit_timer, retransmit_handler,
+         (unsigned long)sk);
+   setup_timer(&icsk->icsk_delack_timer, delack_handler,
+         (unsigned long)sk);
+   setup_timer(&sk->sk_timer, keepalive_handler, (unsigned long)sk);
    icsk->icsk_pending = icsk->icsk_ack.pending = 0;
 }
 
@@ -340,7 +333,7 @@ struct dst_entry* inet_csk_route_req(struct sock *sk,
                 .dport = ireq->rmt_port } } };
 
    security_req_classify_flow(req, &fl);
-   if (ip_route_output_flow(&rt, &fl, sk, 0)) {
+   if (ip_route_output_flow(&init_net, &rt, &fl, sk, 0)) {
       IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
       return NULL;
    }


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.