diff --git a/src/include/netif/ppp/mppe.h b/src/include/netif/ppp/mppe.h index 49e4cfb1..93086955 100644 --- a/src/include/netif/ppp/mppe.h +++ b/src/include/netif/ppp/mppe.h @@ -101,7 +101,7 @@ /* The reverse of the above */ #define MPPE_CI_TO_OPTS(ci, opts) \ do { \ - u_char *ptr = ci; /* u_char[4] */ \ + const u_char *ptr = ci; /* u_char[4] */ \ \ opts = 0; \ \ diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index caf499aa..3579e289 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -290,7 +290,7 @@ struct protent { void (*close) (ppp_pcb *pcb, const char *reason); #if PRINTPKT_SUPPORT /* Print a packet in readable form */ - int (*printpkt) (u_char *pkt, int len, + int (*printpkt) (const u_char *pkt, int len, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c index 9a04394a..935e1760 100644 --- a/src/netif/ppp/ccp.c +++ b/src/netif/ppp/ccp.c @@ -173,7 +173,7 @@ static void ccp_lowerdown(ppp_pcb *pcb); static void ccp_input(ppp_pcb *pcb, u_char *pkt, int len); static void ccp_protrej(ppp_pcb *pcb); #if PRINTPKT_SUPPORT -static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); +static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ #if PPP_DATAINPUT static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len); @@ -1519,8 +1519,8 @@ static const char* const ccp_codenames[] = { "ResetReq", "ResetAck", }; -static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { - u_char *p0, *optend; +static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { + const u_char *p0, *optend; int code, id, len; int optlen; diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 10c97db6..4661b981 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -104,7 +104,7 @@ static void chap_handle_status(ppp_pcb *pcb, int code, int id, static void chap_protrej(ppp_pcb *pcb); static void chap_input(ppp_pcb *pcb, unsigned char *pkt, int pktlen); #if PRINTPKT_SUPPORT -static int chap_print_pkt(unsigned char *p, int plen, +static int chap_print_pkt(const unsigned char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ @@ -590,7 +590,7 @@ static const char* const chap_code_names[] = { "Challenge", "Response", "Success", "Failure" }; -static int chap_print_pkt(unsigned char *p, int plen, +static int chap_print_pkt(const unsigned char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { int code, id, len; int clen, nlen; diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index 373cb9d7..717c8dff 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -108,7 +108,7 @@ static void eap_protrej(ppp_pcb *pcb); static void eap_lowerup(ppp_pcb *pcb); static void eap_lowerdown(ppp_pcb *pcb); #if PRINTPKT_SUPPORT -static int eap_printpkt(u_char *inp, int inlen, +static int eap_printpkt(const u_char *inp, int inlen, void (*)(void *arg, const char *fmt, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ @@ -2135,9 +2135,9 @@ static const char* const eap_typenames[] = { "Cisco", "Nokia", "SRP" }; -static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, const char *, ...), void *arg) { +static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, const char *, ...), void *arg) { int code, id, len, rtype, vallen; - u_char *pstart; + const u_char *pstart; u32_t uval; if (inlen < EAP_HEADERLEN) diff --git a/src/netif/ppp/ecp.c b/src/netif/ppp/ecp.c index 43cbe970..4f1dee33 100644 --- a/src/netif/ppp/ecp.c +++ b/src/netif/ppp/ecp.c @@ -91,7 +91,7 @@ static void ecp_input (int unit, u_char *pkt, int len); static void ecp_protrej (int unit); */ #if PRINTPKT_SUPPORT -static int ecp_printpkt (u_char *pkt, int len, +static int ecp_printpkt (const u_char *pkt, int len, void (*printer) (void *, char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ @@ -179,7 +179,7 @@ ecp_init(unit) #if PRINTPKT_SUPPORT static int ecp_printpkt(p, plen, printer, arg) - u_char *p; + const u_char *p; int plen; void (*printer) (void *, char *, ...); void *arg; diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index b694c756..d19561ad 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -264,7 +264,7 @@ static void ipcp_lowerdown(ppp_pcb *pcb); static void ipcp_input(ppp_pcb *pcb, u_char *p, int len); static void ipcp_protrej(ppp_pcb *pcb); #if PRINTPKT_SUPPORT -static int ipcp_printpkt(u_char *p, int plen, +static int ipcp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ #if PPP_OPTIONS @@ -2226,10 +2226,10 @@ static const char* const ipcp_codenames[] = { "TermReq", "TermAck", "CodeRej" }; -static int ipcp_printpkt(u_char *p, int plen, +static int ipcp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { int code, id, len, olen; - u_char *pstart, *optend; + const u_char *pstart, *optend; #if VJ_SUPPORT u_short cishort; #endif /* VJ_SUPPORT */ diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c index ca0b1b57..48ad7271 100644 --- a/src/netif/ppp/ipv6cp.c +++ b/src/netif/ppp/ipv6cp.c @@ -264,7 +264,7 @@ static void ipv6_check_options(void); static int ipv6_demand_conf(int u); #endif /* DEMAND_SUPPORT */ #if PRINTPKT_SUPPORT -static int ipv6cp_printpkt(u_char *p, int plen, +static int ipv6cp_printpkt(const u_char *p, int plen, void (*printer)(void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ #if DEMAND_SUPPORT @@ -1398,10 +1398,10 @@ static const char* const ipv6cp_codenames[] = { "TermReq", "TermAck", "CodeRej" }; -static int ipv6cp_printpkt(u_char *p, int plen, +static int ipv6cp_printpkt(const u_char *p, int plen, void (*printer)(void *, const char *, ...), void *arg) { int code, id, len, olen; - u_char *pstart, *optend; + const u_char *pstart, *optend; #ifdef IPV6CP_COMP u_short cishort; #endif /* IPV6CP_COMP */ diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 8ccead06..572fa030 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -268,7 +268,7 @@ static void lcp_init(ppp_pcb *pcb); static void lcp_input(ppp_pcb *pcb, u_char *p, int len); static void lcp_protrej(ppp_pcb *pcb); #if PRINTPKT_SUPPORT -static int lcp_printpkt(u_char *p, int plen, +static int lcp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ @@ -2377,10 +2377,10 @@ static const char* const lcp_codenames[] = { "TimeRem" }; -static int lcp_printpkt(u_char *p, int plen, +static int lcp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { int code, id, len, olen, i; - u_char *pstart, *optend; + const u_char *pstart, *optend; u_short cishort; u32_t cilong; diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 756e711b..f1fece3b 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -86,7 +86,7 @@ static void upap_lowerdown(ppp_pcb *pcb); static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l); static void upap_protrej(ppp_pcb *pcb); #if PRINTPKT_SUPPORT -static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); +static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ const struct protent pap_protent = { @@ -599,11 +599,11 @@ static const char* const upap_codenames[] = { "AuthReq", "AuthAck", "AuthNak" }; -static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { +static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { int code, id, len; int mlen, ulen, wlen; char *user, *pwd, *msg; - u_char *pstart; + const u_char *pstart; if (plen < UPAP_HEADERLEN) return 0; diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index 4c14e36d..cf68e34d 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -73,7 +73,7 @@ static void ppp_logit(int level, const char *fmt, va_list args); static void ppp_log_write(int level, char *buf); #if PRINTPKT_SUPPORT static void ppp_vslp_printer(void *arg, const char *fmt, ...); -static void ppp_format_packet(u_char *p, int len, +static void ppp_format_packet(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); struct buffer_info { @@ -443,7 +443,7 @@ log_packet(p, len, prefix, level) * ppp_format_packet - make a readable representation of a packet, * calling `printer(arg, format, ...)' to output it. */ -static void ppp_format_packet(u_char *p, int len, +static void ppp_format_packet(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg) { int i, n; u_short proto;