Merge branch 'develop' into pr/netstack-h-typos

This commit is contained in:
Simon Duquennoy 2019-02-26 08:47:42 +01:00 committed by GitHub
commit a2387cd881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 180 additions and 87 deletions

View File

@ -196,16 +196,13 @@ set_lladdr(void)
static void
set_global_address(void)
{
static uip_ipaddr_t ipaddr;
static uip_ipaddr_t *prefix = NULL;
uip_ipaddr_t ipaddr;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
/* Assign a unique local address (RFC4193,
http://tools.ietf.org/html/rfc4193). */
if(prefix == NULL) {
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
} else {
memcpy(&ipaddr, prefix, 8);
}
uip_ip6addr_copy(&ipaddr, default_prefix);
/* Assumes that the uip_lladdr is set */
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
@ -215,7 +212,8 @@ set_global_address(void)
LOG_INFO_("\n");
/* set the PREFIX::1 address to the IF */
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 1);
uip_ip6addr_copy(&ipaddr, default_prefix);
ipaddr.u8[15] = 1;
uip_ds6_defrt_add(&ipaddr, 0);
}
#endif

View File

@ -80,9 +80,10 @@ join_mcast_group(void)
{
uip_ipaddr_t addr;
uip_ds6_maddr_t *rv;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
/* First, set our v6 global */
uip_ip6addr(&addr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&addr, default_prefix);
uip_ds6_set_addr_iid(&addr, &uip_lladdr);
uip_ds6_addr_add(&addr, 0, ADDR_AUTOCONF);

View File

@ -95,10 +95,29 @@ static uip_ds6_prefix_t *locprefix;
static const uint8_t iid_prefix[] = { 0x00, 0x00 , 0x00 , 0xff , 0xfe , 0x00 };
#endif /* (UIP_LLADDR_LEN == 2) */
/* The default prefix */
static uip_ip6addr_t default_prefix = {
.u16 = { 0, 0, 0, 0, 0, 0, 0, 0 }
};
/*---------------------------------------------------------------------------*/
const uip_ip6addr_t *
uip_ds6_default_prefix()
{
return &default_prefix;
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_set_default_prefix(const uip_ip6addr_t *prefix)
{
uip_ip6addr_copy(&default_prefix, prefix);
}
/*---------------------------------------------------------------------------*/
void
uip_ds6_init(void)
{
if(uip_is_addr_unspecified(&default_prefix)) {
uip_ip6addr(&default_prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
}
uip_ds6_neighbors_init();
uip_ds6_route_init();

View File

@ -296,6 +296,22 @@ uip_ds6_prefix_t *uip_ds6_prefix_lookup(uip_ipaddr_t *ipaddr,
uint8_t ipaddrlen);
uint8_t uip_ds6_is_addr_onlink(uip_ipaddr_t *ipaddr);
/**
* \brief Retrieve the Default IPv6 prefix
* \retval A pointer to the default prefix
*/
const uip_ip6addr_t *uip_ds6_default_prefix(void);
/**
* \brief Set the Default IPv6 prefix
* \param prefix A pointer to the new default prefix
*
* uip_ds6_init() will set the default prefix to UIP_DS6_DEFAULT_PREFIX
* unless this function here has been called beforehand to set a new default
* prefix.
*/
void uip_ds6_set_default_prefix(const uip_ip6addr_t *prefix);
/** @} */
/** \name Unicast address list basic routines */

View File

@ -136,5 +136,13 @@ tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new)
rpl_parent_get_ipaddr(new)));
}
}
/*---------------------------------------------------------------------------*/
/* Check RPL has joined DODAG.
* To use, set #define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined */
int
tsch_rpl_check_dodag_joined(void)
{
return NETSTACK_ROUTING.node_has_joined();
}
#endif /* UIP_CONF_IPV6_RPL */
/** @} */

View File

@ -79,6 +79,12 @@ void tsch_rpl_callback_new_dio_interval(clock_time_t dio_interval);
* \param new The new RPL parent
*/
void tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new);
/**
* \brief Check RPL has joined DODAG.
* To use, set TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined
* \return 1 if joined, 0 otherwise
*/
int tsch_rpl_check_dodag_joined(void);
#endif /* __TSCH_RPL_H__ */
/** @} */

View File

@ -861,7 +861,12 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
while(1) {
unsigned long delay;
if(tsch_is_associated && tsch_current_eb_period > 0) {
if(tsch_is_associated && tsch_current_eb_period > 0
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
/* Implementation section 6.3 of RFC 8180 */
&& TSCH_RPL_CHECK_DODAG_JOINED()
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
) {
/* Enqueue EB only if there isn't already one in queue */
if(tsch_queue_packet_count(&tsch_eb_address) == 0) {
uint8_t hdr_len = 0;

View File

@ -88,6 +88,10 @@ frequency hopping for enhanced reliability.
#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent
#endif /* TSCH_CALLBACK_KA_SENT */
#ifndef TSCH_RPL_CHECK_DODAG_JOINED
#define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
#endif /* UIP_CONF_IPV6_RPL */
#if BUILD_WITH_ORCHESTRA
@ -117,6 +121,11 @@ void TSCH_CALLBACK_LEAVING_NETWORK();
void TSCH_CALLBACK_KA_SENT();
#endif
/* Called by TSCH before sending a EB */
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
int TSCH_RPL_CHECK_DODAG_JOINED();
#endif
/* Called by TSCH form interrupt after receiving a frame, enabled upper-layer to decide
* whether to ACK or NACK */
#ifdef TSCH_CALLBACK_DO_NACK

View File

@ -354,6 +354,10 @@ nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr, nbr_table_rea
nbr_table_item_t *item;
nbr_table_key_t *key;
if(table == NULL) {
return NULL;
}
/* Allow lladdr-free insertion, useful e.g. for IPv6 ND.
* Only one such entry is possible at a time, indexed by linkaddr_null. */
if(lladdr == NULL) {

View File

@ -57,7 +57,7 @@ struct routing_driver {
/**
* Set the prefix, for nodes that will operate as root
*
* \param prefix The prefix. If NULL, UIP_DS6_DEFAULT_PREFIX is used instead
* \param prefix The prefix. If NULL, uip_ds6_default_prefix() is used instead
* \param iid The IID. If NULL, it will be built from uip_ds6_set_addr_iid.
*/
void (* root_set_prefix)(uip_ipaddr_t *prefix, uip_ipaddr_t *iid);

View File

@ -48,12 +48,15 @@ static void
set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid)
{
static uip_ipaddr_t root_ipaddr;
const uip_ipaddr_t *default_prefix;
int i;
default_prefix = uip_ds6_default_prefix();
/* Assign a unique local address (RFC4193,
http://tools.ietf.org/html/rfc4193). */
if(prefix == NULL) {
uip_ip6addr(&root_ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&root_ipaddr, default_prefix);
} else {
memcpy(&root_ipaddr, prefix, 8);
}
@ -115,9 +118,11 @@ rpl_dag_root_start(void)
if(root_if != NULL) {
rpl_dag_t *dag;
uip_ipaddr_t prefix;
const uip_ipaddr_t *default_prefix;
rpl_set_root(RPL_DEFAULT_INSTANCE, ipaddr);
dag = rpl_get_any_dag();
default_prefix = uip_ds6_default_prefix();
/* If there are routes in this dag, we remove them all as we are
from now on the new dag root and the old routes are wrong */
@ -129,7 +134,7 @@ rpl_dag_root_start(void)
dag->instance->def_route = NULL;
}
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&prefix, default_prefix);
rpl_set_prefix(dag, &prefix, 64);
LOG_INFO("root_set_prefix: created a new RPL dag\n");
return 0;

View File

@ -76,13 +76,16 @@ static void
set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid)
{
static uip_ipaddr_t root_ipaddr;
const uip_ipaddr_t *default_prefix;
int i;
uint8_t state;
default_prefix = uip_ds6_default_prefix();
/* Assign a unique local address (RFC4193,
http://tools.ietf.org/html/rfc4193). */
if(prefix == NULL) {
uip_ip6addr(&root_ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&root_ipaddr, default_prefix);
} else {
memcpy(&root_ipaddr, prefix, 8);
}

View File

@ -45,7 +45,7 @@
/**
* Set a prefix in case the node is later set as dag root.
*
* \param prefix The prefix. If NULL, UIP_DS6_DEFAULT_PREFIX is used instead
* \param prefix The prefix. If NULL, uip_ds6_default_prefix() is used instead
* \param iid The IID. If NULL, it will be built from uip_ds6_set_addr_iid.
*/
void rpl_dag_root_set_prefix(uip_ipaddr_t *prefix, uip_ipaddr_t *iid);

View File

@ -104,7 +104,7 @@ rpl_dag_leave(void)
/* Issue a no-path DAO */
if(!rpl_dag_root_is_root()) {
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_curr_seqno);
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_last_seqno);
rpl_icmp6_dao_output(0);
}
@ -507,7 +507,7 @@ init_dag(uint8_t instance_id, uip_ipaddr_t *dag_id, rpl_ocp_t ocp,
curr_instance.dag.lowest_rank = RPL_INFINITE_RANK;
curr_instance.dag.dao_last_seqno = RPL_LOLLIPOP_INIT;
curr_instance.dag.dao_last_acked_seqno = RPL_LOLLIPOP_INIT;
curr_instance.dag.dao_curr_seqno = RPL_LOLLIPOP_INIT;
curr_instance.dag.dao_last_seqno = RPL_LOLLIPOP_INIT;
memcpy(&curr_instance.dag.dag_id, dag_id, sizeof(curr_instance.dag.dag_id));
return 1;
@ -657,6 +657,8 @@ rpl_process_dao_ack(uint8_t sequence, uint8_t status)
curr_instance.dag.state = DAG_REACHABLE;
rpl_timers_dio_reset("Reachable");
}
/* Let the rpl-timers module know that we got an ACK for the last DAO */
rpl_timers_notify_dao_ack();
if(!status_ok) {
/* We got a NACK, start poisoning and leave */

View File

@ -579,7 +579,7 @@ rpl_icmp6_dao_output(uint8_t lifetime)
#endif /* RPL_WITH_DAO_ACK */
++pos;
buffer[pos++] = 0; /* reserved */
buffer[pos++] = curr_instance.dag.dao_curr_seqno;
buffer[pos++] = curr_instance.dag.dao_last_seqno;
/* create target subopt */
prefixlen = sizeof(*prefix) * CHAR_BIT;
@ -606,7 +606,7 @@ rpl_icmp6_dao_output(uint8_t lifetime)
LOG_INFO("sending a %sDAO seqno %u, tx count %u, lifetime %u, prefix ",
lifetime == 0 ? "No-path " : "",
curr_instance.dag.dao_curr_seqno, curr_instance.dag.dao_transmissions, lifetime);
curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_transmissions, lifetime);
LOG_INFO_6ADDR(prefix);
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&curr_instance.dag.dag_id);
@ -640,7 +640,7 @@ dao_ack_input(void)
LOG_INFO("received a DAO-%s with seqno %d (%d %d) and status %d from ",
status < RPL_DAO_ACK_UNABLE_TO_ACCEPT ? "ACK" : "NACK", sequence,
curr_instance.dag.dao_curr_seqno, curr_instance.dag.dao_curr_seqno, status);
curr_instance.dag.dao_last_seqno, curr_instance.dag.dao_last_seqno, status);
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO_("\n");

View File

@ -71,8 +71,9 @@ clock_time_t RPL_PROBING_DELAY_FUNC(void);
static void handle_dis_timer(void *ptr);
static void handle_dio_timer(void *ptr);
static void handle_unicast_dio_timer(void *ptr);
static void handle_dao_timer(void *ptr);
static void send_new_dao(void *ptr);
#if RPL_WITH_DAO_ACK
static void resend_dao(void *ptr);
static void handle_dao_ack_timer(void *ptr);
#endif /* RPL_WITH_DAO_ACK */
#if RPL_WITH_PROBING
@ -224,7 +225,7 @@ static void
schedule_dao_retransmission(void)
{
clock_time_t expiration_time = RPL_DAO_RETRANSMISSION_TIMEOUT / 2 + (random_rand() % (RPL_DAO_RETRANSMISSION_TIMEOUT));
ctimer_set(&curr_instance.dag.dao_timer, expiration_time, handle_dao_timer, NULL);
ctimer_set(&curr_instance.dag.dao_timer, expiration_time, resend_dao, NULL);
}
#endif /* RPL_WITH_DAO_ACK */
/*---------------------------------------------------------------------------*/
@ -247,9 +248,8 @@ schedule_dao_refresh(void)
target_refresh -= safety_margin;
}
/* Increment next sequno */
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_curr_seqno);
ctimer_set(&curr_instance.dag.dao_timer, target_refresh, handle_dao_timer, NULL);
/* Schedule transmission */
ctimer_set(&curr_instance.dag.dao_timer, target_refresh, send_new_dao, NULL);
}
}
/*---------------------------------------------------------------------------*/
@ -261,36 +261,16 @@ rpl_timers_schedule_dao(void)
* only serves storing mode. Use simple delay instead, with the only purpose
* to reduce congestion. */
clock_time_t expiration_time = RPL_DAO_DELAY / 2 + (random_rand() % (RPL_DAO_DELAY));
/* Increment next seqno */
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_curr_seqno);
ctimer_set(&curr_instance.dag.dao_timer, expiration_time, handle_dao_timer, NULL);
ctimer_set(&curr_instance.dag.dao_timer, expiration_time, send_new_dao, NULL);
}
}
/*---------------------------------------------------------------------------*/
static void
handle_dao_timer(void *ptr)
send_new_dao(void *ptr)
{
#if RPL_WITH_DAO_ACK
if(rpl_lollipop_greater_than(curr_instance.dag.dao_curr_seqno,
curr_instance.dag.dao_last_seqno)) {
/* We are sending a new DAO here. Prepare retransmissions */
curr_instance.dag.dao_transmissions = 0;
} else {
/* We are called for the same DAO again */
if(curr_instance.dag.dao_last_acked_seqno == curr_instance.dag.dao_last_seqno) {
/* The last seqno sent is ACKed! Schedule refresh to avoid route expiration */
schedule_dao_refresh();
return;
}
/* We need to re-send the last DAO */
if(curr_instance.dag.dao_transmissions >= RPL_DAO_MAX_RETRANSMISSIONS) {
/* No more retransmissions. Perform local repair and hope to find another . */
rpl_local_repair("DAO max rtx");
return;
}
}
/* Increment transmission counter before sending */
curr_instance.dag.dao_transmissions++;
curr_instance.dag.dao_transmissions = 1;
/* Schedule next retransmission */
schedule_dao_retransmission();
#else /* RPL_WITH_DAO_ACK */
@ -299,19 +279,14 @@ handle_dao_timer(void *ptr)
curr_instance.dag.state = DAG_REACHABLE;
}
rpl_timers_dio_reset("Reachable");
#endif /* !RPL_WITH_DAO_ACK */
curr_instance.dag.dao_last_seqno = curr_instance.dag.dao_curr_seqno;
/* Send a DAO with own prefix as target and default lifetime */
rpl_icmp6_dao_output(curr_instance.default_lifetime);
#if !RPL_WITH_DAO_ACK
/* There is no DAO-ACK, schedule a refresh. Must be done after rpl_icmp6_dao_output,
because we increment curr_instance.dag.dao_curr_seqno for the next DAO (refresh).
Where there is DAO-ACK, the refresh is scheduled after reception of the ACK.
Happens when handle_dao_timer is called again next. */
/* There is no DAO-ACK, schedule a refresh. */
schedule_dao_refresh();
#endif /* !RPL_WITH_DAO_ACK */
/* Increment seqno */
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_last_seqno);
/* Send a DAO with own prefix as target and default lifetime */
rpl_icmp6_dao_output(curr_instance.default_lifetime);
}
#if RPL_WITH_DAO_ACK
/*---------------------------------------------------------------------------*/
@ -334,6 +309,32 @@ handle_dao_ack_timer(void *ptr)
rpl_icmp6_dao_ack_output(&curr_instance.dag.dao_ack_target,
curr_instance.dag.dao_ack_sequence, RPL_DAO_ACK_UNCONDITIONAL_ACCEPT);
}
/*---------------------------------------------------------------------------*/
void
rpl_timers_notify_dao_ack(void)
{
/* The last DAO was ACKed. Schedule refresh to avoid route expiration. This
implicitly de-schedules resend_dao, as both share curr_instance.dag.dao_timer */
schedule_dao_refresh();
}
/*---------------------------------------------------------------------------*/
static void
resend_dao(void *ptr)
{
/* Increment transmission counter before sending */
curr_instance.dag.dao_transmissions++;
/* Send a DAO with own prefix as target and default lifetime */
rpl_icmp6_dao_output(curr_instance.default_lifetime);
/* Schedule next retransmission, or abort */
if(curr_instance.dag.dao_transmissions < RPL_DAO_MAX_RETRANSMISSIONS) {
schedule_dao_retransmission();
} else {
/* No more retransmissions. Perform local repair. */
rpl_local_repair("DAO max rtx");
return;
}
}
#endif /* RPL_WITH_DAO_ACK */
/*---------------------------------------------------------------------------*/
/*------------------------------- Probing----------------------------------- */

View File

@ -99,6 +99,11 @@ void rpl_timers_schedule_dao(void);
*/
void rpl_timers_schedule_dao_ack(uip_ipaddr_t *target, uint16_t sequence);
/**
* Let the rpl-timers module know that the last DAO was ACKed
*/
void rpl_timers_notify_dao_ack(void);
/**
* Schedule probing with delay RPL_PROBING_DELAY_FUNC()
*/

View File

@ -198,7 +198,6 @@ struct rpl_dag {
uint8_t dio_counter; /* internal trickle timer state: redundancy counter */
uint8_t dao_last_seqno; /* the node's last sent DAO seqno */
uint8_t dao_last_acked_seqno; /* the last seqno we got an ACK for */
uint8_t dao_curr_seqno; /* the node's current DAO seqno (sent or to be sent) */
uint8_t dao_transmissions; /* the number of transmissions for the current DAO */
enum rpl_dag_state state;

View File

@ -413,7 +413,8 @@ PT_THREAD(cmd_rpl_set_root(struct pt *pt, shell_output_func output, char *args))
PT_EXIT(pt);
}
} else {
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&prefix, default_prefix);
}
if(is_on) {

View File

@ -7,7 +7,7 @@
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>RPL+TSCH (Z1)</title>
<randomseed>123456</randomseed>
<randomseed>1</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
org.contikios.cooja.radiomediums.UDGM
@ -108,20 +108,6 @@
</interface_config>
<motetype_identifier>z11</motetype_identifier>
</mote>
<mote>
<breakpoints />
<interface_config>
org.contikios.cooja.interfaces.Position
<x>10.622284947035123</x>
<y>109.81862399725188</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.mspmote.interfaces.MspMoteID
<id>6</id>
</interface_config>
<motetype_identifier>z11</motetype_identifier>
</mote>
</simulation>
<plugin>
org.contikios.cooja.plugins.SimControl
@ -168,7 +154,6 @@
<mote>2</mote>
<mote>3</mote>
<mote>4</mote>
<mote>5</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />

View File

@ -36,10 +36,13 @@ PROCESS_THREAD(udp_process, ev, data)
static struct etimer send_timer;
uip_ipaddr_t addr;
static int alive;
const uip_ipaddr_t *default_prefix;
PROCESS_BEGIN();
uip_ip6addr(&addr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 2);
default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&addr, default_prefix);
addr.u16[7] = UIP_HTONS(2);
uip_ds6_addr_add(&addr, 0, ADDR_AUTOCONF);
simple_udp_register(&broadcast_connection, UDP_PORT,

View File

@ -51,12 +51,15 @@ PROCESS_THREAD(udp_process, ev, data)
etimer_set(&periodic_timer, SEND_INTERVAL);
while(1) {
const uip_ipaddr_t *default_prefix;
uint8_t buf[SIZE];
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
etimer_reset(&periodic_timer);
printf("Sending unicast\n");
uip_ip6addr(&addr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 2);
default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&addr, default_prefix);
addr.u16[7] = UIP_HTONS(2);
simple_udp_sendto(&broadcast_connection, buf, sizeof(buf), &addr);
}

View File

@ -44,6 +44,7 @@ PROCESS_THREAD(node_process, ev, data)
static struct etimer et;
#if WITH_ULA
static uip_ipaddr_t ipaddr;
const uip_ipaddr_t *default_prefix;
#endif /* WITH_ULA */
#if WITH_TSCH
@ -60,7 +61,8 @@ PROCESS_THREAD(node_process, ev, data)
#endif /* WITH_TSCH */
#if WITH_ULA
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&ipaddr, default_prefix);
uip_ds6_prefix_add(&ipaddr, UIP_DEFAULT_PREFIX_LEN, 0, 0, 0, 0);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);

View File

@ -73,8 +73,9 @@ set_global_address(void)
static uip_ipaddr_t ipaddr;
int i;
uint8_t state;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&ipaddr, default_prefix);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);

View File

@ -71,8 +71,9 @@ set_global_address(void)
uip_ipaddr_t ipaddr;
int i;
uint8_t state;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&ipaddr, default_prefix);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
@ -92,6 +93,7 @@ PROCESS_THREAD(sender_node_process, ev, data)
static struct etimer periodic_timer;
static struct etimer send_timer;
uip_ipaddr_t addr;
const uip_ipaddr_t *default_prefix;
PROCESS_BEGIN();
@ -109,7 +111,13 @@ PROCESS_THREAD(sender_node_process, ev, data)
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
uip_ip6addr(&addr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0x0201, 0x001, 0x001, 0x001);
default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&addr, default_prefix);
addr.u16[4] = UIP_HTONS(0x0201);
addr.u16[5] = UIP_HTONS(0x0001);
addr.u16[6] = UIP_HTONS(0x0001);
addr.u16[7] = UIP_HTONS(0x0001);
{
static unsigned int message_number;

View File

@ -73,8 +73,9 @@ set_global_address(void)
static uip_ipaddr_t ipaddr;
int i;
uint8_t state;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&ipaddr, default_prefix);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);

View File

@ -71,8 +71,9 @@ set_global_address(void)
uip_ipaddr_t ipaddr;
int i;
uint8_t state;
const uip_ipaddr_t *default_prefix = uip_ds6_default_prefix();
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
uip_ip6addr_copy(&ipaddr, default_prefix);
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
@ -92,6 +93,7 @@ PROCESS_THREAD(sender_node_process, ev, data)
static struct etimer periodic_timer;
static struct etimer send_timer;
uip_ipaddr_t addr;
const uip_ipaddr_t *default_prefix;
PROCESS_BEGIN();
@ -109,7 +111,13 @@ PROCESS_THREAD(sender_node_process, ev, data)
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
uip_ip6addr(&addr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0x0201, 0x001, 0x001, 0x001);
default_prefix = uip_ds6_default_prefix();
uip_ip6addr_copy(&addr, default_prefix);
addr.u16[4] = UIP_HTONS(0x0201);
addr.u16[5] = UIP_HTONS(0x0001);
addr.u16[6] = UIP_HTONS(0x0001);
addr.u16[7] = UIP_HTONS(0x0001);
{
static unsigned int message_number;