summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/parse.y
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-01-26 23:03:29 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-01-26 23:03:29 +0000
commitbef94be1817533fe0a7dd8f98599b6585cf6114b (patch)
treeba7cc8d11a2a3dbebdd169076cf6024deadc5049 /usr.sbin/ospfd/parse.y
parent7312c3d09ee686b91278cfce37d2cd2a30a1f9b7 (diff)
First convert IP addresses to host-byte-order before checking which one is
smaller. Additionally fix the check to find the lowest configured IP as suggested by the RFC. Found with stsp@
Diffstat (limited to 'usr.sbin/ospfd/parse.y')
-rw-r--r--usr.sbin/ospfd/parse.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 4c9e688c0f1..9631da31344 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.64 2009/01/07 21:16:36 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.65 2009/01/26 23:03:28 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -1208,7 +1208,7 @@ get_rtr_id(void)
cur = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
if ((cur & localnet) == localnet) /* skip 127/8 */
continue;
- if (cur > ip || ip == 0)
+ if (ntohl(cur) < ntohl(ip) || ip == 0)
ip = cur;
}
freeifaddrs(ifap);