From 8e654069714b571c96cf1a22c66a7af2dcfe2946 Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 30 Aug 2021 11:09:58 +0000 Subject: [PATCH] INADDR_LOOPBACK check needs htonl(3) to work Found in resolvd(8) which uses the same code. --- sbin/unwind/resolver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c index a047c72cca0..502a27cb35c 100644 --- a/sbin/unwind/resolver.c +++ b/sbin/unwind/resolver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolver.c,v 1.147 2021/08/14 07:40:02 florian Exp $ */ +/* $OpenBSD: resolver.c,v 1.148 2021/08/30 11:09:58 kn Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -1995,7 +1995,7 @@ replace_autoconf_forwarders(struct imsg_rdns_proposal *rdns_proposal) case AF_INET: memcpy(&addr4, src, sizeof(struct in_addr)); src += sizeof(struct in_addr); - if (addr4.s_addr == INADDR_LOOPBACK) + if (addr4.s_addr == htonl(INADDR_LOOPBACK)) continue; ns = inet_ntop(af, &addr4, ntopbuf, INET6_ADDRSTRLEN); -- 2.20.1