From aaa2e11810cfcb724a24154ee311cd9e702ba799 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 25 Jul 2013 11:36:40 +0200 Subject: Set IP_MTU_DISCOVER on sockets --- src/fastd.c | 8 ++++++++ src/fastd.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/fastd.c b/src/fastd.c index 43b0a0a..a142cb2 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -245,6 +245,14 @@ static int bind_socket(fastd_context_t *ctx, const fastd_bind_address_t *addr, b } } + if (ctx->conf->pmtu.set) { + int pmtu = ctx->conf->pmtu.state ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT; + if (setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, &pmtu, sizeof(pmtu))) { + pr_error_errno(ctx, "setsockopt: unable to set PMTU discovery"); + goto error; + } + } + fastd_peer_address_t bind_address = addr->addr; if (bind_address.sa.sa_family == AF_UNSPEC) { diff --git a/src/fastd.h b/src/fastd.h index 474fd1f..2e92013 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -195,6 +195,7 @@ struct fastd_config { fastd_mode_t mode; bool forward; + fastd_tristate_t pmtu; fastd_drop_caps_t drop_caps; -- cgit v1.2.3