mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
PPP: more const and mixed u_char/char types fixes
This commit is contained in:
parent
e8c0ba2a47
commit
83cddd8941
@ -214,7 +214,7 @@ pppapi_do_pppol2tp_create(struct pppapi_msg_msg *msg)
|
||||
*/
|
||||
ppp_pcb*
|
||||
pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
|
||||
u8_t *secret, u8_t secret_len,
|
||||
const u8_t *secret, u8_t secret_len,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb)
|
||||
{
|
||||
struct pppapi_msg msg;
|
||||
|
@ -85,7 +85,7 @@ struct pppapi_msg_msg {
|
||||
ip_addr_t *ipaddr;
|
||||
u16_t port;
|
||||
#if PPPOL2TP_AUTH_SUPPORT
|
||||
u8_t *secret;
|
||||
const u8_t *secret;
|
||||
u8_t secret_len;
|
||||
#endif /* PPPOL2TP_AUTH_SUPPORT */
|
||||
ppp_link_status_cb_fn link_status_cb;
|
||||
@ -131,7 +131,7 @@ ppp_pcb *pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const cha
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
#if PPPOL2TP_SUPPORT
|
||||
ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
|
||||
u8_t *secret, u8_t secret_len,
|
||||
const u8_t *secret, u8_t secret_len,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||
#endif /* PPPOL2TP_SUPPORT */
|
||||
err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
|
||||
|
@ -607,7 +607,7 @@ int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
|
||||
#endif
|
||||
|
||||
/* Procedures exported from utils.c. */
|
||||
void ppp_print_string(char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
|
||||
void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
|
||||
int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
|
||||
int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args); /* vsprintf++ */
|
||||
size_t ppp_strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */
|
||||
|
@ -169,7 +169,7 @@ struct pppol2tp_pcb_s {
|
||||
ip_addr_t remote_ip; /* LNS IP Address */
|
||||
u16_t remote_port; /* LNS port */
|
||||
#if PPPOL2TP_AUTH_SUPPORT
|
||||
u8_t *secret; /* Secret string */
|
||||
const u8_t *secret; /* Secret string */
|
||||
u8_t secret_len; /* Secret string length */
|
||||
u8_t secret_rv[16]; /* Random vector */
|
||||
u8_t challenge_hash[16]; /* Challenge response */
|
||||
@ -194,7 +194,7 @@ struct pppol2tp_pcb_s {
|
||||
/* Create a new L2TP session. */
|
||||
ppp_pcb *pppol2tp_create(struct netif *pppif,
|
||||
struct netif *netif, ip_addr_t *ipaddr, u16_t port,
|
||||
u8_t *secret, u8_t secret_len,
|
||||
const u8_t *secret, u8_t secret_len,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||
|
||||
#endif /* PPPOL2TP_H_ */
|
||||
|
@ -1628,7 +1628,7 @@ static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, cons
|
||||
case TERMACK:
|
||||
case TERMREQ:
|
||||
if (len > 0 && *p >= ' ' && *p < 0x7f) {
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
p += len;
|
||||
len = 0;
|
||||
}
|
||||
|
@ -626,12 +626,12 @@ static int chap_print_pkt(const unsigned char *p, int plen,
|
||||
printer(arg, "%.2x", x);
|
||||
}
|
||||
printer(arg, ">, name = ");
|
||||
ppp_print_string((char *)p, nlen, printer, arg);
|
||||
ppp_print_string(p, nlen, printer, arg);
|
||||
break;
|
||||
case CHAP_FAILURE:
|
||||
case CHAP_SUCCESS:
|
||||
printer(arg, " ");
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
break;
|
||||
default:
|
||||
for (clen = len; clen > 0; --clen) {
|
||||
|
@ -1019,7 +1019,7 @@ static void eap_protrej(ppp_pcb *pcb) {
|
||||
/*
|
||||
* Format and send a regular EAP Response message.
|
||||
*/
|
||||
static void eap_send_response(ppp_pcb *pcb, u_char id, u_char typenum, u_char *str, int lenstr) {
|
||||
static void eap_send_response(ppp_pcb *pcb, u_char id, u_char typenum, const u_char *str, int lenstr) {
|
||||
struct pbuf *p;
|
||||
u_char *outp;
|
||||
int msglen;
|
||||
@ -1388,7 +1388,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) {
|
||||
pcb->eap.es_usedpseudo = 2;
|
||||
}
|
||||
#endif /* USE_SRP */
|
||||
eap_send_response(pcb, id, typenum, (u_char*)pcb->eap.es_client.ea_name,
|
||||
eap_send_response(pcb, id, typenum, (const u_char*)pcb->eap.es_client.ea_name,
|
||||
pcb->eap.es_client.ea_namelen);
|
||||
break;
|
||||
|
||||
@ -2173,7 +2173,7 @@ static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, c
|
||||
case EAPT_NOTIFICATION:
|
||||
if (len > 0) {
|
||||
printer(arg, " <Message ");
|
||||
ppp_print_string((char *)inp, len, printer, arg);
|
||||
ppp_print_string(inp, len, printer, arg);
|
||||
printer(arg, ">");
|
||||
INCPTR(len, inp);
|
||||
len = 0;
|
||||
@ -2194,7 +2194,7 @@ static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, c
|
||||
len -= vallen;
|
||||
if (len > 0) {
|
||||
printer(arg, " <Name ");
|
||||
ppp_print_string((char *)inp, len, printer, arg);
|
||||
ppp_print_string(inp, len, printer, arg);
|
||||
printer(arg, ">");
|
||||
INCPTR(len, inp);
|
||||
len = 0;
|
||||
@ -2217,7 +2217,7 @@ static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, c
|
||||
goto truncated;
|
||||
if (vallen > 0) {
|
||||
printer(arg, " <Name ");
|
||||
ppp_print_string((char *)inp, vallen, printer,
|
||||
ppp_print_string(inp, vallen, printer,
|
||||
arg);
|
||||
printer(arg, ">");
|
||||
} else {
|
||||
@ -2311,7 +2311,7 @@ static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, c
|
||||
case EAPT_IDENTITY:
|
||||
if (len > 0) {
|
||||
printer(arg, " <Name ");
|
||||
ppp_print_string((char *)inp, len, printer, arg);
|
||||
ppp_print_string(inp, len, printer, arg);
|
||||
printer(arg, ">");
|
||||
INCPTR(len, inp);
|
||||
len = 0;
|
||||
@ -2346,7 +2346,7 @@ static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, c
|
||||
len -= vallen;
|
||||
if (len > 0) {
|
||||
printer(arg, " <Name ");
|
||||
ppp_print_string((char *)inp, len, printer, arg);
|
||||
ppp_print_string(inp, len, printer, arg);
|
||||
printer(arg, ">");
|
||||
INCPTR(len, inp);
|
||||
len = 0;
|
||||
|
@ -2334,7 +2334,7 @@ static int ipcp_printpkt(const u_char *p, int plen,
|
||||
case TERMREQ:
|
||||
if (len > 0 && *p >= ' ' && *p < 0x7f) {
|
||||
printer(arg, " ");
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
p += len;
|
||||
len = 0;
|
||||
}
|
||||
|
@ -1471,7 +1471,7 @@ static int ipv6cp_printpkt(const u_char *p, int plen,
|
||||
case TERMREQ:
|
||||
if (len > 0 && *p >= ' ' && *p < 0x7f) {
|
||||
printer(arg, " ");
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
p += len;
|
||||
len = 0;
|
||||
}
|
||||
|
@ -2573,7 +2573,7 @@ static int lcp_printpkt(const u_char *p, int plen,
|
||||
case TERMREQ:
|
||||
if (len > 0 && *p >= ' ' && *p < 0x7f) {
|
||||
printer(arg, " ");
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
p += len;
|
||||
len = 0;
|
||||
}
|
||||
@ -2605,7 +2605,7 @@ static int lcp_printpkt(const u_char *p, int plen,
|
||||
}
|
||||
if (len > 0) {
|
||||
printer(arg, " ");
|
||||
ppp_print_string((char *)p, len, printer, arg);
|
||||
ppp_print_string(p, len, printer, arg);
|
||||
p += len;
|
||||
len = 0;
|
||||
}
|
||||
|
@ -115,9 +115,9 @@ void
|
||||
mppe_init(ppp_pcb *pcb, ppp_mppe_state *state, u8_t options)
|
||||
{
|
||||
#if PPP_DEBUG
|
||||
const u8_t *debugstr = (u8_t*)"mppe_comp_init";
|
||||
const u8_t *debugstr = (const u8_t*)"mppe_comp_init";
|
||||
if (&pcb->mppe_decomp == state) {
|
||||
debugstr = (u8_t*)"mppe_decomp_init";
|
||||
debugstr = (const u8_t*)"mppe_decomp_init";
|
||||
}
|
||||
#endif /* PPP_DEBUG */
|
||||
|
||||
|
@ -114,7 +114,7 @@ static const struct link_callbacks pppol2tp_callbacks = {
|
||||
/* Create a new L2TP session. */
|
||||
ppp_pcb *pppol2tp_create(struct netif *pppif,
|
||||
struct netif *netif, ip_addr_t *ipaddr, u16_t port,
|
||||
u8_t *secret, u8_t secret_len,
|
||||
const u8_t *secret, u8_t secret_len,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
|
||||
ppp_pcb *ppp;
|
||||
pppol2tp_pcb *l2tp;
|
||||
|
@ -602,7 +602,7 @@ static const char* const upap_codenames[] = {
|
||||
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;
|
||||
const u_char *user, *pwd, *msg;
|
||||
const u_char *pstart;
|
||||
|
||||
if (plen < UPAP_HEADERLEN)
|
||||
@ -630,8 +630,8 @@ static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, con
|
||||
wlen = p[ulen + 1];
|
||||
if (len < ulen + wlen + 2)
|
||||
break;
|
||||
user = (char *) (p + 1);
|
||||
pwd = (char *) (p + ulen + 2);
|
||||
user = (const u_char *) (p + 1);
|
||||
pwd = (const u_char *) (p + ulen + 2);
|
||||
p += ulen + wlen + 2;
|
||||
len -= ulen + wlen + 2;
|
||||
printer(arg, " user=");
|
||||
@ -654,7 +654,7 @@ static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, con
|
||||
mlen = p[0];
|
||||
if (len < mlen + 1)
|
||||
break;
|
||||
msg = (char *) (p + 1);
|
||||
msg = (const u_char *) (p + 1);
|
||||
p += mlen + 1;
|
||||
len -= mlen + 1;
|
||||
printer(arg, " ");
|
||||
|
@ -569,7 +569,7 @@ pr_log (void *arg, const char *fmt, ...)
|
||||
* ppp_print_string - print a readable representation of a string using
|
||||
* printer.
|
||||
*/
|
||||
void ppp_print_string(char *p, int len, void (*printer) (void *, const char *, ...), void *arg) {
|
||||
void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg) {
|
||||
int c;
|
||||
|
||||
printer(arg, "\"");
|
||||
|
Loading…
x
Reference in New Issue
Block a user