• Xin Long's avatar
    sctp: do not check port in sctp_inet6_cmp_addr · 1071ec9d
    Xin Long authored
    pf->cmp_addr() is called before binding a v6 address to the sock. It
    should not check ports, like in sctp_inet_cmp_addr.
    
    But sctp_inet6_cmp_addr checks the addr by invoking af(6)->cmp_addr,
    sctp_v6_cmp_addr where it also compares the ports.
    
    This would cause that setsockopt(SCTP_SOCKOPT_BINDX_ADD) could bind
    multiple duplicated IPv6 addresses after Commit 40b4f0fd ("sctp:
    lack the check for ports in sctp_v6_cmp_addr").
    
    This patch is to remove af->cmp_addr called in sctp_inet6_cmp_addr,
    but do the proper check for both v6 addrs and v4mapped addrs.
    
    v1->v2:
      - define __sctp_v6_cmp_addr to do the common address comparison
        used for both pf and af v6 cmp_addr.
    
    Fixes: 40b4f0fd ("sctp: lack the check for ports in sctp_v6_cmp_addr")
    Reported-by: default avatarJianwen Ji <jiji@redhat.com>
    Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
    Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1071ec9d
ipv6.c 30.1 KB