From 6be71641ef3baa8658d031f3624f4481b493bdaf Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Sat, 28 Jul 2018 16:54:06 +0200 Subject: BSD: Use MSG_DONTROUTE for unicast packets on FreeBSD BSD systems cannot use SO_DONTROUTE, because it does not work properly with multicast packets (perhaps it tries to find iface based on multicast group address). But we can use MSG_DONTROUTE sendmsg() flag for unicast packets. Works on FreeBSD, is ignored on OpenBSD and is broken on NetBSD (i guess due to integrated routing table and ARP table). --- lib/ip.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/ip.h') diff --git a/lib/ip.h b/lib/ip.h index 298b72a7..d876a707 100644 --- a/lib/ip.h +++ b/lib/ip.h @@ -309,6 +309,9 @@ static inline int ip6_is_v4mapped(ip6_addr a) #define ipa_is_link_local(x) 0 #endif +static inline int ip4_is_unicast(ip4_addr a) +{ return _I(a) < 0xe0000000; } + static inline int ipa_classify_net(ip_addr a) { return ipa_zero2(a) ? (IADDR_HOST | SCOPE_UNIVERSE) : ipa_classify(a); } -- cgit v1.2.3