diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-08 15:31:44 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-08 15:31:44 +0200 |
commit | a58e8743dad97758947470c7d72f5820955f9e82 (patch) | |
tree | acd2dc1445f6af9dfab0d3b3485a5068afadfd6b /src/ipcpd/eth | |
parent | e06cd0c186c1a7ead4778aa09de7db69c649f1a5 (diff) | |
parent | 22be1ea9cab402a921776a59ff9667bcb5e2c299 (diff) | |
download | ouroboros-a58e8743dad97758947470c7d72f5820955f9e82.tar.gz ouroboros-a58e8743dad97758947470c7d72f5820955f9e82.zip |
Merge branch 'testing' into be
Diffstat (limited to 'src/ipcpd/eth')
-rw-r--r-- | src/ipcpd/eth/eth.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index a58839f0..0bd1589d 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -840,7 +840,7 @@ static void * eth_ipcp_sdu_reader(void * o) if (select(eth_data.s_fd + 1, &fds, NULL, NULL, NULL) < 0) continue; assert(FD_ISSET(eth_data.s_fd, &fds)); - if (ipcp_sdb_reserve(&sdb, ETH_FRAME_SIZE)) + if (ipcp_sdb_reserve(&sdb, eth_data.mtu)) continue; buf = shm_du_buff_head(sdb); frame_len = recv(eth_data.s_fd, buf, ETH_FRAME_SIZE, 0); @@ -1180,6 +1180,9 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) #elif defined(__linux__) int skfd; #endif +#ifndef SHM_RDRB_MULTI_BLOCK + size_t maxsz; +#endif assert(conf); assert(conf->type == THIS_TYPE); @@ -1250,6 +1253,14 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) eth_data.mtu = MIN((int) ETH_MTU_MAX, ifr.ifr_mtu); +#ifndef SHM_RDRB_MULTI_BLOCK + maxsz = SHM_RDRB_BLOCK_SIZE - 5 * sizeof(size_t) - + (DU_BUFF_HEADSPACE + DU_BUFF_TAILSPACE); + if ((size_t) eth_data.mtu > maxsz ) { + log_dbg("Layer MTU truncated to shm block size."); + eth_data.mtu = maxsz; + } +#endif log_dbg("Layer MTU is %d.", eth_data.mtu); close(skfd); |