Fix: No RADIUS Stop message sent (regression due to the patch to avoid sending multip...
[l2tpns.git] / l2tpns.c
index 71d5857..a1819f2 100644 (file)
--- a/l2tpns.c
+++ b/l2tpns.c
@@ -187,7 +187,7 @@ config_descriptt config_values[] = {
        CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4),
        CONFIG("bind_portremotelns", bind_portremotelns, SHORT),
 #endif
-       CONFIG("pppoe_if_name", pppoe_if_name, STRING),
+       CONFIG("pppoe_if_to_bind", pppoe_if_to_bind, STRING),
        CONFIG("pppoe_service_name", pppoe_service_name, STRING),
        CONFIG("pppoe_ac_name", pppoe_ac_name, STRING),
        { NULL, 0, 0, 0 },
@@ -2026,7 +2026,6 @@ void sessionshutdown(sessionidt s, char const *reason, int cdn_result, int cdn_e
                struct param_kill_session data = { &tunnel[session[s].tunnel], &session[s] };
                LOG(2, s, session[s].tunnel, "Shutting down session %u: %s\n", s, reason);
                run_plugins(PLUGIN_KILL_SESSION, &data);
-               session[s].die = TIME + 150; // Clean up in 15 seconds
        }
 
        if (session[s].ip && !walled_garden && !session[s].die)
@@ -2051,6 +2050,9 @@ void sessionshutdown(sessionidt s, char const *reason, int cdn_result, int cdn_e
                        memcpy(&shut_acct[shut_acct_n++], &session[s], sizeof(session[s]));
        }
 
+       if (!session[s].die)
+               session[s].die = TIME + 150; // Clean up in 15 seconds
+
        if (session[s].ip)
        {                          // IP allocated, clear and unroute
                int r;
@@ -5121,10 +5123,10 @@ int main(int argc, char *argv[])
        inittun();
        LOG(1, 0, 0, "Set up on interface %s\n", config->tundevicename);
 
-       if (*config->pppoe_if_name)
+       if (*config->pppoe_if_to_bind)
        {
                init_pppoe();
-               LOG(1, 0, 0, "Set up on pppoe interface %s\n", config->pppoe_if_name);
+               LOG(1, 0, 0, "Set up on pppoe interface %s\n", config->pppoe_if_to_bind);
        }
        initudp();
        initrad();
@@ -5548,8 +5550,7 @@ int sessionsetup(sessionidt s, tunnelidt t)
 
                        if (ip == session[i].ip)
                        {
-                               sessionkill(i, "Duplicate IP address");
-                               cluster_listinvert_session(s, i);
+                               sessionshutdown(i, "Duplicate IP address", CDN_ADMIN_DISC, TERM_ADMIN_RESET);  // close radius/routes, etc.
                                continue;
                        }
 
@@ -5570,7 +5571,7 @@ int sessionsetup(sessionidt s, tunnelidt t)
 
                        // Drop the new session in case of duplicate sessionss, not the old one.
                        if (!strcasecmp(user, session[i].user))
-                               sessionkill(i, "Duplicate session for users");
+                               sessionshutdown(i, "Duplicate session for users", CDN_ADMIN_DISC, TERM_ADMIN_RESET);  // close radius/routes, etc.
                }
        }