handle rejection of MRU negotiation by peer
[l2tpns.git] / l2tpns.c
index 097cff9..55f53dc 100644 (file)
--- a/l2tpns.c
+++ b/l2tpns.c
@@ -4,7 +4,7 @@
 // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
 // vim: sw=8 ts=8
 
-char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.120 2005-08-11 05:49:03 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.124 2005-08-29 06:17:53 bodea Exp $";
 
 #include <arpa/inet.h>
 #include <assert.h>
@@ -1584,6 +1584,7 @@ void sendipcp(sessionidt s, tunnelidt t)
        uint8_t *q;
 
        CSTAT(sendipcp);
+       LOG(3, s, t, "IPCP: send ConfigReq\n");
 
        if (!session[s].unique_id)
        {
@@ -1612,6 +1613,7 @@ void sendipv6cp(sessionidt s, tunnelidt t)
        uint8_t *q;
 
        CSTAT(sendipv6cp);
+       LOG(3, s, t, "IPV6CP: send ConfigReq\n");
 
        q = makeppp(buf,sizeof(buf), 0, 0, s, t, PPPIPV6CP);
        if (!q) return;
@@ -2376,19 +2378,16 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
                                        if (amagic == 0) amagic = time_now;
                                        session[s].magic = amagic; // set magic number
                                        session[s].l2tp_flags = aflags; // set flags received
+                                       session[s].mru = DEFAULT_MRU;
                                        controlnull(t); // ack
 
-                                       // proxy authentication type is not supported
-                                       if (!(config->radius_authtypes & authtype))
-                                               authtype = config->radius_authprefer;
-
                                        // start LCP
-                                       sendlcp(s, t, config->radius_authprefer);
                                        sess_local[s].lcp.restart = time_now + config->ppp_restart_time;
                                        sess_local[s].lcp.conf_sent = 1;
                                        sess_local[s].lcp.nak_sent = 0;
                                        sess_local[s].lcp_authtype = config->radius_authprefer;
                                        session[s].ppp.lcp = RequestSent;
+                                       sendlcp(s, t);
 
                                        break;
                                case 14:      // CDN
@@ -2719,7 +2718,7 @@ static void regular_cleanups(double period)
                                        LOG(3, s, session[s].tunnel, "No ACK for LCP ConfigReq... resending\n");
                                        sess_local[s].lcp.restart = time_now + config->ppp_restart_time;
                                        sess_local[s].lcp.conf_sent++;
-                                       sendlcp(s, t, sess_local[s].lcp_authtype);
+                                       sendlcp(s, session[s].tunnel);
                                        change_state(s, lcp, next_state);
                                }
                                else
@@ -2750,7 +2749,7 @@ static void regular_cleanups(double period)
                                        LOG(3, s, session[s].tunnel, "No ACK for IPCP ConfigReq... resending\n");
                                        sess_local[s].ipcp.restart = time_now + config->ppp_restart_time;
                                        sess_local[s].ipcp.conf_sent++;
-                                       sendipcp(s, t);
+                                       sendipcp(s, session[s].tunnel);
                                        change_state(s, ipcp, next_state);
                                }
                                else
@@ -2781,7 +2780,7 @@ static void regular_cleanups(double period)
                                        LOG(3, s, session[s].tunnel, "No ACK for IPV6CP ConfigReq... resending\n");
                                        sess_local[s].ipv6cp.restart = time_now + config->ppp_restart_time;
                                        sess_local[s].ipv6cp.conf_sent++;
-                                       sendipv6cp(s, t);
+                                       sendipv6cp(s, session[s].tunnel);
                                        change_state(s, ipv6cp, next_state);
                                }
                                else
@@ -2809,7 +2808,7 @@ static void regular_cleanups(double period)
                                        LOG(3, s, session[s].tunnel, "No ACK for CCP ConfigReq... resending\n");
                                        sess_local[s].ccp.restart = time_now + config->ppp_restart_time;
                                        sess_local[s].ccp.conf_sent++;
-                                       sendccp(s, t);
+                                       sendccp(s, session[s].tunnel);
                                        change_state(s, ccp, next_state);
                                }
                                else