@
bclerdx 不清楚 WEB UI 上的逻辑,以及是否真的能强制修改,我也没改过。 pppoe 接口会根据绑定的 wan 口的 mtu 来重新计算自己的 mtu :
static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
int sockaddr_len, int flags)
{
..........................
po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2; // 1500 (wan)- 6(pppoe 头) - 2(ppp 头) =1492
..........................
}
然后修改 pppoe 口的 handler 是空的,注释上说了这是一个坏注意,需要 ppp 层重新 LCP 协商,因为 ppp 是套在 pppoe 外面的只修改 pppoe 的 mtu 对 ppp 层不可见。
static int pppoe_device_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
/* Only look at sockets that are using this specific device. */
switch (event) {
case NETDEV_CHANGEADDR:
case NETDEV_CHANGEMTU:
/* A change in mtu or address is a bad thing, requiring
* LCP re-negotiation.
*/
case NETDEV_GOING_DOWN:
case NETDEV_DOWN:
/* Find every socket on this device and kill it. */
pppoe_flush_dev(dev);
break;
default:
break;
}
return NOTIFY_DONE;
}