mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-24 23:25:58 +00:00
started the unit to ppp_pcb replacement
This commit is contained in:
parent
8694deaabb
commit
6e2722a6d3
@ -569,10 +569,11 @@ link_required(unit)
|
||||
void start_link(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
char *msg;
|
||||
|
||||
status = EXIT_NEGOTIATION_FAILED;
|
||||
new_phase(unit, PHASE_SERIALCONN);
|
||||
new_phase(pcb, PHASE_SERIALCONN);
|
||||
|
||||
hungup = 0;
|
||||
devfd = the_channel->connect();
|
||||
@ -608,18 +609,18 @@ void start_link(unit)
|
||||
notice("Starting negotiation on %s", ppp_devnam);
|
||||
add_fd(fd_ppp);
|
||||
|
||||
new_phase(unit, PHASE_ESTABLISH);
|
||||
new_phase(pcb, PHASE_ESTABLISH);
|
||||
|
||||
lcp_lowerup(0);
|
||||
return;
|
||||
|
||||
disconnect:
|
||||
new_phase(unit, PHASE_DISCONNECT);
|
||||
new_phase(pcb, PHASE_DISCONNECT);
|
||||
if (the_channel->disconnect)
|
||||
the_channel->disconnect();
|
||||
|
||||
fail:
|
||||
new_phase(unit, PHASE_DEAD);
|
||||
new_phase(pcb, PHASE_DEAD);
|
||||
if (the_channel->cleanup)
|
||||
(*the_channel->cleanup)();
|
||||
}
|
||||
@ -633,10 +634,10 @@ void
|
||||
link_terminated(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
if (pc->phase == PHASE_DEAD || pc->phase == PHASE_MASTER)
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
if (pcb->phase == PHASE_DEAD || pcb->phase == PHASE_MASTER)
|
||||
return;
|
||||
new_phase(unit, PHASE_DISCONNECT);
|
||||
new_phase(pcb, PHASE_DISCONNECT);
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
if (pap_logout_hook) {
|
||||
@ -656,7 +657,7 @@ link_terminated(unit)
|
||||
lcp_lowerdown(0);
|
||||
|
||||
new_phase(unit, PHASE_DEAD);
|
||||
ppp_link_terminated(unit);
|
||||
ppp_link_terminated(pcb);
|
||||
#if 0
|
||||
/*
|
||||
* Delete pid files before disestablishing ppp. Otherwise it
|
||||
@ -697,11 +698,11 @@ link_terminated(unit)
|
||||
|
||||
if (doing_multilink && multilink_master) {
|
||||
if (!bundle_terminating)
|
||||
new_phase(unit, PHASE_MASTER);
|
||||
new_phase(pcb, PHASE_MASTER);
|
||||
else
|
||||
mp_bundle_terminated();
|
||||
} else
|
||||
new_phase(unit, PHASE_DEAD);
|
||||
new_phase(pcb, PHASE_DEAD);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -712,20 +713,20 @@ void
|
||||
link_down(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
#if PPP_NOTIFY
|
||||
notify(link_down_notifier, 0);
|
||||
#endif /* #if PPP_NOTIFY */
|
||||
|
||||
if (!doing_multilink) {
|
||||
upper_layers_down(unit);
|
||||
if (pc->phase != PHASE_DEAD && pc->phase != PHASE_MASTER)
|
||||
new_phase(unit, PHASE_ESTABLISH);
|
||||
if (pcb->phase != PHASE_DEAD && pcb->phase != PHASE_MASTER)
|
||||
new_phase(pcb, PHASE_ESTABLISH);
|
||||
}
|
||||
/* XXX if doing_multilink, should do something to stop
|
||||
network-layer traffic on the link */
|
||||
|
||||
ppp_link_down(unit);
|
||||
ppp_link_down(pcb);
|
||||
}
|
||||
|
||||
void upper_layers_down(int unit)
|
||||
@ -753,6 +754,7 @@ void
|
||||
link_established(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
int auth;
|
||||
#if 0 /* UNUSED */
|
||||
lcp_options *wo = &lcp_wantoptions[unit];
|
||||
@ -763,7 +765,6 @@ link_established(unit)
|
||||
lcp_options *ho = &lcp_hisoptions[unit];
|
||||
int i;
|
||||
struct protent *protp;
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
|
||||
/*
|
||||
* Tell higher-level protocols that LCP is up.
|
||||
@ -814,18 +815,18 @@ link_established(unit)
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
new_phase(unit, PHASE_AUTHENTICATE);
|
||||
new_phase(pcb, PHASE_AUTHENTICATE);
|
||||
auth = 0;
|
||||
#if PPP_SERVER
|
||||
#if EAP_SUPPORT
|
||||
if (go->neg_eap) {
|
||||
eap_authpeer(unit, pc->settings.our_name);
|
||||
eap_authpeer(unit, pcb->settings.our_name);
|
||||
auth |= EAP_PEER;
|
||||
} else
|
||||
#endif /* EAP_SUPPORT */
|
||||
#if CHAP_SUPPORT
|
||||
if (go->neg_chap) {
|
||||
chap_auth_peer(unit, pc->settings.our_name, CHAP_DIGEST(go->chap_mdtype));
|
||||
chap_auth_peer(unit, pcb->settings.our_name, CHAP_DIGEST(go->chap_mdtype));
|
||||
auth |= CHAP_PEER;
|
||||
} else
|
||||
#endif /* CHAP_SUPPORT */
|
||||
@ -840,19 +841,19 @@ link_established(unit)
|
||||
|
||||
#if EAP_SUPPORT
|
||||
if (ho->neg_eap) {
|
||||
eap_authwithpeer(unit, pc->settings.user);
|
||||
eap_authwithpeer(unit, pcb->settings.user);
|
||||
auth |= EAP_WITHPEER;
|
||||
} else
|
||||
#endif /* EAP_SUPPORT */
|
||||
#if CHAP_SUPPORT
|
||||
if (ho->neg_chap) {
|
||||
chap_auth_with_peer(unit, pc->settings.user, CHAP_DIGEST(ho->chap_mdtype));
|
||||
chap_auth_with_peer(unit, pcb->settings.user, CHAP_DIGEST(ho->chap_mdtype));
|
||||
auth |= CHAP_WITHPEER;
|
||||
} else
|
||||
#endif /* CHAP_SUPPORT */
|
||||
#if PAP_SUPPORT
|
||||
if (ho->neg_upap) {
|
||||
upap_authwithpeer(unit, pc->settings.user, pc->settings.passwd);
|
||||
upap_authwithpeer(unit, pcb->settings.user, pcb->settings.passwd);
|
||||
auth |= PAP_WITHPEER;
|
||||
} else
|
||||
#endif /* PAP_SUPPORT */
|
||||
@ -872,6 +873,7 @@ static void
|
||||
network_phase(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
#if 0 /* UNUSED */
|
||||
lcp_options *go = &lcp_gotoptions[unit];
|
||||
#endif /* UNUSED */
|
||||
@ -906,7 +908,7 @@ network_phase(unit)
|
||||
* If we negotiated callback, do it now.
|
||||
*/
|
||||
if (go->neg_cbcp) {
|
||||
new_phase(unit, PHASE_CALLBACK);
|
||||
new_phase(pcb, PHASE_CALLBACK);
|
||||
(*cbcp_protent.open)(unit);
|
||||
return;
|
||||
}
|
||||
@ -929,6 +931,7 @@ void
|
||||
start_networks(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
#if CCP_SUPPORT || ECP_SUPPORT
|
||||
int i;
|
||||
struct protent *protp;
|
||||
@ -940,7 +943,7 @@ start_networks(unit)
|
||||
int mppe_required;
|
||||
#endif /* MPPE */
|
||||
|
||||
new_phase(unit, PHASE_NETWORK);
|
||||
new_phase(pcb, PHASE_NETWORK);
|
||||
|
||||
#ifdef HAVE_MULTILINK
|
||||
if (multilink) {
|
||||
@ -1203,21 +1206,21 @@ np_up(unit, proto)
|
||||
int unit, proto;
|
||||
{
|
||||
int tlim;
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
|
||||
if (num_np_up == 0) {
|
||||
/*
|
||||
* At this point we consider that the link has come up successfully.
|
||||
*/
|
||||
pc->status = EXIT_OK;
|
||||
new_phase(unit, PHASE_RUNNING);
|
||||
pcb->status = EXIT_OK;
|
||||
new_phase(pcb, PHASE_RUNNING);
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
if (idle_time_hook != 0)
|
||||
tlim = (*idle_time_hook)(NULL);
|
||||
else
|
||||
#endif /* UNUSED */
|
||||
tlim = pc->settings.idle_time_limit;
|
||||
tlim = pcb->settings.idle_time_limit;
|
||||
if (tlim > 0)
|
||||
TIMEOUT(check_idle, NULL, tlim);
|
||||
|
||||
@ -1225,8 +1228,8 @@ np_up(unit, proto)
|
||||
* Set a timeout to close the connection once the maximum
|
||||
* connect time has expired.
|
||||
*/
|
||||
if (pc->settings.maxconnect > 0)
|
||||
TIMEOUT(connect_time_expired, 0, pc->settings.maxconnect);
|
||||
if (pcb->settings.maxconnect > 0)
|
||||
TIMEOUT(connect_time_expired, 0, pcb->settings.maxconnect);
|
||||
|
||||
#ifdef MAXOCTETS
|
||||
if (maxoctets > 0)
|
||||
@ -1251,13 +1254,14 @@ void
|
||||
np_down(unit, proto)
|
||||
int unit, proto;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
if (--num_np_up == 0) {
|
||||
UNTIMEOUT(check_idle, NULL);
|
||||
UNTIMEOUT(connect_time_expired, NULL);
|
||||
#ifdef MAXOCTETS
|
||||
UNTIMEOUT(check_maxoctets, NULL);
|
||||
#endif
|
||||
new_phase(unit, PHASE_NETWORK);
|
||||
new_phase(pcb, PHASE_NETWORK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1323,12 +1327,12 @@ check_idle(arg)
|
||||
void *arg;
|
||||
{
|
||||
/* FIXME: fix forced unit 0 */
|
||||
ppp_pcb *pc = &ppp_pcb_list[0];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[0];
|
||||
struct ppp_idle idle;
|
||||
time_t itime;
|
||||
int tlim;
|
||||
|
||||
if (!get_idle_time(0, &idle))
|
||||
if (!get_idle_time(pcb, &idle))
|
||||
return;
|
||||
#if 0 /* UNUSED */
|
||||
if (idle_time_hook != 0) {
|
||||
@ -1336,14 +1340,14 @@ check_idle(arg)
|
||||
} else {
|
||||
#endif /* UNUSED */
|
||||
itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
|
||||
tlim = pc->settings.idle_time_limit - itime;
|
||||
tlim = pcb->settings.idle_time_limit - itime;
|
||||
#if 0 /* UNUSED */
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
if (tlim <= 0) {
|
||||
/* link is idle: shut it down. */
|
||||
notice("Terminating connection due to lack of activity.");
|
||||
pc->status = EXIT_IDLE_TIMEOUT;
|
||||
pcb->status = EXIT_IDLE_TIMEOUT;
|
||||
lcp_close(0, "Link inactive");
|
||||
#if 0 /* UNUSED */
|
||||
need_holdoff = 0;
|
||||
@ -1361,9 +1365,9 @@ connect_time_expired(arg)
|
||||
void *arg;
|
||||
{
|
||||
/* FIXME: fix forced unit 0 */
|
||||
ppp_pcb *pc = &ppp_pcb_list[0];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[0];
|
||||
info("Connect time expired");
|
||||
pc->status = EXIT_CONNECT_TIME;
|
||||
pcb->status = EXIT_CONNECT_TIME;
|
||||
lcp_close(0, "Connect time expired"); /* Close connection */
|
||||
}
|
||||
|
||||
@ -1517,26 +1521,26 @@ auth_reset(unit)
|
||||
{
|
||||
lcp_options *go = &lcp_gotoptions[unit];
|
||||
lcp_options *ao = &lcp_allowoptions[unit];
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
|
||||
if( pc->settings.passwd[0] ) {
|
||||
if( pcb->settings.passwd[0] ) {
|
||||
|
||||
#if PAP_SUPPORT
|
||||
ao->neg_upap = !pc->settings.refuse_pap;
|
||||
ao->neg_upap = !pcb->settings.refuse_pap;
|
||||
#endif /* PAP_SUPPORT */
|
||||
|
||||
#if EAP_SUPPORT
|
||||
ao->neg_eap = !pc->settings.refuse_eap;
|
||||
ao->neg_eap = !pcb->settings.refuse_eap;
|
||||
#endif /* EAP_SUPPORT */
|
||||
|
||||
#if CHAP_SUPPORT
|
||||
ao->chap_mdtype = MDTYPE_NONE;
|
||||
if(!pc->settings.refuse_chap)
|
||||
if(!pcb->settings.refuse_chap)
|
||||
ao->chap_mdtype |= MDTYPE_MD5;
|
||||
#if MSCHAP_SUPPORT
|
||||
if(!pc->settings.refuse_mschap)
|
||||
if(!pcb->settings.refuse_mschap)
|
||||
ao->chap_mdtype |= MDTYPE_MICROSOFT;
|
||||
if(!pc->settings.refuse_mschap_v2)
|
||||
if(!pcb->settings.refuse_mschap_v2)
|
||||
ao->chap_mdtype |= MDTYPE_MICROSOFT_V2;
|
||||
#endif /* MSCHAP_SUPPORT */
|
||||
|
||||
@ -1990,23 +1994,23 @@ get_secret(unit, client, server, secret, secret_len, am_server)
|
||||
int am_server;
|
||||
{
|
||||
int len;
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
|
||||
LWIP_UNUSED_ARG(unit);
|
||||
LWIP_UNUSED_ARG(server);
|
||||
LWIP_UNUSED_ARG(am_server);
|
||||
|
||||
if(!client || !client[0] || strcmp(client, pc->settings.user)) {
|
||||
if(!client || !client[0] || strcmp(client, pcb->settings.user)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = (int)strlen(pc->settings.passwd);
|
||||
len = (int)strlen(pcb->settings.passwd);
|
||||
if (len > MAXSECRETLEN) {
|
||||
error("Secret for %s on %s is too long", client, server);
|
||||
len = MAXSECRETLEN;
|
||||
}
|
||||
|
||||
MEMCPY(secret, pc->settings.passwd, len);
|
||||
MEMCPY(secret, pcb->settings.passwd, len);
|
||||
*secret_len = len;
|
||||
|
||||
return 1;
|
||||
|
@ -1084,6 +1084,7 @@ ccp_reqci(f, p, lenp, dont_nak)
|
||||
int *lenp;
|
||||
int dont_nak;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
int ret, newret, res;
|
||||
u_char *p0, *retp;
|
||||
int len, clen, type, nb;
|
||||
@ -1200,9 +1201,9 @@ ccp_reqci(f, p, lenp, dont_nak)
|
||||
* because MPPE frames **grow**. The kernel [must]
|
||||
* allocate MPPE_PAD extra bytes in xmit buffers.
|
||||
*/
|
||||
mtu = netif_get_mtu(f->unit);
|
||||
mtu = netif_get_mtu(pcb);
|
||||
if (mtu)
|
||||
netif_set_mtu(f->unit, mtu - MPPE_PAD);
|
||||
netif_set_mtu(pcb, mtu - MPPE_PAD);
|
||||
else
|
||||
newret = CONFREJ;
|
||||
}
|
||||
|
@ -282,6 +282,8 @@ chap_auth_with_peer(int unit, char *our_name, int digest_code)
|
||||
static void
|
||||
chap_timeout(void *arg)
|
||||
{
|
||||
/* FIXME: fix forced unit 0 */
|
||||
ppp_pcb *pcb = &ppp_pcb_list[0];
|
||||
struct chap_server_state *ss = arg;
|
||||
|
||||
ss->flags &= ~TIMEOUT_PENDING;
|
||||
@ -296,7 +298,7 @@ chap_timeout(void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
ppp_write(0, ss->challenge, ss->challenge_pktlen);
|
||||
ppp_write(pcb, ss->challenge, ss->challenge_pktlen);
|
||||
++ss->challenge_xmits;
|
||||
ss->flags |= TIMEOUT_PENDING;
|
||||
TIMEOUT(chap_timeout, arg, chap_timeout_time);
|
||||
@ -337,6 +339,8 @@ static void
|
||||
chap_handle_response(struct chap_server_state *ss, int id,
|
||||
unsigned char *pkt, int len)
|
||||
{
|
||||
/* FIXME: fix forced unit 0 */
|
||||
ppp_pcb *pcb = &ppp_pcb_list[0];
|
||||
int response_len, ok, mlen;
|
||||
unsigned char *response, *p;
|
||||
char *name = NULL; /* initialized to shut gcc up */
|
||||
@ -397,7 +401,7 @@ chap_handle_response(struct chap_server_state *ss, int id,
|
||||
p[3] = len;
|
||||
if (mlen > 0)
|
||||
memcpy(p + CHAP_HDRLEN, ss->message, mlen);
|
||||
ppp_write(0, outpacket_buf, PPP_HDRLEN + len);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + len);
|
||||
|
||||
if (ss->flags & CHALLENGE_VALID) {
|
||||
ss->flags &= ~CHALLENGE_VALID;
|
||||
@ -474,6 +478,8 @@ static void
|
||||
chap_respond(struct chap_client_state *cs, int id,
|
||||
unsigned char *pkt, int len)
|
||||
{
|
||||
/* FIXME: fix forced unit 0 */
|
||||
ppp_pcb *pcb = &ppp_pcb_list[0];
|
||||
int clen, nlen;
|
||||
int secret_len;
|
||||
unsigned char *p;
|
||||
@ -521,7 +527,7 @@ chap_respond(struct chap_client_state *cs, int id,
|
||||
p[2] = len >> 8;
|
||||
p[3] = len;
|
||||
|
||||
ppp_write(0, response, PPP_HDRLEN + len);
|
||||
ppp_write(pcb, response, PPP_HDRLEN + len);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -268,6 +268,7 @@ static void
|
||||
eap_send_failure(esp)
|
||||
eap_state *esp;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
|
||||
outp = outpacket_buf;
|
||||
@ -279,7 +280,7 @@ eap_state *esp;
|
||||
PUTCHAR(esp->es_server.ea_id, outp);
|
||||
PUTSHORT(EAP_HEADERLEN, outp);
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, EAP_HEADERLEN + PPP_HDRLEN);
|
||||
ppp_write(pcb, outpacket_buf, EAP_HEADERLEN + PPP_HDRLEN);
|
||||
|
||||
esp->es_server.ea_state = eapBadAuth;
|
||||
auth_peer_fail(esp->es_unit, PPP_EAP);
|
||||
@ -293,6 +294,7 @@ static void
|
||||
eap_send_success(esp)
|
||||
eap_state *esp;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
|
||||
outp = outpacket_buf;
|
||||
@ -304,7 +306,7 @@ eap_state *esp;
|
||||
PUTCHAR(esp->es_server.ea_id, outp);
|
||||
PUTSHORT(EAP_HEADERLEN, outp);
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + EAP_HEADERLEN);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + EAP_HEADERLEN);
|
||||
|
||||
auth_peer_success(esp->es_unit, PPP_EAP, 0,
|
||||
esp->es_server.ea_peer, esp->es_server.ea_peerlen);
|
||||
@ -648,6 +650,7 @@ static void
|
||||
eap_send_request(esp)
|
||||
eap_state *esp;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
u_char *lenloc;
|
||||
u_char *ptr;
|
||||
@ -867,7 +870,7 @@ eap_state *esp;
|
||||
outlen = (outp - outpacket_buf) - PPP_HDRLEN;
|
||||
PUTSHORT(outlen, lenloc);
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
ppp_write(pcb, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
|
||||
esp->es_server.ea_requests++;
|
||||
|
||||
@ -1066,6 +1069,7 @@ u_char typenum;
|
||||
u_char *str;
|
||||
int lenstr;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
|
||||
@ -1083,7 +1087,7 @@ int lenstr;
|
||||
MEMCPY(outp, str, lenstr);
|
||||
}
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1097,6 +1101,7 @@ u_char *hash;
|
||||
char *name;
|
||||
int namelen;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
|
||||
@ -1118,7 +1123,7 @@ int namelen;
|
||||
MEMCPY(outp, name, namelen);
|
||||
}
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
}
|
||||
|
||||
#ifdef USE_SRP
|
||||
@ -1133,6 +1138,7 @@ u_char subtypenum;
|
||||
u_char *str;
|
||||
int lenstr;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
|
||||
@ -1151,7 +1157,7 @@ int lenstr;
|
||||
MEMCPY(outp, str, lenstr);
|
||||
}
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1164,6 +1170,7 @@ u_char id;
|
||||
u_int32_t flags;
|
||||
u_char *str;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
|
||||
@ -1182,7 +1189,7 @@ u_char *str;
|
||||
PUTLONG(flags, outp);
|
||||
MEMCPY(outp, str, SHA_DIGESTSIZE);
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
}
|
||||
#endif /* USE_SRP */
|
||||
|
||||
@ -1192,6 +1199,7 @@ eap_state *esp;
|
||||
u_char id;
|
||||
u_char type;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[esp->es_unit];
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
|
||||
@ -1207,7 +1215,7 @@ u_char type;
|
||||
PUTCHAR(EAPT_NAK, outp);
|
||||
PUTCHAR(type, outp);
|
||||
|
||||
ppp_write(esp->es_unit, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
ppp_write(pcb, outpacket_buf, PPP_HDRLEN + msglen);
|
||||
}
|
||||
|
||||
#ifdef USE_SRP
|
||||
|
@ -808,6 +808,7 @@ fsm_sdata(f, code, id, data, datalen)
|
||||
u_char *data;
|
||||
int datalen;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
u_char *outp;
|
||||
int outlen;
|
||||
|
||||
@ -822,7 +823,7 @@ fsm_sdata(f, code, id, data, datalen)
|
||||
PUTCHAR(code, outp);
|
||||
PUTCHAR(id, outp);
|
||||
PUTSHORT(outlen, outp);
|
||||
ppp_write(f->unit, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
ppp_write(pcb, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
}
|
||||
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
@ -1756,6 +1756,7 @@ static int
|
||||
ip_demand_conf(u)
|
||||
int u;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[u];
|
||||
ipcp_options *wo = &ipcp_wantoptions[u];
|
||||
|
||||
if (wo->hisaddr == 0 && !noremoteip) {
|
||||
@ -1769,18 +1770,18 @@ ip_demand_conf(u)
|
||||
wo->accept_local = 1;
|
||||
ask_for_local = 0; /* don't tell the peer this address */
|
||||
}
|
||||
if (!sifaddr(u, wo->ouraddr, wo->hisaddr, get_mask(wo->ouraddr)))
|
||||
if (!sifaddr(pcb, wo->ouraddr, wo->hisaddr, get_mask(wo->ouraddr)))
|
||||
return 0;
|
||||
if (!sifup(u))
|
||||
if (!sifup(pcb))
|
||||
return 0;
|
||||
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
|
||||
if (!sifnpmode(pcb, PPP_IP, NPMODE_QUEUE))
|
||||
return 0;
|
||||
if (wo->default_route)
|
||||
if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr,
|
||||
if (sifdefaultroute(pcb, wo->ouraddr, wo->hisaddr,
|
||||
wo->replace_default_route))
|
||||
default_route_set[u] = 1;
|
||||
if (wo->proxy_arp)
|
||||
if (sifproxyarp(u, wo->hisaddr))
|
||||
if (sifproxyarp(pcb, wo->hisaddr))
|
||||
proxy_arp_set[u] = 1;
|
||||
|
||||
notice("local IP address %I", wo->ouraddr);
|
||||
@ -1800,8 +1801,8 @@ static void
|
||||
ipcp_up(f)
|
||||
fsm *f;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
u_int32_t mask;
|
||||
ppp_pcb *pc = &ppp_pcb_list[f->unit];
|
||||
ipcp_options *ho = &ipcp_hisoptions[f->unit];
|
||||
ipcp_options *go = &ipcp_gotoptions[f->unit];
|
||||
ipcp_options *wo = &ipcp_wantoptions[f->unit];
|
||||
@ -1846,8 +1847,8 @@ ipcp_up(f)
|
||||
if (go->dnsaddr[1])
|
||||
script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
|
||||
#endif /* UNUSED */
|
||||
if (pc->settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
|
||||
sdns(f->unit, go->dnsaddr[0], go->dnsaddr[1]);
|
||||
if (pcb->settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
|
||||
sdns(pcb, go->dnsaddr[0], go->dnsaddr[1]);
|
||||
#if 0 /* UNUSED */
|
||||
script_setenv("USEPEERDNS", "1", 0);
|
||||
create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
|
||||
@ -1867,7 +1868,7 @@ ipcp_up(f)
|
||||
#endif /* Unused */
|
||||
|
||||
/* set tcp compression */
|
||||
sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex);
|
||||
sifvjcomp(pcb, ho->neg_vj, ho->cflag, ho->maxslotindex);
|
||||
|
||||
#if DEMAND_SUPPORT
|
||||
/*
|
||||
@ -1894,7 +1895,7 @@ ipcp_up(f)
|
||||
|
||||
/* Set the interface to the new addresses */
|
||||
mask = get_mask(go->ouraddr);
|
||||
if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
|
||||
if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
@ -1904,18 +1905,18 @@ ipcp_up(f)
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
|
||||
wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
if (ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp)
|
||||
if (sifproxyarp(f->unit, ho->hisaddr))
|
||||
if (sifproxyarp(pcb, ho->hisaddr))
|
||||
proxy_arp_set[f->unit] = 1;
|
||||
|
||||
}
|
||||
demand_rexmit(PPP_IP,go->ouraddr);
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||
sifnpmode(pcb, PPP_IP, NPMODE_PASS);
|
||||
|
||||
} else
|
||||
#endif /* DEMAND_SUPPORT */
|
||||
@ -1926,7 +1927,7 @@ ipcp_up(f)
|
||||
mask = get_mask(go->ouraddr);
|
||||
|
||||
#if !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
|
||||
if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
|
||||
if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
@ -1936,7 +1937,7 @@ ipcp_up(f)
|
||||
#endif
|
||||
|
||||
/* bring the interface up for IP */
|
||||
if (!sifup(f->unit)) {
|
||||
if (!sifup(pcb)) {
|
||||
#if PPP_DEBUG
|
||||
warn("Interface failed to come up");
|
||||
#endif /* PPP_DEBUG */
|
||||
@ -1945,7 +1946,7 @@ ipcp_up(f)
|
||||
}
|
||||
|
||||
#if (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
|
||||
if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
|
||||
if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
@ -1953,17 +1954,17 @@ ipcp_up(f)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||
sifnpmode(pcb, PPP_IP, NPMODE_PASS);
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
|
||||
wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
if (ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp)
|
||||
if (sifproxyarp(f->unit, ho->hisaddr))
|
||||
if (sifproxyarp(pcb, ho->hisaddr))
|
||||
proxy_arp_set[f->unit] = 1;
|
||||
|
||||
ipcp_wantoptions[0].ouraddr = go->ouraddr;
|
||||
@ -2004,6 +2005,7 @@ static void
|
||||
ipcp_down(f)
|
||||
fsm *f;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
IPCPDEBUG(("ipcp: down"));
|
||||
#if PPP_STATS_SUPPORT
|
||||
/* XXX a bit IPv4-centric here, we only need to get the stats
|
||||
@ -2023,7 +2025,7 @@ ipcp_down(f)
|
||||
ipcp_is_up = 0;
|
||||
np_down(f->unit, PPP_IP);
|
||||
}
|
||||
sifvjcomp(f->unit, 0, 0, 0);
|
||||
sifvjcomp(pcb, 0, 0, 0);
|
||||
|
||||
#if PPP_STATS_SUPPORT
|
||||
print_link_stats(); /* _after_ running the notifiers and ip_down_hook(),
|
||||
@ -2037,15 +2039,15 @@ ipcp_down(f)
|
||||
* to queue up outgoing packets (for now).
|
||||
*/
|
||||
if (demand) {
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE);
|
||||
sifnpmode(pcb, PPP_IP, NPMODE_QUEUE);
|
||||
} else
|
||||
#endif /* DEMAND_SUPPORT */
|
||||
{
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
||||
sifdown(f->unit);
|
||||
sifnpmode(pcb, PPP_IP, NPMODE_DROP);
|
||||
sifdown(pcb);
|
||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||
ipcp_hisoptions[f->unit].hisaddr, 0);
|
||||
cdns(f->unit, ipcp_gotoptions[f->unit].dnsaddr[0], ipcp_gotoptions[f->unit].dnsaddr[1]);
|
||||
cdns(pcb, ipcp_gotoptions[f->unit].dnsaddr[0], ipcp_gotoptions[f->unit].dnsaddr[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2056,8 +2058,10 @@ ipcp_down(f)
|
||||
*/
|
||||
static void ipcp_clear_addrs(int unit, u_int32_t ouraddr, u_int32_t hisaddr, bool replacedefaultroute) {
|
||||
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
|
||||
if (proxy_arp_set[unit]) {
|
||||
cifproxyarp(unit, hisaddr);
|
||||
cifproxyarp(pcb, hisaddr);
|
||||
proxy_arp_set[unit] = 0;
|
||||
}
|
||||
/* If replacedefaultroute, sifdefaultroute will be called soon
|
||||
@ -2069,10 +2073,10 @@ static void ipcp_clear_addrs(int unit, u_int32_t ouraddr, u_int32_t hisaddr, boo
|
||||
* is one saved by an sifdefaultroute with replacedefaultroute.
|
||||
*/
|
||||
if (!replacedefaultroute && default_route_set[unit]) {
|
||||
cifdefaultroute(unit, ouraddr, hisaddr);
|
||||
cifdefaultroute(pcb, ouraddr, hisaddr);
|
||||
default_route_set[unit] = 0;
|
||||
}
|
||||
cifaddr(unit, ouraddr, hisaddr);
|
||||
cifaddr(pcb, ouraddr, hisaddr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -462,12 +462,12 @@ lcp_close(unit, reason)
|
||||
int unit;
|
||||
char *reason;
|
||||
{
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
fsm *f = &lcp_fsm[unit];
|
||||
int oldstate;
|
||||
|
||||
if (pc->phase != PHASE_DEAD && pc->phase != PHASE_MASTER)
|
||||
new_phase(unit, PHASE_TERMINATE);
|
||||
if (pcb->phase != PHASE_DEAD && pcb->phase != PHASE_MASTER)
|
||||
new_phase(pcb, PHASE_TERMINATE);
|
||||
|
||||
if (f->flags & DELAYED_UP) {
|
||||
UNTIMEOUT(lcp_delayed_up, f);
|
||||
@ -497,19 +497,19 @@ void
|
||||
lcp_lowerup(unit)
|
||||
int unit;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[unit];
|
||||
lcp_options *wo = &lcp_wantoptions[unit];
|
||||
fsm *f = &lcp_fsm[unit];
|
||||
ppp_pcb *pc = &ppp_pcb_list[unit];
|
||||
/*
|
||||
* Don't use A/C or protocol compression on transmission,
|
||||
* but accept A/C and protocol compressed packets
|
||||
* if we are going to ask for A/C and protocol compression.
|
||||
*/
|
||||
#if PPPOS_SUPPORT
|
||||
ppp_set_xaccm(unit, &xmit_accm[unit]);
|
||||
ppp_set_xaccm(pcb, &xmit_accm[unit]);
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
if (ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0) < 0
|
||||
|| ppp_recv_config(unit, PPP_MRU, (lax_recv? 0: 0xffffffff),
|
||||
if (ppp_send_config(pcb, PPP_MRU, 0xffffffff, 0, 0) < 0
|
||||
|| ppp_recv_config(pcb, PPP_MRU, (lax_recv? 0: 0xffffffff),
|
||||
wo->neg_pcompression, wo->neg_accompression) < 0)
|
||||
return;
|
||||
peer_mru[unit] = PPP_MRU;
|
||||
@ -526,9 +526,9 @@ lcp_lowerup(unit)
|
||||
xmit_accm[unit][0]));
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
|
||||
if (pc->settings.listen_time != 0) {
|
||||
if (pcb->settings.listen_time != 0) {
|
||||
f->flags |= DELAYED_UP;
|
||||
TIMEOUTMS(lcp_delayed_up, f, pc->settings.listen_time);
|
||||
TIMEOUTMS(lcp_delayed_up, f, pcb->settings.listen_time);
|
||||
} else
|
||||
fsm_lowerup(f);
|
||||
}
|
||||
@ -2278,6 +2278,7 @@ static void
|
||||
lcp_up(f)
|
||||
fsm *f;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
lcp_options *wo = &lcp_wantoptions[f->unit];
|
||||
lcp_options *ho = &lcp_hisoptions[f->unit];
|
||||
lcp_options *go = &lcp_gotoptions[f->unit];
|
||||
@ -2303,11 +2304,11 @@ lcp_up(f)
|
||||
#ifdef HAVE_MULTILINK
|
||||
if (!(multilink && go->neg_mrru && ho->neg_mrru))
|
||||
#endif /* HAVE_MULTILINK */
|
||||
netif_set_mtu(f->unit, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
|
||||
ppp_send_config(f->unit, mtu,
|
||||
netif_set_mtu(pcb, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
|
||||
ppp_send_config(pcb, mtu,
|
||||
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
|
||||
ho->neg_pcompression, ho->neg_accompression);
|
||||
ppp_recv_config(f->unit, mru,
|
||||
ppp_recv_config(pcb, mru,
|
||||
(lax_recv? 0: go->neg_asyncmap? go->asyncmap: 0xffffffff),
|
||||
go->neg_pcompression, go->neg_accompression);
|
||||
|
||||
@ -2329,14 +2330,15 @@ static void
|
||||
lcp_down(f)
|
||||
fsm *f;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[f->unit];
|
||||
lcp_options *go = &lcp_gotoptions[f->unit];
|
||||
|
||||
lcp_echo_lowerdown(f->unit);
|
||||
|
||||
link_down(f->unit);
|
||||
|
||||
ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0);
|
||||
ppp_recv_config(f->unit, PPP_MRU,
|
||||
ppp_send_config(pcb, PPP_MRU, 0xffffffff, 0, 0);
|
||||
ppp_recv_config(pcb, PPP_MRU,
|
||||
(go->neg_asyncmap? go->asyncmap: 0xffffffff),
|
||||
go->neg_pcompression, go->neg_accompression);
|
||||
peer_mru[f->unit] = PPP_MRU;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,6 +45,35 @@
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/timers.h"
|
||||
|
||||
#include "vj.h"
|
||||
|
||||
|
||||
/** PPP_INPROC_MULTITHREADED==1 call ppp_input using tcpip_callback().
|
||||
* Set this to 0 if pppos_input_proc is called inside tcpip_thread or with NO_SYS==1.
|
||||
* Default is 1 for NO_SYS==0 (multithreaded) and 0 for NO_SYS==1 (single-threaded).
|
||||
*/
|
||||
#ifndef PPP_INPROC_MULTITHREADED
|
||||
#define PPP_INPROC_MULTITHREADED (NO_SYS==0)
|
||||
#endif
|
||||
|
||||
/** PPP_INPROC_OWNTHREAD==1: start a dedicated RX thread per PPP session.
|
||||
* Default is 0: call pppos_input() for received raw characters, character
|
||||
* reception is up to the port */
|
||||
#ifndef PPP_INPROC_OWNTHREAD
|
||||
#define PPP_INPROC_OWNTHREAD PPP_INPROC_MULTITHREADED
|
||||
#endif
|
||||
|
||||
#if PPP_INPROC_OWNTHREAD && !PPP_INPROC_MULTITHREADED
|
||||
#error "PPP_INPROC_OWNTHREAD needs PPP_INPROC_MULTITHREADED==1"
|
||||
#endif
|
||||
|
||||
#if PPPOS_SUPPORT
|
||||
/** RX buffer size: this may be configured smaller! */
|
||||
#ifndef PPPOS_RX_BUFSIZE
|
||||
#define PPPOS_RX_BUFSIZE (PPP_MRU + PPP_HDRLEN)
|
||||
#endif
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
|
||||
|
||||
#ifndef __u_char_defined
|
||||
|
||||
@ -61,6 +90,12 @@ typedef unsigned char u_char;
|
||||
*** PUBLIC DEFINITIONS ***
|
||||
*************************/
|
||||
|
||||
/*
|
||||
* The basic PPP frame.
|
||||
*/
|
||||
#define PPP_HDRLEN 4 /* octets for standard ppp header */
|
||||
#define PPP_FCSLEN 2 /* octets for FCS */
|
||||
|
||||
/* Error codes. */
|
||||
#define PPPERR_NONE 0 /* No error. */
|
||||
#define PPPERR_PARAM -1 /* Invalid parameter. */
|
||||
@ -135,7 +170,25 @@ struct ppp_addrs {
|
||||
ip_addr_t our_ipaddr, his_ipaddr, netmask, dns1, dns2;
|
||||
};
|
||||
|
||||
/* FIXME: find a way to move ppp_dev_states and ppp_pcb_rx_s to ppp_impl.h */
|
||||
#if PPPOS_SUPPORT
|
||||
/*
|
||||
* Extended asyncmap - allows any character to be escaped.
|
||||
*/
|
||||
typedef u_char ext_accm[32];
|
||||
|
||||
/* PPP packet parser states. Current state indicates operation yet to be
|
||||
* completed. */
|
||||
typedef enum {
|
||||
PDIDLE = 0, /* Idle state - waiting. */
|
||||
PDSTART, /* Process start flag. */
|
||||
PDADDRESS, /* Process address field. */
|
||||
PDCONTROL, /* Process control field. */
|
||||
PDPROTOCOL1, /* Process protocol field 1. */
|
||||
PDPROTOCOL2, /* Process protocol field 2. */
|
||||
PDDATA /* Process data byte. */
|
||||
} ppp_dev_states;
|
||||
|
||||
/*
|
||||
* PPP interface RX control block.
|
||||
*/
|
||||
|
@ -69,9 +69,6 @@ typedef unsigned char bool;
|
||||
/*
|
||||
* The basic PPP frame.
|
||||
*/
|
||||
#define PPP_HDRLEN 4 /* octets for standard ppp header */
|
||||
#define PPP_FCSLEN 2 /* octets for FCS */
|
||||
|
||||
#define PPP_ADDRESS(p) (((u_char *)(p))[0])
|
||||
#define PPP_CONTROL(p) (((u_char *)(p))[1])
|
||||
#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
|
||||
@ -155,11 +152,6 @@ typedef unsigned short u_int16_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Extended asyncmap - allows any character to be escaped.
|
||||
*/
|
||||
typedef u_char ext_accm[32];
|
||||
|
||||
/*
|
||||
* What to do with network protocol (NP) packets.
|
||||
*/
|
||||
@ -312,7 +304,7 @@ struct protent {
|
||||
*/
|
||||
/* Process a received data packet */
|
||||
void (*datainput) (int unit, u_char *pkt, int len);
|
||||
bool enabled_flag; /* 0 iff protocol is disabled */
|
||||
bool enabled_flag; /* 0 if protocol is disabled */
|
||||
#if PRINTPKT_SUPPORT
|
||||
char *name; /* Text name of protocol */
|
||||
char *data_name; /* Text name of corresponding data protocol */
|
||||
@ -396,17 +388,16 @@ ppp_pcb ppp_pcb_list[NUM_PPP]; /* The PPP interface control blocks. */
|
||||
/* PPP flow functions
|
||||
*/
|
||||
#if PPPOE_SUPPORT
|
||||
void ppp_over_ethernet_init_failed(int pd);
|
||||
/* function called by pppoe.c */
|
||||
void ppp_input_over_ethernet(ppp_pcb *pcb, struct pbuf *pb);
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
|
||||
/* function called by all PPP subsystems to send packets */
|
||||
int ppp_write(int pd, const u_char *s, int n);
|
||||
int ppp_write(ppp_pcb *pcb, const u_char *s, int n);
|
||||
|
||||
/* functions called by auth.c link_terminated() */
|
||||
void ppp_link_down(int pd);
|
||||
void ppp_link_terminated(int pd);
|
||||
void ppp_link_down(ppp_pcb *pcb);
|
||||
void ppp_link_terminated(ppp_pcb *pcb);
|
||||
|
||||
/* merge a pbuf chain into one pbuf */
|
||||
struct pbuf * ppp_singlebuf(struct pbuf *p);
|
||||
@ -415,37 +406,37 @@ struct pbuf * ppp_singlebuf(struct pbuf *p);
|
||||
/* Functions called by various PPP subsystems to configure
|
||||
* the PPP interface or change the PPP phase.
|
||||
*/
|
||||
void new_phase(int unit, int p);
|
||||
void new_phase(ppp_pcb *pcb, int p);
|
||||
|
||||
#if PPPOS_SUPPORT
|
||||
void ppp_set_xaccm(int unit, ext_accm *accm);
|
||||
void ppp_set_xaccm(ppp_pcb *pcb, ext_accm *accm);
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
int ppp_send_config(int unit, int mtu, u_int32_t accm, int pcomp, int accomp);
|
||||
int ppp_recv_config(int unit, int mru, u_int32_t accm, int pcomp, int accomp);
|
||||
int ppp_send_config(ppp_pcb *pcb, int mtu, u_int32_t accm, int pcomp, int accomp);
|
||||
int ppp_recv_config(ppp_pcb *pcb, int mru, u_int32_t accm, int pcomp, int accomp);
|
||||
|
||||
int sifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr, u_int32_t net_mask);
|
||||
int cifaddr(int unit, u_int32_t our_adr, u_int32_t his_adr);
|
||||
int sifaddr(ppp_pcb *pcb, u_int32_t our_adr, u_int32_t his_adr, u_int32_t net_mask);
|
||||
int cifaddr(ppp_pcb *pcb, u_int32_t our_adr, u_int32_t his_adr);
|
||||
|
||||
int sdns(int unit, u_int32_t ns1, u_int32_t ns2);
|
||||
int cdns(int unit, u_int32_t ns1, u_int32_t ns2);
|
||||
int sdns(ppp_pcb *pcb, u_int32_t ns1, u_int32_t ns2);
|
||||
int cdns(ppp_pcb *pcb, u_int32_t ns1, u_int32_t ns2);
|
||||
|
||||
int sifup(int u);
|
||||
int sifdown (int u);
|
||||
int sifup(ppp_pcb *pcb);
|
||||
int sifdown (ppp_pcb *pcb);
|
||||
|
||||
int sifnpmode(int u, int proto, enum NPmode mode);
|
||||
int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode);
|
||||
|
||||
void netif_set_mtu(int unit, int mtu);
|
||||
int netif_get_mtu(int unit);
|
||||
void netif_set_mtu(ppp_pcb *pcb, int mtu);
|
||||
int netif_get_mtu(ppp_pcb *pcb);
|
||||
|
||||
int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace);
|
||||
int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway);
|
||||
int sifdefaultroute(ppp_pcb *pcb, u_int32_t ouraddr, u_int32_t gateway, bool replace);
|
||||
int cifdefaultroute(ppp_pcb *pcb, u_int32_t ouraddr, u_int32_t gateway);
|
||||
|
||||
int sifproxyarp (int unit, u_int32_t his_adr);
|
||||
int cifproxyarp (int unit, u_int32_t his_adr);
|
||||
int sifproxyarp(ppp_pcb *pcb, u_int32_t his_adr);
|
||||
int cifproxyarp(ppp_pcb *pcb, u_int32_t his_adr);
|
||||
|
||||
int sifvjcomp (int u, int vjcomp, int cidcomp, int maxcid);
|
||||
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
|
||||
|
||||
int get_idle_time(int u, struct ppp_idle *ip);
|
||||
int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
|
||||
|
||||
int get_loop_output(void);
|
||||
|
||||
|
@ -584,6 +584,7 @@ static void
|
||||
upap_sauthreq(u)
|
||||
upap_state *u;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
|
||||
u_char *outp;
|
||||
int outlen;
|
||||
|
||||
@ -602,7 +603,7 @@ upap_sauthreq(u)
|
||||
PUTCHAR(u->us_passwdlen, outp);
|
||||
MEMCPY(outp, u->us_passwd, u->us_passwdlen);
|
||||
|
||||
ppp_write(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
ppp_write(pcb, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
|
||||
TIMEOUT(upap_timeout, u, u->us_timeouttime);
|
||||
++u->us_transmits;
|
||||
@ -620,6 +621,7 @@ upap_sresp(u, code, id, msg, msglen)
|
||||
char *msg;
|
||||
int msglen;
|
||||
{
|
||||
ppp_pcb *pcb = &ppp_pcb_list[u->us_unit];
|
||||
u_char *outp;
|
||||
int outlen;
|
||||
|
||||
@ -632,7 +634,7 @@ upap_sresp(u, code, id, msg, msglen)
|
||||
PUTSHORT(outlen, outp);
|
||||
PUTCHAR(msglen, outp);
|
||||
MEMCPY(outp, msg, msglen);
|
||||
ppp_write(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
ppp_write(pcb, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user