Commit c2d29dd1 authored by Ondřej Zajíček's avatar Ondřej Zajíček

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!
parent 82b74253
Pipeline #43482 passed with stages
in 4 minutes and 29 seconds
...@@ -1566,7 +1566,9 @@ sk_sendmsg(sock *s) ...@@ -1566,7 +1566,9 @@ sk_sendmsg(sock *s)
}; };
#ifdef CONFIG_DONTROUTE_UNICAST #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; flags = MSG_DONTROUTE;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment