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