summaryrefslogtreecommitdiffstats
path: root/main/opennhrp/0001-peer-handle-dns-lookup-failure-properly.patch
blob: c816d2d91ebf2aa4fab2caef7b2f2a8a176998f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 10a70c0fabdc3a90840a3ede5ef47480b82ce425 Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Wed, 14 Oct 2009 13:21:39 +0300
Subject: [PATCH] peer: handle dns lookup failure properly

---
 nhrp/nhrp_peer.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/nhrp/nhrp_peer.c b/nhrp/nhrp_peer.c
index fdeef17..aee2906 100644
--- a/nhrp/nhrp_peer.c
+++ b/nhrp/nhrp_peer.c
@@ -679,17 +679,17 @@ static void nhrp_peer_address_query_cb(struct nhrp_address_query *query,
 					      address_query);
 	char host[64];
 
-	if (num_addr <= 0) {
+	if (num_addr > 0) {
+		nhrp_info("Resolved '%s' as %s",
+			  peer->nbma_hostname,
+			  nhrp_address_format(&addrs[0], sizeof(host), host));
+		peer->next_hop_address = addrs[0];
+		peer->afnum = nhrp_afnum_from_pf(peer->next_hop_address.type);
+		nhrp_peer_run_up_script(peer);
+	} else {
 		nhrp_error("Failed to resolve '%s'", peer->nbma_hostname);
 		nhrp_peer_restart_error(peer);
 	}
-
-	nhrp_info("Resolved '%s' as %s",
-		  peer->nbma_hostname,
-		  nhrp_address_format(&addrs[0], sizeof(host), host));
-	peer->next_hop_address = addrs[0];
-	peer->afnum = nhrp_afnum_from_pf(peer->next_hop_address.type);
-	nhrp_peer_run_up_script(peer);
 }
 
 static void nhrp_peer_restart_cb(struct ev_timer *w, int revents)
-- 
1.6.5