diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-07-28 16:54:06 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-07-28 16:54:06 +0200 |
commit | 318acb0f6cb77a32aad5d7f79e06f3c5065ac702 (patch) | |
tree | 4dba6f78145f0fcb65c228bbc7e3ad1559e4a6a3 /lib/ip.h | |
parent | 0ed3129f6b0a80afea877340d940e45f1a5d3000 (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/ip.h')
-rw-r--r-- | lib/ip.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -241,6 +241,9 @@ static inline int ip6_is_v4mapped(ip6_addr a) #define ipa_classify(x) ip6_classify(&(x)) #define ipa_is_link_local(x) ip6_is_link_local(x) +static inline int ip4_is_unicast(ip4_addr a) +{ return _I(a) < 0xe0000000; } + /* XXXX remove */ static inline int ipa_classify_net(ip_addr a) { return ipa_zero2(a) ? (IADDR_HOST | SCOPE_UNIVERSE) : ipa_classify(a); } |