mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-13 02:05:43 +00:00
print packet is working back, at least for PPPoE
This commit is contained in:
parent
d27da93c33
commit
b922eaa754
@ -91,19 +91,17 @@ struct option_value {
|
||||
* Option variables and default values.
|
||||
*/
|
||||
int debug = 0; /* Debug flag */
|
||||
#if 0
|
||||
int kdebugflag = 0; /* Tell kernel to print debug messages */
|
||||
int default_device = 1; /* Using /dev/tty or equivalent */
|
||||
#if 0
|
||||
char devnam[MAXPATHLEN]; /* Device name */
|
||||
#endif
|
||||
bool nodetach = 0; /* Don't detach from controlling tty */
|
||||
bool updetach = 0; /* Detach once link is up */
|
||||
#if 0
|
||||
int maxconnect = 0; /* Maximum connect time */
|
||||
char user[MAXNAMELEN]; /* Username for PAP */
|
||||
char passwd[MAXSECRETLEN]; /* Password for PAP */
|
||||
#endif
|
||||
bool persist = 0; /* Reopen link after it goes down */
|
||||
#endif
|
||||
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
|
||||
#if DEMAND_SUPPORT
|
||||
bool demand = 0; /* do dial-on-demand */
|
||||
|
@ -1057,6 +1057,10 @@ void ppp_input_over_ethernet(int pd, struct pbuf *pb) {
|
||||
goto drop;
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
dump_packet("rcvd", pb->payload, pb->len);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
in_protocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1];
|
||||
|
||||
/* make room for ppp_input_header - should not fail */
|
||||
@ -1068,7 +1072,7 @@ void ppp_input_over_ethernet(int pd, struct pbuf *pb) {
|
||||
pih = pb->payload;
|
||||
|
||||
pih->unit = pd;
|
||||
pih->proto = in_protocol;
|
||||
pih->proto = in_protocol; /* pih->proto is now in host byte order */
|
||||
|
||||
/* Dispatch the packet thereby consuming it. */
|
||||
ppp_input(pb);
|
||||
@ -1540,6 +1544,10 @@ static int ppp_write_over_ethernet(int pd, const u_char *s, int n) {
|
||||
return PPPERR_DEVICE;
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
dump_packet("sent", (unsigned char *)s, n);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
snmp_add_ifoutoctets(&pc->netif, (u16_t)n);
|
||||
snmp_inc_ifoutucastpkts(&pc->netif);
|
||||
LINK_STATS_INC(link.xmit);
|
||||
|
@ -56,9 +56,10 @@
|
||||
|
||||
#include "upap.h"
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
/* FIXME: move that to ppp_options */
|
||||
#if PRINTPKT_SUPPORT
|
||||
static bool hide_password = 1;
|
||||
#endif /* UNUSED */
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#if PPP_OPTIONS
|
||||
/*
|
||||
|
@ -75,12 +75,12 @@ static void log_write (int, char *);
|
||||
static void vslp_printer (void *, char *, ...);
|
||||
static void format_packet (u_char *, int, void (*) (void *, char *, ...),
|
||||
void *);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct buffer_info {
|
||||
char *ptr;
|
||||
int len;
|
||||
};
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
/*
|
||||
* strlcpy - like strcpy/strncpy, doesn't overflow destination buffer,
|
||||
@ -482,10 +482,9 @@ format_packet(p, len, printer, arg)
|
||||
u_short proto;
|
||||
struct protent *protp;
|
||||
|
||||
if (len >= PPP_HDRLEN && p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) {
|
||||
p += 2;
|
||||
if (len >= 2) {
|
||||
GETSHORT(proto, p);
|
||||
len -= PPP_HDRLEN;
|
||||
len -= 2;
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||
if (proto == protp->protocol)
|
||||
break;
|
||||
@ -651,9 +650,7 @@ log_write(level, buf)
|
||||
int level;
|
||||
char *buf;
|
||||
{
|
||||
/* FIXME: replace this with a log callback */
|
||||
/* if(level >= min_log_level) */ /* FIXME: add a minimum log level */
|
||||
PPPDEBUG(LOG_DEBUG, ("LOG: %s\n", buf) );
|
||||
PPPDEBUG(level, ("%s\n", buf) );
|
||||
#if 0
|
||||
if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) {
|
||||
int n = strlen(buf);
|
||||
@ -764,18 +761,28 @@ dump_packet(const char *tag, unsigned char *p, int len)
|
||||
if (!debug)
|
||||
return;
|
||||
|
||||
/*
|
||||
* don't print IPv4 and IPv6 packets.
|
||||
*/
|
||||
proto = (p[0] << 8) + p[1];
|
||||
if (proto == PPP_IP)
|
||||
return;
|
||||
#ifdef INET6
|
||||
if (proto == PPP_IPV6 || proto == PPP_IPV6CP)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* don't print LCP echo request/reply packets if debug <= 1
|
||||
* and the link is up.
|
||||
*/
|
||||
proto = (p[2] << 8) + p[3];
|
||||
if (debug <= 1 && unsuccess == 0 && proto == PPP_LCP
|
||||
&& len >= PPP_HDRLEN + HEADERLEN) {
|
||||
unsigned char *lcp = p + PPP_HDRLEN;
|
||||
&& len >= 2 + HEADERLEN) {
|
||||
unsigned char *lcp = p + 2;
|
||||
int l = (lcp[2] << 8) + lcp[3];
|
||||
|
||||
if ((lcp[0] == ECHOREQ || lcp[0] == ECHOREP)
|
||||
&& l >= HEADERLEN && l <= len - PPP_HDRLEN)
|
||||
&& l >= HEADERLEN && l <= len - 2)
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user