0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-10 05:08:42 +00:00

IO: Workaround for broken FreeBSD behavior

FreeBSD silently changes TTL to 1 when MSG_DONTROUTE is used, even when
it is explicitly set to another value. That breaks TTL security sockets,
including BFD which always uses TTL 255. Bad FreeBSD!
This commit is contained in:
Ondrej Zajicek (work) 2018-12-19 18:10:39 +01:00
parent c0ed32ee28
commit 04edf8f2f2

View File

@ -1614,7 +1614,9 @@ sk_sendmsg(sock *s)
};
#ifdef CONFIG_DONTROUTE_UNICAST
if (ipa_is_ip4(s->daddr) && ip4_is_unicast(ipa_to_ip4(s->daddr)))
/* FreeBSD silently changes TTL to 1 when MSG_DONTROUTE is used, therefore we
cannot use it for other cases (e.g. when TTL security is used). */
if (ipa_is_ip4(s->daddr) && ip4_is_unicast(ipa_to_ip4(s->daddr)) && (s->ttl == 1))
flags = MSG_DONTROUTE;
#endif