summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:30:44 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:30:44 +0000
commit8c7a3088998986abf4031885c3eb9c737d045994 (patch)
tree8e4b6cd47c6f81037bf94bb0ccd78bf64e0d2554 /usr.sbin
parentc89c83c8fedacbd911a22a9687d630f7fe5c6d8e (diff)
Fix router-id selection if static router-id is not given.
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. Pulled from ospfd. Original author: claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldpd/parse.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y
index faf8414fd74..ac54e52d742 100644
--- a/usr.sbin/ldpd/parse.y
+++ b/usr.sbin/ldpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.32 2016/05/23 15:28:39 renato Exp $ */
+/* $OpenBSD: parse.y,v 1.33 2016/05/23 15:30:43 renato Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -1310,7 +1310,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);