Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
de539fa5
Commit
de539fa5
authored
9 years ago
by
Cenk Gündoğan
Browse files
Options
Downloads
Plain Diff
Merge pull request #4122 from cgundogan/pr/nc/xtimer_nbr_adv_timer
nc: use xtimer for gnrc_ipv6_nc_t::nbr_adv_timer
parents
56534e28
59a8b929
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/include/net/gnrc/ipv6/nc.h
+2
-1
2 additions, 1 deletion
sys/include/net/gnrc/ipv6/nc.h
sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c
+9
-7
9 additions, 7 deletions
sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c
with
11 additions
and
8 deletions
sys/include/net/gnrc/ipv6/nc.h
+
2
−
1
View file @
de539fa5
...
...
@@ -146,7 +146,8 @@ typedef struct {
* RFC 4861, section 7.2.7
* </a>
*/
vtimer_t
nbr_adv_timer
;
xtimer_t
nbr_adv_timer
;
msg_t
nbr_adv_msg
;
/**< msg_t for gnrc_ipv6_nc_t::nbr_adv_timer */
#ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
xtimer_t
type_timeout
;
/**< Timer for type transmissions */
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c
+
9
−
7
View file @
de539fa5
...
...
@@ -44,13 +44,16 @@ static size_t _get_l2src(kernel_pid_t iface, uint8_t *l2src, size_t l2src_maxlen
* @brief Sends @ref GNRC_NETAPI_MSG_TYPE_SND delayed.
*
* @param[in] t Timer for the delay.
* @param[in] msg Msg for the timer.
* @param[in] interval Delay interval.
* @param[in] pkt Packet to send delayed.
*/
static
inline
void
_send_delayed
(
v
timer_t
*
t
,
timex
_t
interval
,
gnrc_pktsnip_t
*
pkt
)
static
inline
void
_send_delayed
(
x
timer_t
*
t
,
msg_t
*
msg
,
uint32
_t
interval
,
gnrc_pktsnip_t
*
pkt
)
{
vtimer_remove
(
t
);
vtimer_set_msg
(
t
,
interval
,
gnrc_ipv6_pid
,
GNRC_NETAPI_MSG_TYPE_SND
,
pkt
);
xtimer_remove
(
t
);
msg
->
type
=
GNRC_NETAPI_MSG_TYPE_SND
;
msg
->
content
.
ptr
=
(
char
*
)
pkt
;
xtimer_set_msg
(
t
,
interval
,
msg
,
gnrc_ipv6_pid
);
}
...
...
@@ -214,16 +217,15 @@ void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt, ipv6_a
if
(
gnrc_ipv6_netif_addr_is_non_unicast
(
tgt
))
{
/* avoid collision for anycast addresses
* (see https://tools.ietf.org/html/rfc4861#section-7.2.7) */
timex_t
delay
=
{
0
,
genrand_uint32_range
(
0
,
GNRC_NDP_MAX_AC_TGT_DELAY
*
SEC_IN_USEC
)
};
timex_normalize
(
&
delay
);
uint32_t
delay
=
genrand_uint32_range
(
0
,
GNRC_NDP_MAX_AC_TGT_DELAY
*
SEC_IN_USEC
);
gnrc_ipv6_nc_t
*
nc_entry
=
gnrc_ipv6_nc_get
(
iface
,
dst
);
DEBUG
(
"ndp internal: delay neighbor advertisement for %"
PRIu32
" sec."
,
delay
.
seconds
);
(
delay
/
SEC_IN_USEC
)
);
/* nc_entry must be set so no need to check it */
assert
(
nc_entry
);
_send_delayed
(
&
nc_entry
->
nbr_adv_timer
,
delay
,
hdr
);
_send_delayed
(
&
nc_entry
->
nbr_adv_timer
,
&
nc_entry
->
nbr_adv_msg
,
delay
,
hdr
);
}
else
if
(
gnrc_netapi_send
(
gnrc_ipv6_pid
,
hdr
)
<
1
)
{
DEBUG
(
"ndp internal: unable to send neighbor advertisement
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment