diff --git a/src/include/netif/ppp/ccp.h b/src/include/netif/ppp/ccp.h index b5dee384..f106cb5d 100644 --- a/src/include/netif/ppp/ccp.h +++ b/src/include/netif/ppp/ccp.h @@ -52,6 +52,6 @@ extern ccp_options ccp_gotoptions[]; extern ccp_options ccp_allowoptions[]; extern ccp_options ccp_hisoptions[]; -extern struct protent ccp_protent; +extern const struct protent ccp_protent; #endif /* PPP_SUPPORT && CCP_SUPPORT */ diff --git a/src/include/netif/ppp/chap-new.h b/src/include/netif/ppp/chap-new.h index 2730a8cb..d84e9029 100644 --- a/src/include/netif/ppp/chap-new.h +++ b/src/include/netif/ppp/chap-new.h @@ -192,7 +192,7 @@ extern void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code); extern void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code); /* Represents the CHAP protocol to the main pppd code */ -extern struct protent chap_protent; +extern const struct protent chap_protent; #endif /* CHAP_H */ #endif /* PPP_SUPPORT && CHAP_SUPPORT */ diff --git a/src/include/netif/ppp/eap.h b/src/include/netif/ppp/eap.h index b96be43c..328046c1 100644 --- a/src/include/netif/ppp/eap.h +++ b/src/include/netif/ppp/eap.h @@ -157,7 +157,7 @@ typedef struct eap_state { void eap_authwithpeer(ppp_pcb *pcb, char *localname); void eap_authpeer(ppp_pcb *pcb, char *localname); -extern struct protent eap_protent; +extern const struct protent eap_protent; #ifdef __cplusplus } diff --git a/src/include/netif/ppp/ecp.h b/src/include/netif/ppp/ecp.h index d6887758..cba6678e 100644 --- a/src/include/netif/ppp/ecp.h +++ b/src/include/netif/ppp/ecp.h @@ -45,6 +45,6 @@ extern ecp_options ecp_gotoptions[]; extern ecp_options ecp_allowoptions[]; extern ecp_options ecp_hisoptions[]; -extern struct protent ecp_protent; +extern const struct protent ecp_protent; #endif /* PPP_SUPPORT && ECP_SUPPORT */ diff --git a/src/include/netif/ppp/ipcp.h b/src/include/netif/ppp/ipcp.h index 5b6f1006..b5f2334c 100644 --- a/src/include/netif/ppp/ipcp.h +++ b/src/include/netif/ppp/ipcp.h @@ -101,7 +101,7 @@ typedef struct ipcp_options { char *ip_ntoa (u32_t); #endif /* UNUSED, already defined by lwIP */ -extern struct protent ipcp_protent; +extern const struct protent ipcp_protent; #endif /* IPCP_H */ #endif /* PPP_SUPPORT */ diff --git a/src/include/netif/ppp/ipv6cp.h b/src/include/netif/ppp/ipv6cp.h index 8501d9c0..d6e28a8d 100644 --- a/src/include/netif/ppp/ipv6cp.h +++ b/src/include/netif/ppp/ipv6cp.h @@ -173,7 +173,7 @@ typedef struct ipv6cp_options { eui64_t ourid, hisid; /* Interface identifiers */ } ipv6cp_options; -extern struct protent ipv6cp_protent; +extern const struct protent ipv6cp_protent; #endif /* IPV6CP_H */ #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */ diff --git a/src/include/netif/ppp/lcp.h b/src/include/netif/ppp/lcp.h index 00a0f576..f832a4ee 100644 --- a/src/include/netif/ppp/lcp.h +++ b/src/include/netif/ppp/lcp.h @@ -164,7 +164,7 @@ void lcp_lowerup(ppp_pcb *pcb); void lcp_lowerdown(ppp_pcb *pcb); void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */ -extern struct protent lcp_protent; +extern const struct protent lcp_protent; /* Default number of times we receive our magic number from the peer before deciding the link is looped-back. */ diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index 61ed84c1..06d40b6b 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -295,7 +295,7 @@ struct protent { }; /* Table of pointers to supported protocols */ -extern struct protent *protocols[]; +extern const struct protent* const protocols[]; /* Values for auth_pending, auth_done */ diff --git a/src/include/netif/ppp/upap.h b/src/include/netif/ppp/upap.h index ca051411..3d1075b2 100644 --- a/src/include/netif/ppp/upap.h +++ b/src/include/netif/ppp/upap.h @@ -120,7 +120,7 @@ void upap_authwithpeer(ppp_pcb *pcb, char *user, char *password); void upap_authpeer(ppp_pcb *pcb); #endif /* PPP_SERVER */ -extern struct protent pap_protent; +extern const struct protent pap_protent; #endif /* UPAP_H */ #endif /* PPP_SUPPORT && PAP_SUPPORT */ diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 43f172c0..d1dc41f8 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -709,7 +709,7 @@ void link_down(ppp_pcb *pcb) { void upper_layers_down(ppp_pcb *pcb) { int i; - struct protent *protp; + const struct protent *protp; for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (!protp->enabled_flag) @@ -735,7 +735,7 @@ void link_established(ppp_pcb *pcb) { #endif /* PPP_SERVER */ lcp_options *ho = &pcb->lcp_hisoptions; int i; - struct protent *protp; + const struct protent *protp; #if PPP_SERVER int errcode; #endif /* PPP_SERVER */ @@ -908,7 +908,7 @@ static void network_phase(ppp_pcb *pcb) { void start_networks(ppp_pcb *pcb) { #if CCP_SUPPORT || ECP_SUPPORT int i; - struct protent *protp; + const struct protent *protp; #endif /* CCP_SUPPORT || ECP_SUPPORT */ #if ECP_SUPPORT int ecp_required; @@ -974,7 +974,7 @@ void start_networks(ppp_pcb *pcb) { void continue_networks(ppp_pcb *pcb) { int i; - struct protent *protp; + const struct protent *protp; /* * Start the "real" network protocols. diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c index 2117fcab..a5785329 100644 --- a/src/netif/ppp/ccp.c +++ b/src/netif/ppp/ccp.c @@ -180,7 +180,7 @@ static int ccp_printpkt (u_char *pkt, int len, #endif /* PRINTPKT_SUPPORT */ static void ccp_datainput (int unit, u_char *pkt, int len); -struct protent ccp_protent = { +const struct protent ccp_protent = { PPP_CCP, ccp_init, ccp_input, diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 1adf5576..ec5a3050 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -634,7 +634,7 @@ static int chap_print_pkt(unsigned char *p, int plen, } #endif /* PRINTPKT_SUPPORT */ -struct protent chap_protent = { +const struct protent chap_protent = { PPP_CHAP, chap_init, chap_input, diff --git a/src/netif/ppp/demand.c b/src/netif/ppp/demand.c index dbabfa90..f31a124c 100644 --- a/src/netif/ppp/demand.c +++ b/src/netif/ppp/demand.c @@ -83,7 +83,7 @@ void demand_conf() { int i; - struct protent *protp; + const struct protent *protp; /* framemax = lcp_allowoptions[0].mru; if (framemax < PPP_MRU) */ @@ -128,7 +128,7 @@ void demand_block() { int i; - struct protent *protp; + const struct protent *protp; for (i = 0; (protp = protocols[i]) != NULL; ++i) if (protp->enabled_flag && protp->demand_conf != NULL) @@ -145,7 +145,7 @@ demand_discard() { struct packet *pkt, *nextpkt; int i; - struct protent *protp; + const struct protent *protp; for (i = 0; (protp = protocols[i]) != NULL; ++i) if (protp->enabled_flag && protp->demand_conf != NULL) @@ -171,7 +171,7 @@ void demand_unblock() { int i; - struct protent *protp; + const struct protent *protp; for (i = 0; (protp = protocols[i]) != NULL; ++i) if (protp->enabled_flag && protp->demand_conf != NULL) @@ -436,7 +436,7 @@ active_packet(p, len) int len; { int proto, i; - struct protent *protp; + const struct protent *protp; if (len < PPP_HDRLEN) return 0; diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index f0df3d08..b3106ad3 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -111,7 +111,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*)(void *arg, char *fmt, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ -struct protent eap_protent = { +const struct protent eap_protent = { PPP_EAP, /* protocol number */ eap_init, /* initialization procedure */ eap_input, /* process a received packet */ diff --git a/src/netif/ppp/ecp.c b/src/netif/ppp/ecp.c index f2645055..dc7e3127 100644 --- a/src/netif/ppp/ecp.c +++ b/src/netif/ppp/ecp.c @@ -99,7 +99,7 @@ static int ecp_printpkt (u_char *pkt, int len, static void ecp_datainput (int unit, u_char *pkt, int len); */ -struct protent ecp_protent = { +const struct protent ecp_protent = { PPP_ECP, ecp_init, NULL, /* ecp_input, */ diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index ede4af8f..efb56a12 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -278,7 +278,7 @@ static int ip_active_pkt (u_char *, int); static void create_resolv (u32_t, u32_t); #endif /* UNUSED */ -struct protent ipcp_protent = { +const struct protent ipcp_protent = { PPP_IPCP, ipcp_init, ipcp_input, diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c index 5318e2ba..96142ce0 100644 --- a/src/netif/ppp/ipv6cp.c +++ b/src/netif/ppp/ipv6cp.c @@ -274,7 +274,7 @@ static int ipv6cp_printpkt(u_char *p, int plen, static int ipv6_active_pkt(u_char *pkt, int len); #endif /* PPP_DEMAND */ -struct protent ipv6cp_protent = { +const struct protent ipv6cp_protent = { PPP_IPV6CP, ipv6cp_init, ipv6cp_input, diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 2d01831f..03783b05 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -272,7 +272,7 @@ static int lcp_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ -struct protent lcp_protent = { +const struct protent lcp_protent = { PPP_LCP, lcp_init, lcp_input, @@ -592,7 +592,7 @@ static int lcp_extcode(fsm *f, int code, int id, u_char *inp, int len) { */ static void lcp_rprotrej(fsm *f, u_char *inp, int len) { int i; - struct protent *protp; + const struct protent *protp; u_short prot; #if PPP_PROTOCOLNAME const char *pname; diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index ba2cc443..bb7e7add 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -152,7 +152,7 @@ int link_stats_valid; * One entry per supported protocol. * The last entry must be NULL. */ -struct protent *protocols[] = { +const struct protent* const protocols[] = { &lcp_protent, #if PAP_SUPPORT &pap_protent, @@ -599,7 +599,7 @@ int ppp_delete(ppp_pcb *pcb) { /* Set a PPP PCB to its initial state */ static void ppp_clear(ppp_pcb *pcb) { - struct protent *protp; + const struct protent *protp; int i; LWIP_ASSERT("pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF", pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF); @@ -769,7 +769,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { default: { int i; - struct protent *protp; + const struct protent *protp; /* * Upcall the proper protocol input routine. */ diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 221b9c36..5e61a76c 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -89,7 +89,7 @@ static void upap_protrej(ppp_pcb *pcb); static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg); #endif /* PRINTPKT_SUPPORT */ -struct protent pap_protent = { +const struct protent pap_protent = { PPP_PAP, upap_init, upap_input, diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index f918ba07..c7a78c7c 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -455,7 +455,7 @@ static void ppp_format_packet(u_char *p, int len, void (*printer) (void *, char *, ...), void *arg) { int i, n; u_short proto; - struct protent *protp; + const struct protent *protp; if (len >= 2) { GETSHORT(proto, p);