aboutsummaryrefslogtreecommitdiff
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
parentf853a5e38bbcb1f77d93a3e9097587deae689b32 (diff)
downloadalpine_aports-9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce.tar.bz2
alpine_aports-9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce.tar.xz
alpine_aports-9ed5cf8ffa47c6a4e1bb321b24f7e67f57f14fce.zip
main/opennhrp: add the missing patch
-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 0000000000..e1edfb6ea3
--- /dev/null
+++ b/main/opennhrp/01-packet-route-fix.patch
@@ -0,0 +1,48 @@
1From: Timo Teräs <timo.teras@iki.fi>
2Date: Thu, 23 Aug 2012 10:29:50 +0000 (+0300)
3Subject: packet: fix indefinite looping with bad routes
4X-Git-Url: http://opennhrp.git.sourceforge.net/git/gitweb.cgi?p=opennhrp%2Fopennhrp;a=commitdiff_plain;h=515a64f6c570761876f14f97c8eb206e950ee603
5
6packet: fix indefinite looping with bad routes
7
8If there's cycling routing, or just a route with gateway that would
9match the route itself, we could end up looping indefinitely. Add
10a fixed limit for route lookup recursion.
11---
12
13diff --git a/nhrp/nhrp_packet.c b/nhrp/nhrp_packet.c
14index f46b481..12dcf3c 100644
15--- a/nhrp/nhrp_packet.c
16+++ b/nhrp/nhrp_packet.c
17@@ -979,7 +979,7 @@ int nhrp_packet_route(struct nhrp_packet *packet)
18 struct nhrp_payload *payload;
19 struct nhrp_peer *peer;
20 char tmp[64];
21- int r;
22+ int i, r;
23
24 if (packet->dst_iface == NULL) {
25 nhrp_error("nhrp_packet_route called without destination interface");
26@@ -1005,7 +1005,7 @@ int nhrp_packet_route(struct nhrp_packet *packet)
27 proto_nexthop = packet->dst_peer->next_hop_address;
28 } else {
29 proto_nexthop = *dst;
30- do {
31+ for (i = 0; i < 4; i++) {
32 peer = nhrp_peer_route_full(
33 packet->dst_iface, &proto_nexthop, 0,
34 NHRP_PEER_TYPEMASK_ROUTE_VIA_NHS, src, cielist);
35@@ -1020,7 +1020,12 @@ int nhrp_packet_route(struct nhrp_packet *packet)
36 if (peer->next_hop_address.type == AF_UNSPEC)
37 break;
38 proto_nexthop = peer->next_hop_address;
39- } while (1);
40+ }
41+ if (i >= 4) {
42+ nhrp_error("Recursive routing for protocol address %s",
43+ nhrp_address_format(dst, sizeof(tmp), tmp));
44+ return FALSE;
45+ }
46
47 packet->dst_peer = nhrp_peer_get(peer);
48 }