From a90479302034db4c75eeb299c0de9f5f602d2fad Mon Sep 17 00:00:00 2001 From: smlng Date: Thu, 1 Sep 2016 20:47:01 +0200 Subject: [PATCH] change child route on new rank --- lib/libndmgmt/dag.cpp | 13 +++++-------- lib/libndmgmt/netlink.cpp | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/libndmgmt/dag.cpp b/lib/libndmgmt/dag.cpp index 61e9b3ad..157e0dfd 100644 --- a/lib/libndmgmt/dag.cpp +++ b/lib/libndmgmt/dag.cpp @@ -417,12 +417,10 @@ bool dag_network::check_security(const struct nd_rpl_dao *dao, int dao_len) /* here we mark that a DAO is needed soon */ void dag_network::maybe_send_dao(void) { - if(dao_needed && dag_bestparent != NULL) { - if(!root_node()) { - schedule_dao(); - } - dao_needed = false; + if(dao_needed && dag_bestparent && !root_node()) { + schedule_dao(); } + dao_needed = false; } void dag_network::add_childnode(rpl_node *announcing_peer, @@ -433,7 +431,7 @@ void dag_network::add_childnode(rpl_node *announcing_peer, char b1[256]; subnettot(&prefix, 0, b1, 256); - if(!pre.is_installed()) { + //if(!pre.is_installed()) { dao_needed = true; pre.set_debug(this->debug); pre.set_prefix(prefix); @@ -442,7 +440,7 @@ void dag_network::add_childnode(rpl_node *announcing_peer, announcing_peer->add_route_via_node(prefix, iface); set_dao_needed(); pre.set_installed(true); - } + //} #if 0 debug->verbose("added child node %s/%s from %s\n", b1, pre.node_name(), @@ -1133,4 +1131,3 @@ bool dag_network::set_interface_filter(const char *filter) * compile-command: "make programs" * End: */ - diff --git a/lib/libndmgmt/netlink.cpp b/lib/libndmgmt/netlink.cpp index 7fe5840f..f6853fbc 100644 --- a/lib/libndmgmt/netlink.cpp +++ b/lib/libndmgmt/netlink.cpp @@ -192,7 +192,7 @@ bool network_interface::add_route_to_node(const ip_subnet &prefix, addrtot(&src, 0, sbuf, sizeof(sbuf)); snprintf(buf, 1024, - "ip -6 route add %s via %s dev %s src %s", pbuf, tbuf, if_name, sbuf); + "ip -6 route replace %s via %s dev %s src %s", pbuf, tbuf, if_name, sbuf); debug->log(" invoking %s\n", buf); nisystem(buf);