[Olsr-dev] [PATCH v1 16/19] gateway: the gateway to set must be in the gateway tree
Ferry Huberts
(spam-protected)
Thu Aug 23 15:12:40 CEST 2012
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/gateway.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gateway.c b/src/gateway.c
index 86df0b0..1e9b729 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -486,17 +486,20 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, bool ipv4, bool ipv6)
ipv6 = ipv6 && (olsr_cnf->ip_version == AF_INET6);
entry = node2gateway(avl_find(&gateway_tree, originator));
+ if (!entry) {
+ return true;
+ }
if (ipv4) {
current_ipv4_gw = NULL;
- if (entry != NULL && entry->ipv4 && (!entry->ipv4nat || olsr_cnf->smart_gw_allow_nat)) {
+ if (entry->ipv4 && (!entry->ipv4nat || olsr_cnf->smart_gw_allow_nat)) {
/* valid ipv4 gateway */
current_ipv4_gw = entry;
}
}
if (ipv6) {
current_ipv6_gw = NULL;
- if (entry != NULL && entry->ipv6) {
+ if (entry->ipv6) {
/* valid ipv6 gateway */
current_ipv6_gw = entry;
}
--
1.7.11.4
More information about the Olsr-dev
mailing list