diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-12 21:23:34 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-12 21:23:34 +0100 |
commit | c34cf1122f107769bc6b18aa78be87b8ec4e20f5 (patch) | |
tree | 5a0645aa015f4f7eb3133c06dd7ae82c2e1ee78a /src/handshake.c | |
parent | f4aa0157048c945bc8d54e87946909dd496c85cb (diff) | |
download | fastd-c34cf1122f107769bc6b18aa78be87b8ec4e20f5.tar fastd-c34cf1122f107769bc6b18aa78be87b8ec4e20f5.zip |
Make MTU mismatches fatal
As fastd calculates its receive buffer sizes based on the MTU, not matching MTUs
is bound to cause issues anyways, so let's fail completely.
Diffstat (limited to 'src/handshake.c')
-rw-r--r-- | src/handshake.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/handshake.c b/src/handshake.c index f66282c..2c22655 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -243,6 +243,10 @@ static void print_error(const char *prefix, const fastd_peer_address_t *remote_a pr_warn("Handshake with %I failed: %s error: TUN/TAP mode mismatch", remote_addr, prefix); break; + case RECORD_MTU: + pr_warn("Handshake with %I failed: %s error: MTU configuration differs with peer (local MTU is %u)", remote_addr, prefix, conf.mtu); + break; + case RECORD_METHOD_NAME: case RECORD_METHOD_LIST: pr_warn("Handshake with %I failed: %s error: no common methods are configured", remote_addr, prefix); @@ -364,8 +368,8 @@ static inline bool check_records(fastd_socket_t *sock, const fastd_peer_address_ if (!conf.secure_handshakes || handshake->type > 1) { if (handshake->records[RECORD_MTU].length == 2) { if (as_uint16_endian(&handshake->records[RECORD_MTU], handshake->little_endian) != conf.mtu) { - pr_warn("MTU configuration differs with peer %I: local MTU is %u, remote MTU is %u", - remote_addr, conf.mtu, as_uint16_endian(&handshake->records[RECORD_MTU], handshake->little_endian)); + send_error(sock, local_addr, remote_addr, peer, handshake, REPLY_UNACCEPTABLE_VALUE, RECORD_MTU); + return false; } } } |