From 086cd5dae628556ffaa2c2efe559a5bd2fba8d0e Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 20 Mar 2019 18:33:47 +0100 Subject: ipcpd: Restrict MTU for Ethernet over loopback This restricts the MTU for the Ethernet IPCP over loopback adapters (devices named "lo*") to avoid it allocating 65K buffers per packet and quickly filling the default RDRBUFF space. The restriction is set using the build option IPCP_ETH_LO_MTU, with a default value of 1500 bytes. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/eth/eth.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ipcpd/eth/eth.c') diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index 04130d6f..1a332272 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -1316,6 +1316,11 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) log_dbg("Device MTU is %d.", ifr.ifr_mtu); eth_data.mtu = MIN((int) ETH_MTU_MAX, ifr.ifr_mtu); + if (memcmp(conf->dev, "lo", 2) == 0 && eth_data.mtu > IPCP_ETH_LO_MTU) { + log_dbg("Using loopback interface. MTU restricted to %d.", + IPCP_ETH_LO_MTU); + eth_data.mtu = IPCP_ETH_LO_MTU; + } #ifndef SHM_RDRB_MULTI_BLOCK maxsz = SHM_RDRB_BLOCK_SIZE - 5 * sizeof(size_t) - -- cgit v1.2.3