From 350b4aba463c77d3d72aebb31ca7adb396eb024d Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Fri, 4 May 2007 13:34:09 -0700 Subject: [PATCH] --- yaml --- r: 53502 b: refs/heads/master c: 16d00fb7765a43a1b05989062e985d283b3a1f2d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/sctp/socket.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5b5ea5649d73..f703de66d5ec 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a6d34162f5c6f522f857df274f1c8240f161e11 +refs/heads/master: 16d00fb7765a43a1b05989062e985d283b3a1f2d diff --git a/trunk/net/sctp/socket.c b/trunk/net/sctp/socket.c index 2fc0a92caa78..b2ffab62a229 100644 --- a/trunk/net/sctp/socket.c +++ b/trunk/net/sctp/socket.c @@ -972,6 +972,7 @@ static int __sctp_connect(struct sock* sk, int walk_size = 0; union sctp_addr *sa_addr; void *addr_buf; + unsigned short port; sp = sctp_sk(sk); ep = sp->ep; @@ -992,6 +993,7 @@ static int __sctp_connect(struct sock* sk, while (walk_size < addrs_size) { sa_addr = (union sctp_addr *)addr_buf; af = sctp_get_af_specific(sa_addr->sa.sa_family); + port = ntohs(sa_addr->v4.sin_port); /* If the address family is not supported or if this address * causes the address buffer to overflow return EINVAL. @@ -1005,6 +1007,12 @@ static int __sctp_connect(struct sock* sk, if (err) goto out_free; + /* Make sure the destination port is correctly set + * in all addresses. + */ + if (asoc && asoc->peer.port && asoc->peer.port != port) + goto out_free; + memcpy(&to, sa_addr, af->sockaddr_len); /* Check if there already is a matching association on the