Hi Simon, 
         
        Thanks a lot
            for your help.
        Sure, when I
            upgraded from no security to DTLS, I added a
            lwm2m_close_connection() on STATE_BOOTSTRAP_REQUIRED (please
            see snippet below).
        Not sure it
            was the right thing to do, but it does trigger a new
            handshake with PSK. 
         
        Otherwise
            the re-registration subsequent to changing to STATE_INITIAL
            would not happen as it was happening with no security, i.e.
            the registration packet is sent but ignored by the server in
            case of DTLS.
         
        Thanks and
            Kind Regards, 
        Riccardo.
         
        ------------------------------------------------------------------------------------------------------------------
        In
            “lwm2mclient.c” :
         
        result = lwm2m_step(lwm2mH,
            &(tv.tv_sec));
        switch (lwm2mH->state)
        {
                           case
            STATE_INITIAL:
               
                                            break;
                           case
            STATE_BOOTSTRAP_REQUIRED:
                           {
                           lwm2m_server_t *
            targetP = lwm2mH->serverList;
                           
                                                     while (targetP !=
            NULL)
                           
                                                     {
                           
                                                                        
            if (targetP->sessionH != NULL)
                           
                                                                        
            {
                           
                                                                                
            lwm2m_close_connection(targetP->sessionH,
            lwm2mH->userData);
                           
                                                                                
            targetP->sessionH = NULL;
                           
                                                                        
            }
                           
                                                                        
            targetP = targetP->next;
                           
                                                     }
                           
                                                     lwm2mH->state =
            STATE_INITIAL;
                           
                                                     break;
                           }
                           case
            STATE_BOOTSTRAPPING:
               
                                            break;
                           case
            STATE_REGISTER_REQUIRED:
               
                                            break;
                           case
            STATE_REGISTERING:
               
                                            break;
                           case
            STATE_READY:
               
                                            break;
                           default:
               
                                            break;
                }
        ------------------------------------------------------------------------------------------------------------------
         
         
        
         
        Hi, I'm curious to know how you re-handshake ? could you
          share this part of your code  to allow us to see if there is a
          problem ?
         
        
          Le 16/01/2017 à 10:46, Riccardo Pozza a
            écrit :
         
        
          Hi all, 
           
          I’ve upgraded recently to DTLS
            communication on my lwm2m client.
           
          Sometimes I need to re-handshake with
            DTLS for re-registration and I rarely get errors, but I do
            get them during the handshake procedure. 
          Examples thereof:
          è Error
            DTLS handling message -552.
          o   The
            message sequence number is too small, expected XXXX, got 0:
          è WARN,
            Wrong epoch, expected X, got 0
          Sometimes I just see the initial
            ClientHello packet sent and no reply whatsoever.
           
          The issue in this case is that the client
            blocks and never gets out unless rebooted, which I’d like to
            avoid.
          What is the behaviour on the failed DTLS
            handshake?
          Is it possible to render this
            non-blocking?
           
          Thanks and Kind Regards, 
          Riccardo. 
          
              
              
              
          _______________________________________________
          wakaama-dev mailing list
          wakaama-dev@xxxxxxxxxxx
          To change your delivery options, retrieve your password, or unsubscribe from this list, visit
          https://dev.eclipse.org/mailman/listinfo/wakaama-dev