* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include "pppd.h"
+#include "pppd-private.h"
+#include "options.h"
#include "fsm.h"
#include "lcp.h"
-#include "chap-new.h"
+#include "eap.h"
+#include "chap.h"
#include "magic.h"
-
+#include "multilink.h"
/*
* When the link comes up we want to be able to wait for a short while,
static int noopt(char **);
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
static int setendpoint(char **);
static void printendpoint(option_t *, void (*)(void *, char *, ...), void *);
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
-static option_t lcp_option_list[] = {
+static struct option lcp_option_list[] = {
/* LCP options */
{ "-all", o_special_noarg, (void *)noopt,
"Don't request/allow any LCP options" },
{ "receive-all", o_bool, &lax_recv,
"Accept all received control characters", 1 },
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
{ "mrru", o_int, &lcp_wantoptions[0].mrru,
"Maximum received packet size for multilink bundle",
OPT_PRIO, &lcp_wantoptions[0].neg_mrru },
{ "endpoint", o_special, (void *) setendpoint,
"Endpoint discriminator for multilink",
OPT_PRIO | OPT_A2PRINTER, (void *) printendpoint },
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
{ "noendpoint", o_bool, &noendpoint,
"Don't send or accept multilink endpoint discriminator", 1 },
return (1);
}
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
static int
setendpoint(char **argv)
{
lcp_wantoptions[0].neg_endpoint = 1;
return 1;
}
- option_error("Can't parse '%s' as an endpoint discriminator", *argv);
+ ppp_option_error("Can't parse '%s' as an endpoint discriminator", *argv);
return 0;
}
{
printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
}
-#endif /* HAVE_MULTILINK */
+#endif /* PPP_WITH_MULTILINK */
/*
* lcp_init - Initialize LCP.
fsm *f = &lcp_fsm[unit];
int oldstate;
- if (phase != PHASE_DEAD && phase != PHASE_MASTER)
+ if (!in_phase(PHASE_DEAD) && !in_phase(PHASE_MASTER))
new_phase(PHASE_TERMINATE);
if (f->flags & DELAYED_UP) {
- untimeout(lcp_delayed_up, f);
+ UNTIMEOUT(lcp_delayed_up, f);
f->state = STOPPED;
}
oldstate = f->state;
if (listen_time != 0) {
f->flags |= DELAYED_UP;
- timeout(lcp_delayed_up, f, 0, listen_time * 1000);
+ ppp_timeout(lcp_delayed_up, f, 0, listen_time * 1000);
} else
fsm_lowerup(f);
}
if (f->flags & DELAYED_UP) {
f->flags &= ~DELAYED_UP;
- untimeout(lcp_delayed_up, f);
+ UNTIMEOUT(lcp_delayed_up, f);
} else
fsm_lowerdown(&lcp_fsm[unit]);
}
if (f->flags & DELAYED_UP) {
f->flags &= ~DELAYED_UP;
- untimeout(lcp_delayed_up, f);
+ UNTIMEOUT(lcp_delayed_up, f);
fsm_lowerup(f);
}
fsm_input(f, p, len);
if (looped_back) {
if (++try.numloops >= lcp_loopbackfail) {
notice("Serial line is looped back.");
- status = EXIT_LOOPBACK;
+ ppp_set_status(EXIT_LOOPBACK);
lcp_close(f->unit, "Loopback detected");
}
} else
*/
mtu = ho->neg_mru? ho->mru: PPP_MRU;
mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU;
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
if (!(multilink && go->neg_mrru && ho->neg_mrru))
-#endif /* HAVE_MULTILINK */
- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
+#endif /* PPP_WITH_MULTILINK */
+ ppp_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
ppp_send_config(f->unit, mtu,
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
ho->neg_pcompression, ho->neg_accompression);
}
break;
case CI_EPDISC:
-#ifdef HAVE_MULTILINK
+#ifdef PPP_WITH_MULTILINK
if (olen >= CILEN_CHAR) {
struct epdisc epd;
p += 2;
if (f->state == OPENED) {
info("No response to %d echo-requests", lcp_echos_pending);
notice("Serial link appears to be disconnected.");
- status = EXIT_PEER_DEAD;
+ ppp_set_status(EXIT_PEER_DEAD);
lcp_close(f->unit, "Peer not responding");
}
}
if (get_ppp_stats(f->unit, &cur_stats) && cur_stats.pkts_in != last_pkts_in) {
last_pkts_in = cur_stats.pkts_in;
+ /* receipt of traffic indicates the link is working... */
+ lcp_echos_pending = 0;
return;
}
}