diff options
-rw-r--r-- | src/ipcpd/config.h.in | 1 | ||||
-rw-r--r-- | src/ipcpd/eth/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/ipcpd/eth/eth.c | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in index 8545021b..e050d656 100644 --- a/src/ipcpd/config.h.in +++ b/src/ipcpd/config.h.in @@ -65,3 +65,4 @@ #cmakedefine IPCP_ETH_QDISC_BYPASS #define IPCP_ETH_RD_THR @IPCP_ETH_RD_THR@ #define IPCP_ETH_WR_THR @IPCP_ETH_WR_THR@ +#define IPCP_ETH_LO_MTU @IPCP_ETH_LO_MTU@ diff --git a/src/ipcpd/eth/CMakeLists.txt b/src/ipcpd/eth/CMakeLists.txt index abffbb2d..89575b6b 100644 --- a/src/ipcpd/eth/CMakeLists.txt +++ b/src/ipcpd/eth/CMakeLists.txt @@ -84,6 +84,8 @@ if (HAVE_ETH) "Number of writer threads in Ethernet IPCP") set(IPCP_ETH_QDISC_BYPASS false CACHE BOOL "Bypass the Qdisc in the kernel when using raw sockets") + set(IPCP_ETH_LO_MTU 1500 CACHE STRING + "Restrict Ethernet MTU over loopback interfaces") set(ETH_LLC_SOURCES # Add source files here 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) - |