* [PATCH 1/2] [SCTP]: Correctly set IP id for SCTP traffic
@ 2006-10-31 1:38 Sridhar Samudrala
2006-10-31 2:54 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sridhar Samudrala @ 2006-10-31 1:38 UTC (permalink / raw)
To: davem; +Cc: netdev, lksctp-developers
[SCTP]: Correctly set IP id for SCTP traffic
Make SCTP 1-1 style and peeled-off associations behave like TCP when
setting IP id. In both cases, we set the inet_sk(sk)->daddr and initialize
inet_sk(sk)->id to a random value.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
---
net/sctp/protocol.c | 2 +-
net/sctp/socket.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index fac7674..5b4f82f 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -591,7 +591,7 @@ static struct sock *sctp_v4_create_accep
newinet->dport = htons(asoc->peer.port);
newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
newinet->pmtudisc = inet->pmtudisc;
- newinet->id = 0;
+ newinet->id = asoc->next_tsn ^ jiffies;
newinet->uc_ttl = -1;
newinet->mc_loop = 1;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9f34dec..c58fa6d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3372,6 +3372,7 @@ SCTP_STATIC int sctp_do_peeloff(struct s
{
struct sock *sk = asoc->base.sk;
struct socket *sock;
+ struct inet_sock *inetsk;
int err = 0;
/* An association cannot be branched off from an already peeled-off
@@ -3389,6 +3390,14 @@ SCTP_STATIC int sctp_do_peeloff(struct s
* asoc to the newsk.
*/
sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);
+
+ /* Make peeled-off sockets more like 1-1 accepted sockets.
+ * Set the daddr and initialize id to something more random
+ */
+ inetsk = inet_sk(sock->sk);
+ inetsk->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
+ inetsk->id = asoc->next_tsn ^ jiffies;
+
*sockp = sock;
return err;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] [SCTP]: Correctly set IP id for SCTP traffic
2006-10-31 1:38 [PATCH 1/2] [SCTP]: Correctly set IP id for SCTP traffic Sridhar Samudrala
@ 2006-10-31 2:54 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2006-10-31 2:54 UTC (permalink / raw)
To: sri; +Cc: netdev, lksctp-developers
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Mon, 30 Oct 2006 17:38:37 -0800
> [SCTP]: Correctly set IP id for SCTP traffic
>
> Make SCTP 1-1 style and peeled-off associations behave like TCP when
> setting IP id. In both cases, we set the inet_sk(sk)->daddr and initialize
> inet_sk(sk)->id to a random value.
>
> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-31 2:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31 1:38 [PATCH 1/2] [SCTP]: Correctly set IP id for SCTP traffic Sridhar Samudrala
2006-10-31 2:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).