These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / net / sctp / sm_make_chunk.c
index 06320c8..5d6a03f 100644 (file)
@@ -1652,7 +1652,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
 
        /* Set an expiration time for the cookie.  */
        cookie->c.expiration = ktime_add(asoc->cookie_life,
-                                        ktime_get());
+                                        ktime_get_real());
 
        /* Copy the peer's init packet.  */
        memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr,
@@ -1780,7 +1780,7 @@ no_hmac:
        if (sock_flag(ep->base.sk, SOCK_TIMESTAMP))
                kt = skb_get_ktime(skb);
        else
-               kt = ktime_get();
+               kt = ktime_get_real();
 
        if (!asoc && ktime_before(bear_cookie->expiration, kt)) {
                /*
@@ -2494,7 +2494,7 @@ static int sctp_process_param(struct sctp_association *asoc,
        __u16 sat;
        int retval = 1;
        sctp_scope_t scope;
-       time_t stale;
+       u32 stale;
        struct sctp_af *af;
        union sctp_addr_param *addr_param;
        struct sctp_transport *t;
@@ -3090,8 +3090,19 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
                        sctp_assoc_set_primary(asoc, asconf->transport);
                        sctp_assoc_del_nonprimary_peers(asoc,
                                                        asconf->transport);
-               } else
-                       sctp_assoc_del_peer(asoc, &addr);
+                       return SCTP_ERROR_NO_ERROR;
+               }
+
+               /* If the address is not part of the association, the
+                * ASCONF-ACK with Error Cause Indication Parameter
+                * which including cause of Unresolvable Address should
+                * be sent.
+                */
+               peer = sctp_assoc_lookup_paddr(asoc, &addr);
+               if (!peer)
+                       return SCTP_ERROR_DNS_FAILED;
+
+               sctp_assoc_rm_peer(asoc, peer);
                break;
        case SCTP_PARAM_SET_PRIMARY:
                /* ADDIP Section 4.2.4
@@ -3132,11 +3143,18 @@ bool sctp_verify_asconf(const struct sctp_association *asoc,
                case SCTP_PARAM_IPV4_ADDRESS:
                        if (length != sizeof(sctp_ipv4addr_param_t))
                                return false;
+                       /* ensure there is only one addr param and it's in the
+                        * beginning of addip_hdr params, or we reject it.
+                        */
+                       if (param.v != addip->addip_hdr.params)
+                               return false;
                        addr_param_seen = true;
                        break;
                case SCTP_PARAM_IPV6_ADDRESS:
                        if (length != sizeof(sctp_ipv6addr_param_t))
                                return false;
+                       if (param.v != addip->addip_hdr.params)
+                               return false;
                        addr_param_seen = true;
                        break;
                case SCTP_PARAM_ADD_IP: