mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-08 23:44:39 +08:00
PPP, minor coding style fix
This commit is contained in:
parent
987f6237c4
commit
91e40e668c
@ -755,8 +755,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
|| protocol == PPP_EAP
|
|| protocol == PPP_EAP
|
||||||
#endif /* EAP_SUPPORT */
|
#endif /* EAP_SUPPORT */
|
||||||
)) {
|
)) {
|
||||||
ppp_dbglog("discarding proto 0x%x in phase %d",
|
ppp_dbglog("discarding proto 0x%x in phase %d", protocol, pcb->phase);
|
||||||
protocol, pcb->phase);
|
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,7 +911,6 @@ drop:
|
|||||||
out:
|
out:
|
||||||
pbuf_free(pb);
|
pbuf_free(pb);
|
||||||
magic_randomize();
|
magic_randomize();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* merge a pbuf chain into one pbuf */
|
/* merge a pbuf chain into one pbuf */
|
||||||
@ -1531,9 +1529,11 @@ struct protocol_list {
|
|||||||
const char * protocol_name(int proto) {
|
const char * protocol_name(int proto) {
|
||||||
struct protocol_list *lp;
|
struct protocol_list *lp;
|
||||||
|
|
||||||
for (lp = protocol_list; lp->proto != 0; ++lp)
|
for (lp = protocol_list; lp->proto != 0; ++lp) {
|
||||||
if (proto == lp->proto)
|
if (proto == lp->proto) {
|
||||||
return lp->name;
|
return lp->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* PPP_PROTOCOLNAME */
|
#endif /* PPP_PROTOCOLNAME */
|
||||||
@ -1550,8 +1550,9 @@ const char * protocol_name(int proto) {
|
|||||||
* reset_link_stats - "reset" stats when link goes up.
|
* reset_link_stats - "reset" stats when link goes up.
|
||||||
*/
|
*/
|
||||||
void reset_link_stats(int u) {
|
void reset_link_stats(int u) {
|
||||||
if (!get_ppp_stats(u, &old_link_stats))
|
if (!get_ppp_stats(u, &old_link_stats)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
gettimeofday(&start_time, NULL);
|
gettimeofday(&start_time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1559,13 +1560,12 @@ void reset_link_stats(int u) {
|
|||||||
* update_link_stats - get stats at link termination.
|
* update_link_stats - get stats at link termination.
|
||||||
*/
|
*/
|
||||||
void update_link_stats(int u) {
|
void update_link_stats(int u) {
|
||||||
|
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
char numbuf[32];
|
char numbuf[32];
|
||||||
|
|
||||||
if (!get_ppp_stats(u, &link_stats)
|
if (!get_ppp_stats(u, &link_stats) || gettimeofday(&now, NULL) < 0) {
|
||||||
|| gettimeofday(&now, NULL) < 0)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
link_connect_time = now.tv_sec - start_time.tv_sec;
|
link_connect_time = now.tv_sec - start_time.tv_sec;
|
||||||
link_stats_valid = 1;
|
link_stats_valid = 1;
|
||||||
|
|
||||||
@ -1582,8 +1582,7 @@ void print_link_stats() {
|
|||||||
if (link_stats_valid) {
|
if (link_stats_valid) {
|
||||||
int t = (link_connect_time + 5) / 6; /* 1/10ths of minutes */
|
int t = (link_connect_time + 5) / 6; /* 1/10ths of minutes */
|
||||||
info("Connect time %d.%d minutes.", t/10, t%10);
|
info("Connect time %d.%d minutes.", t/10, t%10);
|
||||||
info("Sent %u bytes, received %u bytes.",
|
info("Sent %u bytes, received %u bytes.", link_stats.bytes_out, link_stats.bytes_in);
|
||||||
link_stats.bytes_out, link_stats.bytes_in);
|
|
||||||
link_stats_valid = 0;
|
link_stats_valid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user