summaryrefslogtreecommitdiff
path: root/nhrp/nhrp_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'nhrp/nhrp_packet.c')
-rw-r--r--nhrp/nhrp_packet.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/nhrp/nhrp_packet.c b/nhrp/nhrp_packet.c
index f46b481..4edf392 100644
--- a/nhrp/nhrp_packet.c
+++ b/nhrp/nhrp_packet.c
@@ -1,13 +1,9 @@
/* nhrp_packet.c - NHRP packet marshalling and tranceiving
*
- * Copyright (C) 2007-2009 Timo Teräs <timo.teras@iki.fi>
- * All rights reserved.
+ * Copyright (c) 2007-2012 Timo Teräs <timo.teras@iki.fi>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 or later as
- * published by the Free Software Foundation.
- *
- * See http://www.gnu.org/ for details.
+ * This software is licensed under the MIT License.
+ * See MIT-LICENSE.txt for additional details.
*/
#include <malloc.h>
@@ -979,7 +975,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 +1001,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 +1016,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);
}