mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-11 00:44:39 +00:00
using PPP_DEBUG instead of debug global variable
This commit is contained in:
parent
1ccf516c5e
commit
945f2912a7
@ -1893,8 +1893,9 @@ 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 (debug)
|
||||
warn("Interface configuration failed");
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
ipcp_close(f->unit, "Interface configuration failed");
|
||||
return;
|
||||
}
|
||||
@ -1924,8 +1925,9 @@ ipcp_up(f)
|
||||
|
||||
#if !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
|
||||
if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
|
||||
if (debug)
|
||||
warn("Interface configuration failed");
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
ipcp_close(f->unit, "Interface configuration failed");
|
||||
return;
|
||||
}
|
||||
@ -1933,16 +1935,18 @@ ipcp_up(f)
|
||||
|
||||
/* bring the interface up for IP */
|
||||
if (!sifup(f->unit)) {
|
||||
if (debug)
|
||||
warn("Interface failed to come up");
|
||||
#if PPP_DEBUG
|
||||
warn("Interface failed to come up");
|
||||
#endif /* PPP_DEBUG */
|
||||
ipcp_close(f->unit, "Interface configuration failed");
|
||||
return;
|
||||
}
|
||||
|
||||
#if (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
|
||||
if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
|
||||
if (debug)
|
||||
warn("Interface configuration failed");
|
||||
#if PPP_DEBUG
|
||||
warn("Interface configuration failed");
|
||||
#endif /* PPP_DEBUG */
|
||||
ipcp_close(f->unit, "Interface configuration failed");
|
||||
return;
|
||||
}
|
||||
|
@ -150,7 +150,6 @@
|
||||
*/
|
||||
/* FIXME: global variables per PPP session */
|
||||
/* FIXME: clean global variables */
|
||||
int debug = 0; /* Debug flag */
|
||||
int phase; /* where the link is at */
|
||||
int error_count; /* # of times error() has been called */
|
||||
int unsuccess; /* # unsuccessful connection attempts */
|
||||
@ -266,14 +265,14 @@ typedef struct ppp_control_s {
|
||||
struct netif *ethif;
|
||||
struct pppoe_softc *pppoe_sc;
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
int if_up; /* True when the interface is up. */
|
||||
int if_up; /* True when the interface is up. */
|
||||
int err_code; /* Code indicating why interface is down. */
|
||||
#if PPPOS_SUPPORT
|
||||
sio_fd_t fd; /* File device ID of port. */
|
||||
sio_fd_t fd; /* File device ID of port. */
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
u16_t mtu; /* Peer's mru */
|
||||
int pcomp; /* Does peer accept protocol compression? */
|
||||
int accomp; /* Does peer accept addr/ctl compression? */
|
||||
u16_t mtu; /* Peer's mru */
|
||||
int pcomp; /* Does peer accept protocol compression? */
|
||||
int accomp; /* Does peer accept addr/ctl compression? */
|
||||
u_long last_xmit; /* Time of last transmission. */
|
||||
#if PPPOS_SUPPORT
|
||||
ext_accm out_accm; /* Async-Ctl-Char-Map for output. */
|
||||
@ -357,8 +356,6 @@ int ppp_init(void) {
|
||||
int i;
|
||||
struct protent *protp;
|
||||
|
||||
debug = 1;
|
||||
|
||||
new_phase(PHASE_INITIALIZE);
|
||||
error_count = 0;
|
||||
unsuccess = 0;
|
||||
@ -843,15 +840,15 @@ static void ppp_input(void *arg) {
|
||||
#endif /* UNUSED */
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
#if PPP_DEBUG
|
||||
#if PPP_PROTOCOLNAME
|
||||
const char *pname = protocol_name(protocol);
|
||||
if (pname != NULL)
|
||||
warn("Unsupported protocol '%s' (0x%x) received", pname, protocol);
|
||||
else
|
||||
const char *pname = protocol_name(protocol);
|
||||
if (pname != NULL)
|
||||
warn("Unsupported protocol '%s' (0x%x) received", pname, protocol);
|
||||
else
|
||||
#endif /* PPP_PROTOCOLNAME */
|
||||
warn("Unsupported protocol 0x%x received", protocol);
|
||||
}
|
||||
warn("Unsupported protocol 0x%x received", protocol);
|
||||
#endif /* PPP_DEBUG */
|
||||
if (pbuf_header(nb, sizeof(protocol))) {
|
||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||
goto drop;
|
||||
|
@ -760,9 +760,6 @@ dump_packet(const char *tag, unsigned char *p, int len)
|
||||
{
|
||||
int proto;
|
||||
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
/*
|
||||
* don't print IPv4 and IPv6 packets.
|
||||
*/
|
||||
@ -775,10 +772,9 @@ dump_packet(const char *tag, unsigned char *p, int len)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* don't print LCP echo request/reply packets if debug <= 1
|
||||
* and the link is up.
|
||||
* don't print LCP echo request/reply packets if the link is up.
|
||||
*/
|
||||
if (debug <= 1 && unsuccess == 0 && proto == PPP_LCP
|
||||
if (unsuccess == 0 && proto == PPP_LCP
|
||||
&& len >= 2 + HEADERLEN) {
|
||||
unsigned char *lcp = p + 2;
|
||||
int l = (lcp[2] << 8) + lcp[3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user