summaryrefslogtreecommitdiff
path: root/nest/neighbor.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2015-12-07 16:24:18 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-12-18 20:03:47 +0100
commit9b136840d90cce887cd139054c3f0a7d8b9f57d2 (patch)
tree3f49dd4025a884b10f6adf907d2fa6eec40bf11d /nest/neighbor.c
parent04ae8ddaa15b72c265dc7cf038b733d235198754 (diff)
Netlink and BSD: Integrating IPv4 and IPv6
Squashing and minor changes by Ondrej Santiago Zajicek
Diffstat (limited to 'nest/neighbor.c')
-rw-r--r--nest/neighbor.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nest/neighbor.c b/nest/neighbor.c
index b8832f2f..14a6b113 100644
--- a/nest/neighbor.c
+++ b/nest/neighbor.c
@@ -81,15 +81,15 @@ if_connected(ip_addr *a, struct iface *i, struct ifa **ap)
{
if (ipa_in_netX(*a, &b->prefix))
{
-#ifndef IPV6
- if ((b->pxlen < (BITS_PER_IP_ADDRESS - 1)) &&
- (ipa_equal(*a, b->prefix) || /* Network address */
+ /* Do not allow IPv4 network and broadcast addresses */
+ if (ipa_is_ip4(*a) &&
+ (net_pxlen(&b->prefix) < (BITS_PER_IP_ADDRESS - 1)) &&
+ (ipa_equal(*a, net_prefix(&b->prefix)) || /* Network address */
ipa_equal(*a, b->brd))) /* Broadcast */
{
*ap = NULL;
return -1;
}
-#endif
return b->scope;
}