<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Ciao Matteo,<br>
    <br>
    <blockquote type="cite"
      cite="mid:2055108959.279639.1663858376731.JavaMail.zimbra@ehiweb.it">
      <div>
        <div style="font-family: arial, helvetica, sans-serif;
          font-size: 10pt; color: #000000">
          <div data-marker="__QUOTED_TEXT__">
            <div>
              <div>Sì sono sicuro. Per ordine inverso intendo che arriva
                prima lo start della nuova connessione e poi lo stop
                della vecchia. L'ho osservato, fatto debug lato radius e
                dump traffico di rete. Si tratta di millisecondi ma si
                genera questo effetto:</div>
              <div>
                <pre style="white-space: pre-wrap; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="white-space: pre-wrap; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">1) Access_Request -> allocate_find (find the same ip to the same user) + allocate_update (assign same ip, renew lease) 
2) Accounting-Request Stop -> allocate_free (clear ip) 
</pre>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    a me non torna il perché alla access-req ridia lo stesso indirizzo,
    non è in uso dalla sessione precedente?<br>
    L'unica ipotesi è che lo stop sia un duplicato di un primo, che è
    arrivato ed è stato processato in ordine, prima della Access-Req,
    altrimenti l'ip sarebbe in uso. Magari si perde l'ack tra il radius
    ed il nas. Poco male è una cosa che può succedere e deve essere
    prevista.<br>
    <br>
    Per ovviare devi fare come dice Brian: aggiungere l'Acct-Session-Id
    all'equazione, assicurandoti che sia univoco e che sia inviato anche
    nell'Access-Request.<br>
    <br>
    All'arrivo di uno Stop controlli che l'IP nel pool sia associato
    proprio allo stesso Session-Id, se è diverso non va liberato.<br>
    <br>
    Non conosco bene l'implementazione del freeradius, l'ho vista al
    volo, dovrebbe bastare aggiungere l'Acct-Session-Id nella pool_key
    per la v3, oppure sia il Nas-IP-Address che il Session-ID nell'owner
    per la v4.<br>
    <br>
    In alternativa si può aggiustare sul NAS la NAS-Port, io ad esempio
    su IOS-XE uso:<br>
    <span style="font-family:monospace"><span
        style="color:#000000;background-color:#ffffff;"><br>
        radius-server attribute nas-port format e
        SSSSAPVVVVVVVVVVUUUUUUUUUUUUUUUU</span></span><br>
    <br>
    ossia codifico anche il session-id nei bit meno significativi
    (UU...UU), già questo basterebbe con la pool_key di default. Ma
    funzionerebbe solo con la v3, per la v4 va aggiunto anche il
    Nas-IP-Address/Identifier, perché non viene controllato nella
    update_free.<br>
    <br>
    <br>
    Nell'altro thread qualcuno cita anche l'uso dell'orario di invio del
    pacchetto (che è ricavabile dall'ora di ricezione meno
    l'Acct-Delay-Time) ma lo vedo più macchinoso e soprattutto meno
    formale: il session-id, se implementato correttamente dal NAS, è 
    l'unica vera chiave per collegare correttamente Auth, Start, Interim
    e Stop ad una sessione.<br>
    <br>
    RFC2866<br>
    <blockquote type="cite">
      <pre class="newpage" style="font-size: 13.3333px; margin-top: 0px; margin-bottom: 0px; break-before: page; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span class="h3" style="display: inline; white-space: pre; font-family: monospace; font-size: 1em; font-weight: bold;"><a class="selflink" id="section-5.5" href="https://www.rfc-editor.org/rfc/rfc2866.html#section-5.5" style="color: black; text-decoration: none;">5.5</a>.  Acct-Session-Id</span>

   Description

      This attribute is a unique Accounting ID to make it easy to match
      start and stop records in a log file.  The start and stop records
      for a given session MUST have the same Acct-Session-Id.  An
      Accounting-Request packet MUST have an Acct-Session-Id.  An
      <b>Access-Request packet MAY</b> have an Acct-Session-Id; if it does,
      then the NAS MUST use the same Acct-Session-Id in the Accounting-
      Request packets for that session.
</pre>
    </blockquote>
    <br>
    <br>
    Sergioc.<br>
    <br>
  </body>
</html>