If the entry matches IPv6 address we would return this entry index
even if the entry isn't resolved yet.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/rvnamed.c | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/rvnamed.c b/src/rvnamed.c
index 0fe8ea7..e075761 100644
--- a/src/rvnamed.c
+++ b/src/rvnamed.c
@@ -122,21 +122,18 @@ static void process_rvn_packet(struct rvn *rvnpacket)
static int name_resolved(struct rvn *rvnpacket, struct hosts *hostlist,
unsigned int lastfree)
{
- unsigned int i = 0;
-
- while (i != lastfree) {
- if (rvnpacket->saddr.s_addr != 0) {
- if ((rvnpacket->saddr.s_addr == hostlist[i].addr)
- && (hostlist[i].ready == RESOLVED))
- return i;
- } else {
- if (!memcmp
- (rvnpacket->s6addr.s6_addr, hostlist[i].addr6,
- sizeof(hostlist[i].addr6)))
- return i;
+ for (unsigned int i = 0; i != lastfree; i++)
+ if (hostlist[i].ready == RESOLVED) {
+ if (rvnpacket->saddr.s_addr != 0) {
+ if (rvnpacket->saddr.s_addr == hostlist[i].addr)
+ return i;
+ } else {
+ if (!memcmp(rvnpacket->s6addr.s6_addr,
+ hostlist[i].addr6,
+ sizeof(hostlist[i].addr6)))
+ return i;
+ }
}
- i++;
- }
return -1;
}
--
1.7.8.4