mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-13 02:05:43 +00:00
fixed most "unit 0" used instead of pcb pointer
This commit is contained in:
parent
99bf9775d9
commit
ea7bf19057
@ -593,7 +593,7 @@ void start_link(unit)
|
|||||||
|
|
||||||
new_phase(pcb, PHASE_ESTABLISH);
|
new_phase(pcb, PHASE_ESTABLISH);
|
||||||
|
|
||||||
lcp_lowerup(0);
|
lcp_lowerup(pcb);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect:
|
disconnect:
|
||||||
@ -632,7 +632,7 @@ void link_terminated(ppp_pcb *pcb) {
|
|||||||
} else
|
} else
|
||||||
notice("Link terminated.");
|
notice("Link terminated.");
|
||||||
|
|
||||||
lcp_lowerdown(0);
|
lcp_lowerdown(pcb);
|
||||||
|
|
||||||
new_phase(pcb, PHASE_DEAD);
|
new_phase(pcb, PHASE_DEAD);
|
||||||
ppp_link_terminated(pcb);
|
ppp_link_terminated(pcb);
|
||||||
@ -659,7 +659,7 @@ void link_terminated(ppp_pcb *pcb) {
|
|||||||
fd_ppp = -1;
|
fd_ppp = -1;
|
||||||
}
|
}
|
||||||
if (!hungup)
|
if (!hungup)
|
||||||
lcp_lowerdown(0);
|
lcp_lowerdown(pcb);
|
||||||
if (!doing_multilink && !demand)
|
if (!doing_multilink && !demand)
|
||||||
script_unsetenv("IFNAME");
|
script_unsetenv("IFNAME");
|
||||||
|
|
||||||
@ -778,7 +778,7 @@ void link_established(ppp_pcb *pcb) {
|
|||||||
if (!wo->neg_upap || uselogin || !null_login(unit)) {
|
if (!wo->neg_upap || uselogin || !null_login(unit)) {
|
||||||
warn("peer refused to authenticate: terminating link");
|
warn("peer refused to authenticate: terminating link");
|
||||||
status = EXIT_PEER_AUTH_FAILED;
|
status = EXIT_PEER_AUTH_FAILED;
|
||||||
lcp_close(pcb->unit, "peer refused to authenticate");
|
lcp_close(pcb, "peer refused to authenticate");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -878,7 +878,7 @@ static void network_phase(ppp_pcb *pcb) {
|
|||||||
*/
|
*/
|
||||||
if (go->neg_cbcp) {
|
if (go->neg_cbcp) {
|
||||||
new_phase(pcb, PHASE_CALLBACK);
|
new_phase(pcb, PHASE_CALLBACK);
|
||||||
(*cbcp_protent.open)(unit);
|
(*cbcp_protent.open)(pcb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -939,7 +939,7 @@ void start_networks(ppp_pcb *pcb) {
|
|||||||
#endif /* CCP_SUPPORT */
|
#endif /* CCP_SUPPORT */
|
||||||
)
|
)
|
||||||
&& protp->enabled_flag && protp->open != NULL)
|
&& protp->enabled_flag && protp->open != NULL)
|
||||||
(*protp->open)(0);
|
(*protp->open)(pcb);
|
||||||
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -985,7 +985,7 @@ void continue_networks(ppp_pcb *pcb) {
|
|||||||
|
|
||||||
if (pcb->num_np_open == 0)
|
if (pcb->num_np_open == 0)
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
lcp_close(0, "No network protocols running");
|
lcp_close(pcb, "No network protocols running");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PPP_SERVER
|
#if PPP_SERVER
|
||||||
@ -997,7 +997,7 @@ void auth_peer_fail(ppp_pcb *pcb, int protocol) {
|
|||||||
* Authentication failure: take the link down
|
* Authentication failure: take the link down
|
||||||
*/
|
*/
|
||||||
status = EXIT_PEER_AUTH_FAILED;
|
status = EXIT_PEER_AUTH_FAILED;
|
||||||
lcp_close(pcb->unit, "Authentication failed");
|
lcp_close(pcb, "Authentication failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1210,7 +1210,7 @@ void np_down(ppp_pcb *pcb, int proto) {
|
|||||||
void np_finished(ppp_pcb *pcb, int proto) {
|
void np_finished(ppp_pcb *pcb, int proto) {
|
||||||
if (--pcb->num_np_open <= 0) {
|
if (--pcb->num_np_open <= 0) {
|
||||||
/* no further use for the link: shut up shop. */
|
/* no further use for the link: shut up shop. */
|
||||||
lcp_close(0, "No network protocols running");
|
lcp_close(pcb, "No network protocols running");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1243,7 @@ check_maxoctets(arg)
|
|||||||
if (used > maxoctets) {
|
if (used > maxoctets) {
|
||||||
notice("Traffic limit reached. Limit: %u Used: %u", maxoctets, used);
|
notice("Traffic limit reached. Limit: %u Used: %u", maxoctets, used);
|
||||||
status = EXIT_TRAFFIC_LIMIT;
|
status = EXIT_TRAFFIC_LIMIT;
|
||||||
lcp_close(0, "Traffic limit");
|
lcp_close(pcb, "Traffic limit");
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
need_holdoff = 0;
|
need_holdoff = 0;
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
@ -1280,7 +1280,7 @@ static void check_idle(void *arg) {
|
|||||||
/* link is idle: shut it down. */
|
/* link is idle: shut it down. */
|
||||||
notice("Terminating connection due to lack of activity.");
|
notice("Terminating connection due to lack of activity.");
|
||||||
pcb->status = EXIT_IDLE_TIMEOUT;
|
pcb->status = EXIT_IDLE_TIMEOUT;
|
||||||
lcp_close(0, "Link inactive");
|
lcp_close(pcb, "Link inactive");
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
need_holdoff = 0;
|
need_holdoff = 0;
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
@ -1296,7 +1296,7 @@ static void connect_time_expired(void *arg) {
|
|||||||
ppp_pcb *pcb = (ppp_pcb*)arg;
|
ppp_pcb *pcb = (ppp_pcb*)arg;
|
||||||
info("Connect time expired");
|
info("Connect time expired");
|
||||||
pcb->status = EXIT_CONNECT_TIME;
|
pcb->status = EXIT_CONNECT_TIME;
|
||||||
lcp_close(0, "Connect time expired"); /* Close connection */
|
lcp_close(pcb, "Connect time expired"); /* Close connection */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PPP_OPTIONS
|
#if PPP_OPTIONS
|
||||||
@ -1662,7 +1662,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
|
|||||||
*/
|
*/
|
||||||
if (attempts++ >= 10) {
|
if (attempts++ >= 10) {
|
||||||
warn("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user);
|
warn("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user);
|
||||||
lcp_close(unit, "login failed");
|
lcp_close(pcb, "login failed");
|
||||||
}
|
}
|
||||||
if (attempts > 3)
|
if (attempts > 3)
|
||||||
sleep((u_int) (attempts - 3) * 5);
|
sleep((u_int) (attempts - 3) * 5);
|
||||||
|
@ -98,9 +98,9 @@ demand_conf()
|
|||||||
flush_flag = 0;
|
flush_flag = 0;
|
||||||
fcs = PPP_INITFCS;
|
fcs = PPP_INITFCS;
|
||||||
|
|
||||||
netif_set_mtu(0, LWIP_MIN(lcp_allowoptions[0].mru, PPP_MRU));
|
netif_set_mtu(pcb, LWIP_MIN(lcp_allowoptions[0].mru, PPP_MRU));
|
||||||
if (ppp_send_config(0, PPP_MRU, (u_int32_t) 0, 0, 0) < 0
|
if (ppp_send_config(pcb, PPP_MRU, (u_int32_t) 0, 0, 0) < 0
|
||||||
|| ppp_recv_config(0, PPP_MRU, (u_int32_t) 0, 0, 0) < 0)
|
|| ppp_recv_config(pcb, PPP_MRU, (u_int32_t) 0, 0, 0) < 0)
|
||||||
fatal("Couldn't set up demand-dialled PPP interface: %m");
|
fatal("Couldn't set up demand-dialled PPP interface: %m");
|
||||||
|
|
||||||
#ifdef PPP_FILTER
|
#ifdef PPP_FILTER
|
||||||
@ -112,10 +112,10 @@ demand_conf()
|
|||||||
*/
|
*/
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
((*protp->demand_conf)(0));
|
((*protp->demand_conf)(pcb));
|
||||||
/* FIXME: find a way to die() here */
|
/* FIXME: find a way to die() here */
|
||||||
#if 0
|
#if 0
|
||||||
if (!((*protp->demand_conf)(0)))
|
if (!((*protp->demand_conf)(pcb)))
|
||||||
die(1);
|
die(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ demand_block()
|
|||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
sifnpmode(0, protp->protocol & ~0x8000, NPMODE_QUEUE);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_QUEUE);
|
||||||
get_loop_output();
|
get_loop_output();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ demand_discard()
|
|||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
sifnpmode(0, protp->protocol & ~0x8000, NPMODE_ERROR);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_ERROR);
|
||||||
get_loop_output();
|
get_loop_output();
|
||||||
|
|
||||||
/* discard all saved packets */
|
/* discard all saved packets */
|
||||||
@ -175,7 +175,7 @@ demand_unblock()
|
|||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
sifnpmode(0, protp->protocol & ~0x8000, NPMODE_PASS);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_PASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -411,7 +411,7 @@ demand_rexmit(proto, newip)
|
|||||||
ntohs(*( (short *) (pkt->data+iphdr+6))));
|
ntohs(*( (short *) (pkt->data+iphdr+6))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output(0, pkt->data, pkt->length);
|
output(pcb, pkt->data, pkt->length);
|
||||||
free(pkt);
|
free(pkt);
|
||||||
} else {
|
} else {
|
||||||
if (prev == NULL)
|
if (prev == NULL)
|
||||||
|
@ -130,7 +130,7 @@ mp_join_bundle()
|
|||||||
/* have previously joined a bundle */
|
/* have previously joined a bundle */
|
||||||
if (!go->neg_mrru || !ho->neg_mrru) {
|
if (!go->neg_mrru || !ho->neg_mrru) {
|
||||||
notice("oops, didn't get multilink on renegotiation");
|
notice("oops, didn't get multilink on renegotiation");
|
||||||
lcp_close(0, "multilink required");
|
lcp_close(pcb, "multilink required");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* XXX should check the peer_authname and ho->endpoint
|
/* XXX should check the peer_authname and ho->endpoint
|
||||||
@ -148,12 +148,12 @@ mp_join_bundle()
|
|||||||
if (demand) {
|
if (demand) {
|
||||||
/* already have a bundle */
|
/* already have a bundle */
|
||||||
cfg_bundle(0, 0, 0, 0);
|
cfg_bundle(0, 0, 0, 0);
|
||||||
netif_set_mtu(0, mtu);
|
netif_set_mtu(pcb, mtu);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
make_new_bundle(0, 0, 0, 0);
|
make_new_bundle(0, 0, 0, 0);
|
||||||
set_ifunit(1);
|
set_ifunit(1);
|
||||||
netif_set_mtu(0, mtu);
|
netif_set_mtu(pcb, mtu);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ mp_join_bundle()
|
|||||||
mtu = LWIP_MIN(ho->mrru, ao->mru);
|
mtu = LWIP_MIN(ho->mrru, ao->mru);
|
||||||
if (demand) {
|
if (demand) {
|
||||||
cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
|
cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
|
||||||
netif_set_mtu(0, mtu);
|
netif_set_mtu(pcb, mtu);
|
||||||
script_setenv("BUNDLE", bundle_id + 7, 1);
|
script_setenv("BUNDLE", bundle_id + 7, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -245,9 +245,9 @@ mp_join_bundle()
|
|||||||
/* we have to make a new bundle */
|
/* we have to make a new bundle */
|
||||||
make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
|
make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
|
||||||
set_ifunit(1);
|
set_ifunit(1);
|
||||||
netif_set_mtu(0, mtu);
|
netif_set_mtu(pcb, mtu);
|
||||||
script_setenv("BUNDLE", bundle_id + 7, 1);
|
script_setenv("BUNDLE", bundle_id + 7, 1);
|
||||||
make_bundle_links(0);
|
make_bundle_links(pcb);
|
||||||
unlock_db();
|
unlock_db();
|
||||||
info("New bundle %s created", ifname);
|
info("New bundle %s created", ifname);
|
||||||
multilink_master = 1;
|
multilink_master = 1;
|
||||||
@ -277,7 +277,7 @@ void mp_bundle_terminated()
|
|||||||
TDB_DATA key;
|
TDB_DATA key;
|
||||||
|
|
||||||
bundle_terminating = 1;
|
bundle_terminating = 1;
|
||||||
upper_layers_down(0);
|
upper_layers_down(pcb);
|
||||||
notice("Connection terminated.");
|
notice("Connection terminated.");
|
||||||
#if PPP_STATS_SUPPORT
|
#if PPP_STATS_SUPPORT
|
||||||
print_link_stats();
|
print_link_stats();
|
||||||
|
Loading…
Reference in New Issue
Block a user