Merge pull request #649 from cetic/pr-dio-preference-fix

Add user configuration of DIO preference field
This commit is contained in:
Nicolas Tsiftes 2014-05-07 16:12:56 +02:00
commit 812a0299a8
2 changed files with 10 additions and 0 deletions

View file

@ -186,4 +186,13 @@
#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME #define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME
#endif #endif
/*
* DAG preference field
*/
#ifdef RPL_CONF_PREFERENCE
#define RPL_PREFERENCE RPL_CONF_PREFERENCE
#else
#define RPL_PREFERENCE 0
#endif
#endif /* RPL_CONF_H */ #endif /* RPL_CONF_H */

View file

@ -270,6 +270,7 @@ rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id)
dag->version = version; dag->version = version;
dag->joined = 1; dag->joined = 1;
dag->grounded = RPL_GROUNDED; dag->grounded = RPL_GROUNDED;
dag->preference = RPL_PREFERENCE;
instance->mop = RPL_MOP_DEFAULT; instance->mop = RPL_MOP_DEFAULT;
instance->of = &RPL_OF; instance->of = &RPL_OF;
rpl_set_preferred_parent(dag, NULL); rpl_set_preferred_parent(dag, NULL);