summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-07-28 16:54:06 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-07-28 19:30:56 +0200
commit6be71641ef3baa8658d031f3624f4481b493bdaf (patch)
tree4d2064ba61b1460bad4aa47a820e99ced14976b9 /lib
parent3140c8b2ca48263da1a1f12b478031dc4b572db7 (diff)
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).
Diffstat (limited to 'lib')
-rw-r--r--lib/ip.h3
1 files changed, 3 insertions, 0 deletions
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); }