Skip to content

Commit

Permalink
xl2tpd: Close calls when underlying pppd terminate.
Browse files Browse the repository at this point in the history
Unsure the cause, but we found that upon ppp terminating xl2tpd would
only reap the PID, but not actually close the inner call, then at a
later stage would issue a kill() for that PID.

In our environment with high call turnover this would eventually result
in xl2tpd kill()'ing other critical services like mariadb and/or
syslog-ng which would upon reloads and rotations have a tendency to
re-use PIDs that were previously used by pppd processes.

We also believe that this should sort out the problem where IPs wouldn't
get cycled and re-used.

Closes: xelerance#252
Closes: xelerance#255
Signed-off-by: Jaco Kroon <[email protected]>
  • Loading branch information
jkroonza committed Sep 1, 2023
1 parent a713b98 commit 65a0473
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xl2tpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ static void child_handler (int sig)
{
if (c->pppd == pid)
{
/* pid is no longer valid, avoid killing it later by accident in destroy_call() */
c->pppd = 0;

if ( WIFEXITED( status ) )
{
l2tp_log (LOG_DEBUG, "%s : pppd exited for call %d with code %d\n", __FUNCTION__,
Expand All @@ -283,6 +286,8 @@ static void child_handler (int sig)
#endif
close (c->fd);
#ifdef USE_KERNEL
} else {
call_close (c);
}
#endif
c->fd = -1;
Expand Down

0 comments on commit 65a0473

Please sign in to comment.