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
82001cfd
Commit
82001cfd
authored
6 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
gnrc_ipv6_nib: expose non-randomized part of NS-backoff calculation
This was primarily done so the backoff can be tested
parent
1f4d57d6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c
+4
-12
4 additions, 12 deletions
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h
+37
-0
37 additions, 0 deletions
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h
with
41 additions
and
12 deletions
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c
+
4
−
12
View file @
82001cfd
...
...
@@ -514,18 +514,10 @@ bool _is_reachable(_nib_onl_entry_t *entry)
static
inline
uint32_t
_exp_backoff_retrans_timer
(
uint8_t
ns_sent
,
uint32_t
retrans_timer
)
{
uint32_t
tmp
=
random_uint32_range
(
NDP_MIN_RANDOM_FACTOR
,
NDP_MAX_RANDOM_FACTOR
);
/* backoff according to https://tools.ietf.org/html/rfc7048 with
* BACKOFF_MULTIPLE == 2 */
tmp
=
(
uint32_t
)(((
uint64_t
)(((
uint32_t
)
1
)
<<
ns_sent
)
*
retrans_timer
*
tmp
)
/
US_PER_MS
);
/* random factors were statically multiplied with 1000 ^ */
if
(
tmp
>
NDP_MAX_RETRANS_TIMER_MS
)
{
tmp
=
NDP_MAX_RETRANS_TIMER_MS
;
}
return
tmp
;
uint32_t
factor
=
random_uint32_range
(
NDP_MIN_RANDOM_FACTOR
,
NDP_MAX_RANDOM_FACTOR
);
return
_exp_backoff_retrans_timer_factor
(
ns_sent
,
retrans_timer
,
factor
);
}
#if GNRC_IPV6_NIB_CONF_REDIRECT
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.h
+
37
−
0
View file @
82001cfd
...
...
@@ -81,6 +81,43 @@ void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset);
void
_handle_sl2ao
(
gnrc_netif_t
*
netif
,
const
ipv6_hdr_t
*
ipv6
,
const
icmpv6_hdr_t
*
icmpv6
,
const
ndp_opt_t
*
sl2ao
);
/**
* @brief Calculates truncated exponential back-off for retransmission timer
* for neighbor solicitations based on a randomized factor
*
* The truncation is at @ref NDP_MAX_RETRANS_TIMER_MS. as suggested in
* [RFC 7048, section 3](https://tools.ietf.org/html/rfc7048#section-3).
*
* @param[in] ns_sent Neighbor solicitations sent up until now. Must be
* lesser than or equal to @ref NDP_MAX_NS_NUMOF.
* @param[in] retrans_timer Currently configured retransmission timer in ms.
* @param[in] factor An equally distributed factor between
* @ref NDP_MIN_RANDOM_FACTOR and (exclusive)
* @ref NDP_MAX_RANDOM_FACTOR.
*
* @pre (NDP_MIN_RANDOM_FACTOR <= factor < NDP_MAX_RANDOM_FACTOR)
* @pre (ns_sent <= NDP_MAX_NS_NUMOF)
*
* @return exponential back-off of the retransmission timer
*/
static
inline
uint32_t
_exp_backoff_retrans_timer_factor
(
uint8_t
ns_sent
,
uint32_t
retrans_timer
,
uint32_t
factor
)
{
assert
(
NDP_MIN_RANDOM_FACTOR
<=
factor
);
assert
(
factor
<
NDP_MAX_RANDOM_FACTOR
);
assert
(
ns_sent
<=
NDP_MAX_NS_NUMOF
);
/* backoff according to https://tools.ietf.org/html/rfc7048 with
* BACKOFF_MULTIPLE == 2 */
uint32_t
res
=
(
uint32_t
)(((
uint64_t
)(((
uint32_t
)
1
)
<<
ns_sent
)
*
retrans_timer
*
factor
)
/
US_PER_MS
);
/* random factors were statically multiplied with 1000 */
if
(
res
>
NDP_MAX_RETRANS_TIMER_MS
)
{
res
=
NDP_MAX_RETRANS_TIMER_MS
;
}
return
res
;
}
#if GNRC_IPV6_NIB_CONF_ARSM || defined(DOXYGEN)
/**
* @brief Handler for @ref GNRC_IPV6_NIB_SND_UC_NS and
...
...
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