summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-06-23 08:09:22 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-06-23 08:09:22 +0000
commit239f731c95edf28b02b2029d68ef6d50fe09cf65 (patch)
treefec8fdaad72b0228cd6ea70e71d344c07c80c427
parent68e1e785aff3ef6ebd2865074ac089e9020c3c29 (diff)
install host route for p2p interface even if there's connected net route
by broadcast interface. NetBSD PR 21903. markus ok
-rw-r--r--sys/netinet/in.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 70434d601f3..4960ee3ee2b 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.31 2003/06/02 23:28:13 millert Exp $ */
+/* $OpenBSD: in.c,v 1.32 2003/06/23 08:09:21 itojun Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -755,21 +755,20 @@ in_addprefix(target, flags)
if ((flags & RTF_HOST) != 0)
prefix = target->ia_dstaddr.sin_addr;
- else
+ else {
prefix = target->ia_addr.sin_addr;
- mask = target->ia_sockmask.sin_addr;
- prefix.s_addr &= mask.s_addr;
+ mask = target->ia_sockmask.sin_addr;
+ prefix.s_addr &= mask.s_addr;
+ }
for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) {
- /* easy one first */
- if (mask.s_addr != ia->ia_sockmask.sin_addr.s_addr)
- continue;
-
if (rtinitflags(ia))
p = ia->ia_dstaddr.sin_addr;
- else
+ else {
p = ia->ia_addr.sin_addr;
- p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
+ p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
+ }
+
if (prefix.s_addr != p.s_addr)
continue;
@@ -808,21 +807,20 @@ in_scrubprefix(target)
if (rtinitflags(target))
prefix = target->ia_dstaddr.sin_addr;
- else
+ else {
prefix = target->ia_addr.sin_addr;
- mask = target->ia_sockmask.sin_addr;
- prefix.s_addr &= mask.s_addr;
+ mask = target->ia_sockmask.sin_addr;
+ prefix.s_addr &= mask.s_addr;
+ }
for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) {
- /* easy one first */
- if (mask.s_addr != ia->ia_sockmask.sin_addr.s_addr)
- continue;
-
if (rtinitflags(ia))
p = ia->ia_dstaddr.sin_addr;
- else
+ else {
p = ia->ia_addr.sin_addr;
- p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
+ p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
+ }
+
if (prefix.s_addr != p.s_addr)
continue;