Skip to content

Commit

Permalink
change child route on new rank
Browse files Browse the repository at this point in the history
  • Loading branch information
smlng committed Dec 12, 2017
1 parent 0e231c9 commit a904793
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions lib/libndmgmt/dag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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(),
Expand Down Expand Up @@ -1133,4 +1131,3 @@ bool dag_network::set_interface_filter(const char *filter)
* compile-command: "make programs"
* End:
*/

2 changes: 1 addition & 1 deletion lib/libndmgmt/netlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a904793

Please sign in to comment.