chap: cope with our ack being lost

This commit is contained in:
Samuel Thibault 2025-03-30 15:21:21 +02:00
parent 22f650d828
commit fa64a8010d

13
ppp.c
View file

@ -207,6 +207,19 @@ void processchap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
if (session[s].ppp.phase != Authenticate)
{
if (session[s].ppp.phase == Network)
{
uint8_t b[MAXETHER];
uint8_t *p2;
LOG(2, s, t, "CHAP in Network phase, peer probably missed our ack, confirming it\n");
p2 = makeppp(b, sizeof(b), 0, 0, s, t, PPPCHAP, 0, 0, 0);
if (!p2) return;
*p2 = 3; // ack
p2[1] = p[1];
*(uint16_t *) (p2 + 2) = ntohs(4); // no message
tunnelsend(b, (p2 - b) + 4, t); // send it
}
else
LOG(2, s, t, "CHAP ignored in %s phase\n", ppp_phase(session[s].ppp.phase));
return;
}