]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCTP]: Set ports in every address returned by sctp_getladdrs()
authorVlad Yasevich <vladislav.yasevich@hp.com>
Mon, 28 Jan 2008 19:25:36 +0000 (14:25 -0500)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Thu, 7 Feb 2008 02:27:39 +0000 (21:27 -0500)
Thomas Dreibholz has reported that port numbers are not filled
in the results of sctp_getladdrs() when the socket was bound
to an ephemeral port.  This is only true, if the address was
not specified either.  So, fill in the port number correctly.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
net/sctp/socket.c

index 894c278c8cdcc41a28d193a0d69403b390d3babb..d47d5787e2e5b8eba49dcb177c0d8b6549d993f2 100644 (file)
@@ -4315,6 +4315,9 @@ static int sctp_copy_laddrs_old(struct sock *sk, __u16 port,
                    (AF_INET6 == addr->a.sa.sa_family))
                        continue;
                memcpy(&temp, &addr->a, sizeof(temp));
+               if (!temp.v4.sin_port)
+                       temp.v4.sin_port = htons(port);
+
                sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
                                                                &temp);
                addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
@@ -4347,6 +4350,9 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to,
                    (AF_INET6 == addr->a.sa.sa_family))
                        continue;
                memcpy(&temp, &addr->a, sizeof(temp));
+               if (!temp.v4.sin_port)
+                       temp.v4.sin_port = htons(port);
+
                sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
                                                                &temp);
                addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;