aboutsummaryrefslogtreecommitdiffstats
path: root/main/opennhrp/0005-do-not-establish-shortcut-entry-if-cie-code-indicate.patch
blob: 5ec9ee137ab9949d67c2d4e6783472f93488f500 (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
From a33098aed9805f78ecd23c2936ecdbd588b60c62 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 27 May 2015 17:59:35 +0300
Subject: [PATCH] do not establish shortcut entry if cie code indicates failure

---
 nhrp/nhrp_peer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/nhrp/nhrp_peer.c b/nhrp/nhrp_peer.c
index 9f8f45f..8aa7a64 100644
--- a/nhrp/nhrp_peer.c
+++ b/nhrp/nhrp_peer.c
@@ -1210,14 +1210,18 @@ static void nhrp_peer_handle_resolution_reply(void *ctx,
 	if (cie == NULL)
 		goto ret;
 
-	nhrp_info("Received Resolution Reply %s/%d is at proto %s nbma %s",
+	nhrp_info("Received Resolution Reply %s/%d is at proto %s nbma %s (code %d)",
 		  nhrp_address_format(&peer->protocol_address,
 				      sizeof(dst), dst),
 		  cie->hdr.prefix_length,
 		  nhrp_address_format(&cie->protocol_address,
 				      sizeof(tmp), tmp),
 		  nhrp_address_format(&cie->nbma_address,
-				      sizeof(nbma), nbma));
+				      sizeof(nbma), nbma),
+		  cie->hdr.code);
+
+	if (cie->hdr.code != NHRP_CODE_SUCCESS)
+		goto ret;
 
 	payload = nhrp_packet_extension(reply,
 					NHRP_EXTENSION_NAT_ADDRESS |
-- 
2.4.6