From bef94be1817533fe0a7dd8f98599b6585cf6114b Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Mon, 26 Jan 2009 23:03:29 +0000 Subject: 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@ --- usr.sbin/ospfd/parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin/ospfd/parse.y') 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 @@ -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); -- cgit v1.2.3