Permanently store authentication id in sess_local[s].auth_id

rather than ping-ponging with radius[r].id

This also make sendchap use a different id on each call, necessary for
some clients which cache responses.
This commit is contained in:
Samuel Thibault 2025-03-29 16:09:52 +01:00
parent c4147ed3cc
commit 2af4b47f46
2 changed files with 2 additions and 3 deletions

4
ppp.c
View file

@ -161,7 +161,7 @@ void processpap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
free(packet.username); free(packet.username);
free(packet.password); free(packet.password);
radius[r].id = p[1]; radius[r].id = sess_local[s].auth_id = p[1]; // Take ID from client
LOG(3, s, t, "Sending login for %s/%s to RADIUS\n", user, pass); LOG(3, s, t, "Sending login for %s/%s to RADIUS\n", user, pass);
if ((session[s].mrru) && (!first_session_in_bundle(s))) if ((session[s].mrru) && (!first_session_in_bundle(s)))
radiussend(r, RADIUSJUSTAUTH); radiussend(r, RADIUSJUSTAUTH);
@ -2549,7 +2549,7 @@ void sendchap(sessionidt s, tunnelidt t)
LOG(1, s, t, "Send CHAP challenge\n"); LOG(1, s, t, "Send CHAP challenge\n");
radius[r].chap = 1; // CHAP not PAP radius[r].chap = 1; // CHAP not PAP
radius[r].id++; radius[r].id = ++sess_local[s].auth_id; // New ID
if (radius[r].state != RADIUSCHAP) if (radius[r].state != RADIUSCHAP)
radius[r].try = 0; radius[r].try = 0;

View file

@ -1054,7 +1054,6 @@ void processrad(uint8_t *buf, int len, char socket_index)
{ {
sess_local[s].auth_type = 3; // PAP sess_local[s].auth_type = 3; // PAP
} }
sess_local[s].auth_id = radius[r].id;
if (lac_rad_forwardtoremotelns(s, assignment_id, session[s].user)) if (lac_rad_forwardtoremotelns(s, assignment_id, session[s].user))
{ {