PPP: rename netif_set/get_mtu to ppp_netif_set/get_mtu

Those are private functions, using the netif_ prefix here is not really
nice, especially with functions named netif_set_mtu and netif_get_mtu
for obvious reasons.
This commit is contained in:
Sylvain Rochet 2020-10-18 21:11:33 +02:00
parent 7633c24213
commit 331fe2dea2
6 changed files with 19 additions and 18 deletions

View File

@ -450,8 +450,8 @@ int sif6down (ppp_pcb *pcb);
int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode);
#endif /* DEMAND_SUPPORt */
void netif_set_mtu(ppp_pcb *pcb, int mtu);
int netif_get_mtu(ppp_pcb *pcb);
void ppp_netif_set_mtu(ppp_pcb *pcb, int mtu);
int ppp_netif_get_mtu(ppp_pcb *pcb);
#if CCP_SUPPORT
#if 0 /* unused */

View File

@ -1213,9 +1213,9 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
* because MPPE frames **grow**. The kernel [must]
* allocate MPPE_PAD extra bytes in xmit buffers.
*/
mtu = netif_get_mtu(pcb);
mtu = ppp_netif_get_mtu(pcb);
if (mtu)
netif_set_mtu(pcb, mtu - MPPE_PAD);
ppp_netif_set_mtu(pcb, mtu - MPPE_PAD);
else
newret = CONFREJ;
}

View File

@ -98,7 +98,7 @@ demand_conf()
flush_flag = 0;
fcs = PPP_INITFCS;
netif_set_mtu(pcb, LWIP_MIN(lcp_allowoptions[0].mru, PPP_MRU));
ppp_netif_set_mtu(pcb, LWIP_MIN(lcp_allowoptions[0].mru, PPP_MRU));
if (ppp_send_config(pcb, PPP_MRU, (u32_t) 0, 0, 0) < 0
|| ppp_recv_config(pcb, PPP_MRU, (u32_t) 0, 0, 0) < 0)
fatal("Couldn't set up demand-dialled PPP interface: %m");

View File

@ -2314,7 +2314,7 @@ static void lcp_up(fsm *f) {
#ifdef HAVE_MULTILINK
if (!(multilink && go->neg_mrru && ho->neg_mrru))
#endif /* HAVE_MULTILINK */
netif_set_mtu(pcb, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
ppp_netif_set_mtu(pcb, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
ppp_send_config(pcb, mtu,
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
ho->neg_pcompression, ho->neg_accompression);

View File

@ -148,12 +148,12 @@ mp_join_bundle()
if (demand) {
/* already have a bundle */
cfg_bundle(0, 0, 0, 0);
netif_set_mtu(pcb, mtu);
ppp_netif_set_mtu(pcb, mtu);
return 0;
}
make_new_bundle(0, 0, 0, 0);
set_ifunit(1);
netif_set_mtu(pcb, mtu);
ppp_netif_set_mtu(pcb, mtu);
return 0;
}
@ -198,7 +198,7 @@ mp_join_bundle()
mtu = LWIP_MIN(ho->mrru, ao->mru);
if (demand) {
cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
netif_set_mtu(pcb, mtu);
ppp_netif_set_mtu(pcb, mtu);
script_setenv("BUNDLE", bundle_id + 7, 1);
return 0;
}
@ -245,7 +245,7 @@ mp_join_bundle()
/* we have to make a new bundle */
make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
set_ifunit(1);
netif_set_mtu(pcb, mtu);
ppp_netif_set_mtu(pcb, mtu);
script_setenv("BUNDLE", bundle_id + 7, 1);
make_bundle_links(pcb);
unlock_db();

View File

@ -1031,13 +1031,13 @@ void new_phase(ppp_pcb *pcb, int p) {
*/
int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp) {
LWIP_UNUSED_ARG(mtu);
/* pcb->mtu = mtu; -- set correctly with netif_set_mtu */
PPPDEBUG(LOG_INFO, ("ppp_send_config[%d]\n", pcb->netif->num));
if (pcb->link_cb->send_config) {
pcb->link_cb->send_config(pcb, pcb->link_ctx_cb, accm, pcomp, accomp);
}
PPPDEBUG(LOG_INFO, ("ppp_send_config[%d]\n", pcb->netif->num) );
return 0;
}
@ -1048,11 +1048,12 @@ int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp) {
int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp) {
LWIP_UNUSED_ARG(mru);
PPPDEBUG(LOG_INFO, ("ppp_recv_config[%d]\n", pcb->netif->num));
if (pcb->link_cb->recv_config) {
pcb->link_cb->recv_config(pcb, pcb->link_ctx_cb, accm, pcomp, accomp);
}
PPPDEBUG(LOG_INFO, ("ppp_recv_config[%d]\n", pcb->netif->num));
return 0;
}
@ -1317,18 +1318,18 @@ int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode) {
#endif /* DEMAND_SUPPORT */
/*
* netif_set_mtu - set the MTU on the PPP network interface.
* ppp_netif_set_mtu - set the MTU on the PPP network interface.
*/
void netif_set_mtu(ppp_pcb *pcb, int mtu) {
void ppp_netif_set_mtu(ppp_pcb *pcb, int mtu) {
pcb->netif->mtu = mtu;
PPPDEBUG(LOG_INFO, ("netif_set_mtu[%d]: mtu=%d\n", pcb->netif->num, mtu));
PPPDEBUG(LOG_INFO, ("ppp_netif_set_mtu[%d]: mtu=%d\n", pcb->netif->num, mtu));
}
/*
* netif_get_mtu - get PPP interface MTU
* ppp_netif_get_mtu - get PPP interface MTU
*/
int netif_get_mtu(ppp_pcb *pcb) {
int ppp_netif_get_mtu(ppp_pcb *pcb) {
return pcb->netif->mtu;
}