mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-12 01:14:41 +08:00
added MTU support (using MRU from the peer)
This commit is contained in:
parent
2e227f868b
commit
6f21f48937
@ -1088,7 +1088,7 @@ static err_t ppp_netif_init_cb(struct netif *netif) {
|
|||||||
netif->name[0] = 'p';
|
netif->name[0] = 'p';
|
||||||
netif->name[1] = 'p';
|
netif->name[1] = 'p';
|
||||||
netif->output = ppp_netif_output;
|
netif->output = ppp_netif_output;
|
||||||
netif->mtu = ppp_mtu((int)(size_t)netif->state);
|
netif->mtu = netif_get_mtu((int)(size_t)netif->state);
|
||||||
netif->flags = NETIF_FLAG_POINTTOPOINT | NETIF_FLAG_LINK_UP;
|
netif->flags = NETIF_FLAG_POINTTOPOINT | NETIF_FLAG_LINK_UP;
|
||||||
#if LWIP_NETIF_HOSTNAME
|
#if LWIP_NETIF_HOSTNAME
|
||||||
/* @todo: Initialize interface hostname */
|
/* @todo: Initialize interface hostname */
|
||||||
@ -1381,24 +1381,6 @@ static err_t ppp_netif_output_over_ethernet(int pd, struct pbuf *p) {
|
|||||||
#endif /* PPPOE_SUPPORT */
|
#endif /* PPPOE_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the Maximum Transmission Unit for the given PPP connection.
|
|
||||||
*/
|
|
||||||
u_short ppp_mtu(int pd) {
|
|
||||||
ppp_control *pc = &ppp_control_list[pd];
|
|
||||||
u_short st;
|
|
||||||
|
|
||||||
/* Validate parameters. */
|
|
||||||
if (pd < 0 || pd >= NUM_PPP || !pc->open_flag) {
|
|
||||||
st = 0;
|
|
||||||
} else {
|
|
||||||
st = pc->mtu;
|
|
||||||
}
|
|
||||||
|
|
||||||
return st;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Get and set parameters for the given connection.
|
/* Get and set parameters for the given connection.
|
||||||
* Return 0 on success, an error code on failure. */
|
* Return 0 on success, an error code on failure. */
|
||||||
int
|
int
|
||||||
@ -1976,7 +1958,7 @@ int ppp_send_config(int unit, int mtu, u_int32_t accm, int pcomp, int accomp) {
|
|||||||
int i;
|
int i;
|
||||||
#endif /* PPPOS_SUPPORT */
|
#endif /* PPPOS_SUPPORT */
|
||||||
|
|
||||||
pc->mtu = mtu;
|
/* pc->mtu = mtu; -- set correctly with netif_set_mtu */
|
||||||
pc->pcomp = pcomp;
|
pc->pcomp = pcomp;
|
||||||
pc->accomp = accomp;
|
pc->accomp = accomp;
|
||||||
|
|
||||||
@ -2190,14 +2172,26 @@ int sifnpmode(int u, int proto, enum NPmode mode) {
|
|||||||
* netif_set_mtu - set the MTU on the PPP network interface.
|
* netif_set_mtu - set the MTU on the PPP network interface.
|
||||||
*/
|
*/
|
||||||
void netif_set_mtu(int unit, int mtu) {
|
void netif_set_mtu(int unit, int mtu) {
|
||||||
/* FIXME: set lwIP MTU */
|
ppp_control *pc = &ppp_control_list[unit];
|
||||||
|
|
||||||
|
/* Validate parameters. */
|
||||||
|
if (unit < 0 || unit >= NUM_PPP || !pc->open_flag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pc->mtu = mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* netif_get_mtu - get PPP interface MTU
|
* netif_get_mtu - get PPP interface MTU
|
||||||
*/
|
*/
|
||||||
int netif_get_mtu(int mtu) {
|
int netif_get_mtu(int unit) {
|
||||||
/* FIXME: get lwIP MTU */
|
ppp_control *pc = &ppp_control_list[unit];
|
||||||
return 1492;
|
|
||||||
|
/* Validate parameters. */
|
||||||
|
if (unit < 0 || unit >= NUM_PPP || !pc->open_flag)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return pc->mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
@ -176,12 +176,6 @@ void ppp_sighup(int pd);
|
|||||||
*/
|
*/
|
||||||
int ppp_ioctl(int pd, int cmd, void *arg);
|
int ppp_ioctl(int pd, int cmd, void *arg);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the Maximum Transmission Unit for the given PPP connection.
|
|
||||||
*/
|
|
||||||
/* FIXME: demystify MTU support */
|
|
||||||
u_short ppp_mtu(int pd);
|
|
||||||
|
|
||||||
#if PPPOS_SUPPORT && !PPP_INPROC_OWNTHREAD
|
#if PPPOS_SUPPORT && !PPP_INPROC_OWNTHREAD
|
||||||
/*
|
/*
|
||||||
* PPP over Serial: this is the input function to be called for received data.
|
* PPP over Serial: this is the input function to be called for received data.
|
||||||
|
@ -493,7 +493,7 @@ int sifdown (int u);
|
|||||||
int sifnpmode(int u, int proto, enum NPmode mode);
|
int sifnpmode(int u, int proto, enum NPmode mode);
|
||||||
|
|
||||||
void netif_set_mtu(int unit, int mtu);
|
void netif_set_mtu(int unit, int mtu);
|
||||||
int netif_get_mtu(int mtu);
|
int netif_get_mtu(int unit);
|
||||||
|
|
||||||
int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace);
|
int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace);
|
||||||
int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway);
|
int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user