Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b35805693e1915829355723537f99f1b8bc9cc0
Commit:     8b35805693e1915829355723537f99f1b8bc9cc0
Parent:     d570ee490fb18220262cfe41284d7aede797ed4f
Author:     Vlad Yasevich <[EMAIL PROTECTED]>
AuthorDate: Tue May 15 17:14:58 2007 -0400
Committer:  Vladislav Yasevich <[EMAIL PROTECTED]>
CommitDate: Wed Jun 13 20:44:41 2007 +0000

    [SCTP]: Allow unspecified port in sctp_bindx()
    
    Allow sctp_bindx() to accept multiple address with
    unspecified port.  In this case, all addresses inherit
    the first bound port.  We still catch full mis-matches.
    
    Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
    Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]>
---
 net/sctp/socket.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d370c94..a5b6e55 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -333,12 +333,19 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union 
sctp_addr *addr, int len)
        if (!sp->pf->bind_verify(sp, addr))
                return -EADDRNOTAVAIL;
 
-       /* We must either be unbound, or bind to the same port.  */
-       if (bp->port && (snum != bp->port)) {
-               SCTP_DEBUG_PRINTK("sctp_do_bind:"
+       /* We must either be unbound, or bind to the same port.
+        * It's OK to allow 0 ports if we are already bound.
+        * We'll just inhert an already bound port in this case
+        */
+       if (bp->port) {
+               if (!snum)
+                       snum = bp->port;
+               else if (snum != bp->port) {
+                       SCTP_DEBUG_PRINTK("sctp_do_bind:"
                                  " New port %d does not match existing port "
                                  "%d.\n", snum, bp->port);
-               return -EINVAL;
+                       return -EINVAL;
+               }
        }
 
        if (snum && snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to