summaryrefslogtreecommitdiffstats
path: root/main/opennhrp
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-08-23 15:07:26 +0300
committerTimo Teräs <timo.teras@iki.fi>2012-08-23 15:07:26 +0300
commit9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce (patch)
tree1f1a3c72e1c4c705dee0b04c06574ec5790db75b /main/opennhrp
parentf853a5e38bbcb1f77d93a3e9097587deae689b32 (diff)
downloadaports-9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce.tar.bz2
aports-9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce.tar.xz
main/opennhrp: add the missing patch
Diffstat (limited to 'main/opennhrp')
-rw-r--r--main/opennhrp/01-packet-route-fix.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/main/opennhrp/01-packet-route-fix.patch b/main/opennhrp/01-packet-route-fix.patch
new file mode 100644
index 000000000..e1edfb6ea
--- /dev/null
+++ b/main/opennhrp/01-packet-route-fix.patch
@@ -0,0 +1,48 @@
+From: Timo Teräs <timo.teras@iki.fi>
+Date: Thu, 23 Aug 2012 10:29:50 +0000 (+0300)
+Subject: packet: fix indefinite looping with bad routes
+X-Git-Url: http://opennhrp.git.sourceforge.net/git/gitweb.cgi?p=opennhrp%2Fopennhrp;a=commitdiff_plain;h=515a64f6c570761876f14f97c8eb206e950ee603
+
+packet: fix indefinite looping with bad routes
+
+If there's cycling routing, or just a route with gateway that would
+match the route itself, we could end up looping indefinitely. Add
+a fixed limit for route lookup recursion.
+---
+
+diff --git a/nhrp/nhrp_packet.c b/nhrp/nhrp_packet.c
+index f46b481..12dcf3c 100644
+--- a/nhrp/nhrp_packet.c
++++ b/nhrp/nhrp_packet.c
+@@ -979,7 +979,7 @@ int nhrp_packet_route(struct nhrp_packet *packet)
+ struct nhrp_payload *payload;
+ struct nhrp_peer *peer;
+ char tmp[64];
+- int r;
++ int i, r;
+
+ if (packet->dst_iface == NULL) {
+ nhrp_error("nhrp_packet_route called without destination interface");
+@@ -1005,7 +1005,7 @@ int nhrp_packet_route(struct nhrp_packet *packet)
+ proto_nexthop = packet->dst_peer->next_hop_address;
+ } else {
+ proto_nexthop = *dst;
+- do {
++ for (i = 0; i < 4; i++) {
+ peer = nhrp_peer_route_full(
+ packet->dst_iface, &proto_nexthop, 0,
+ NHRP_PEER_TYPEMASK_ROUTE_VIA_NHS, src, cielist);
+@@ -1020,7 +1020,12 @@ int nhrp_packet_route(struct nhrp_packet *packet)
+ if (peer->next_hop_address.type == AF_UNSPEC)
+ break;
+ proto_nexthop = peer->next_hop_address;
+- } while (1);
++ }
++ if (i >= 4) {
++ nhrp_error("Recursive routing for protocol address %s",
++ nhrp_address_format(dst, sizeof(tmp), tmp));
++ return FALSE;
++ }
+
+ packet->dst_peer = nhrp_peer_get(peer);
+ }