Skip to contentSkip to conversation

SCTP control socket question

DISCUSSION Denis V. Lunev 4 participants 8 messages Mar 27, 2008 – Mar 28, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Regards,
Den

#1 lore raw
Quoted 6 lines · Denis V. Lunev

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Why do you believe that the socket is hashed? That socket is only allocated and referenced. It's should not be in any hash tables since we hold a global reference on it.

-vlad

#2 lore raw
Quoted 11 lines · Vlad Yasevich
Quoted 6 lines · Denis V. Lunev

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Why do you believe that the socket is hashed? That socket is only allocated and referenced. It's should not be in any hash tables since we hold a global reference on it.

sctp_ctl_sock_init
__sock_create

    inet(6)_create
        sk->sk_prot->hash(sk);

For this purpose sk->sk_prot->unhash is explicitly called for ICMP/TCP etc cases.

Regards,
Den

#3 lore raw
Quoted 14 lines · Denis V. Lunev
Quoted 10 lines · Vlad Yasevich
Quoted 6 lines · Denis V. Lunev

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Why do you believe that the socket is hashed? That socket is only allocated and referenced. It's should not be in any hash tables since we hold a global reference on it.

sctp_ctl_sock_init
__sock_create

Quoted 9 lines
    inet(6)_create
        sk->sk_prot->hash(sk);

For this purpose sk->sk_prot->unhash is explicitly called for ICMP/TCP etc cases.

Regards,
Den

Ahhh... ;-)

struct proto sctp_prot = {
...
.hash = sctp_hash,
...
}

static void sctp_hash(struct sock *sk)

{
       /* STUB */
}

SCTP currently does't do any hashing on the sockets. It hashes SCTP structures that live under the socket.

Regards
-vlad

#4 lore raw
Quoted 33 lines · Vlad Yasevich
Quoted 14 lines · Denis V. Lunev
Quoted 10 lines · Vlad Yasevich
Quoted 6 lines · Denis V. Lunev

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Why do you believe that the socket is hashed? That socket is only allocated and referenced. It's should not be in any hash tables since we hold a global reference on it.

sctp_ctl_sock_init
__sock_create

Quoted 9 lines
    inet(6)_create
        sk->sk_prot->hash(sk);

For this purpose sk->sk_prot->unhash is explicitly called for ICMP/TCP etc cases.

Regards,
Den

Ahhh... ;-)

struct proto sctp_prot = {
...
.hash = sctp_hash,
...
}

Quoted 8 lines

static void sctp_hash(struct sock *sk)

{
        /* STUB */
}

SCTP currently does't do any hashing on the sockets. It hashes SCTP structures that live under the socket.

will you mind against this?

net/sctp/protocol.c +2 -5
index 5aea911..8d1b2bc 100644
@@ -680,16 +680,13 @@ static int sctp_ctl_sock_init(void)
 	else
 		family = PF_INET;
 
-	err = sock_create_kern(family, SOCK_SEQPACKET, IPPROTO_SCTP,
-			       &sctp_ctl_socket);
+	err = inet_csk_ctl_sock_create(&sctp_ctl_socket, 
+				       family, SOCK_SEQPACKET, IPPROTO_SCTP);
 	if (err < 0) {
 		printk(KERN_ERR
 		       "SCTP: Failed to create the SCTP control socket.\n");
 		return err;
 	}
-	sctp_ctl_socket->sk->sk_allocation = GFP_ATOMIC;
-	inet_sk(sctp_ctl_socket->sk)->uc_ttl = -1;
-
 	return 0;
 }
 
#5 lore raw
Quoted 38 lines · Denis V. Lunev
Quoted 37 lines · Vlad Yasevich
Quoted 13 lines · Denis V. Lunev
Quoted 10 lines · Vlad Yasevich
Quoted 6 lines · Denis V. Lunev

Hello, Vlad!

I have read SCTP sources and found that SCTP control socket (sctp_ctl_socket) remains hashed unlike similar staff in UDP/TCP etc.

Am I wrong, that it should not be hashed or not?

Why do you believe that the socket is hashed? That socket is only allocated and referenced. It's should not be in any hash tables since we hold a global reference on it.

sctp_ctl_sock_init
__sock_create

Quoted 9 lines
    inet(6)_create
        sk->sk_prot->hash(sk);

For this purpose sk->sk_prot->unhash is explicitly called for ICMP/TCP etc cases.

Regards,
Den

Ahhh... ;-)

struct proto sctp_prot = {
...
.hash = sctp_hash,
...
}

static void sctp_hash(struct sock *sk)

{
        /* STUB */
}
Quoted 5 lines
Quoted 2 lines

SCTP currently does't do any hashing on the sockets. It hashes SCTP structures that live under the socket.

will you mind against this?

That's fine. My one concern is that someone may erroneously interpret that SCTP sockets are derived from inet_connection_sock, but I can live with that.

-vlad

#6 lore raw
Quoted 5 lines
Quoted 2 lines

will you mind against this?

That's fine. My one concern is that someone may erroneously interpret that SCTP sockets are derived from inet_connection_sock, but I can live with that.

Agree. I'd rename it into some not-so-inet-related function.

Quoted 7 lines

-vlad

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#7 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Thu, 27 Mar 2008 17:15:53 +0300

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

will you mind against this?

That's fine. My one concern is that someone may erroneously interpret that SCTP sockets are derived from inet_connection_sock, but I can live with that.

Agree. I'd rename it into some not-so-inet-related function.

Can someone formally submit a final patch?

Thanks.