Skip to content

Commit

Permalink
IO: Workaround for broken FreeBSD behavior
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
Ondrej Zajicek (work) committed Dec 18, 2018
1 parent 82b7425 commit c2d29dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sysdep/unix/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,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

Expand Down

0 comments on commit c2d29dd

Please sign in to comment.