mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #3910 from OlegHahm/6lowpan_nd_ar_opt_handle
6lowpan nd: check right NCE in AR handling
This commit is contained in:
commit
172d12419f
@ -195,6 +195,7 @@ gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, e
|
|||||||
* @param[in] ipv6 The IPv6 header the ARO was received in.
|
* @param[in] ipv6 The IPv6 header the ARO was received in.
|
||||||
* @param[in] icmpv6_type Message type of the ICMPv6 message that contained.
|
* @param[in] icmpv6_type Message type of the ICMPv6 message that contained.
|
||||||
* this message.
|
* this message.
|
||||||
|
* @param[in] addr The IPv6 address to register.
|
||||||
* @param[in] ar_opt The address registration option.
|
* @param[in] ar_opt The address registration option.
|
||||||
* @param[in] sl2a The link-layer source address contained in SL2A accompanying this
|
* @param[in] sl2a The link-layer source address contained in SL2A accompanying this
|
||||||
* option. May be NULL for icmpv6_type == ICMPV6_NBR_ADV.
|
* option. May be NULL for icmpv6_type == ICMPV6_NBR_ADV.
|
||||||
@ -203,7 +204,8 @@ gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, e
|
|||||||
* @return Status for the ARO in the replying NA (always 0 if icmpv6_type == ICMPV6_NBR_ADV).
|
* @return Status for the ARO in the replying NA (always 0 if icmpv6_type == ICMPV6_NBR_ADV).
|
||||||
*/
|
*/
|
||||||
uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6,
|
uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6,
|
||||||
uint8_t icmpv6_type, sixlowpan_nd_opt_ar_t *ar_opt,
|
uint8_t icmpv6_type, ipv6_addr_t *addr,
|
||||||
|
sixlowpan_nd_opt_ar_t *ar_opt,
|
||||||
uint8_t *sl2a, size_t sl2a_len);
|
uint8_t *sl2a, size_t sl2a_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +167,9 @@ void gnrc_ndp_nbr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
|
|||||||
if ((sl2a_opt != NULL) && (ar_opt != NULL) &&
|
if ((sl2a_opt != NULL) && (ar_opt != NULL) &&
|
||||||
(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) &&
|
(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) &&
|
||||||
(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_ROUTER)) {
|
(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_ROUTER)) {
|
||||||
uint8_t status = gnrc_sixlowpan_nd_opt_ar_handle(iface, ipv6, nbr_sol->type, ar_opt,
|
uint8_t status = gnrc_sixlowpan_nd_opt_ar_handle(iface, ipv6,
|
||||||
|
nbr_sol->type,
|
||||||
|
&ipv6->src, ar_opt,
|
||||||
l2src, l2src_len);
|
l2src, l2src_len);
|
||||||
/* check for multihop DAD return */
|
/* check for multihop DAD return */
|
||||||
nbr_adv_opts = gnrc_sixlowpan_nd_opt_ar_build(status, GNRC_SIXLOWPAN_ND_AR_LTIME,
|
nbr_adv_opts = gnrc_sixlowpan_nd_opt_ar_build(status, GNRC_SIXLOWPAN_ND_AR_LTIME,
|
||||||
@ -253,7 +255,9 @@ void gnrc_ndp_nbr_adv_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
|
|||||||
case NDP_OPT_AR:
|
case NDP_OPT_AR:
|
||||||
/* address registration option is always ignored when invalid */
|
/* address registration option is always ignored when invalid */
|
||||||
gnrc_sixlowpan_nd_opt_ar_handle(iface, ipv6, nbr_adv->type,
|
gnrc_sixlowpan_nd_opt_ar_handle(iface, ipv6, nbr_adv->type,
|
||||||
(sixlowpan_nd_opt_ar_t *)opt, NULL, 0);
|
&nbr_adv->tgt,
|
||||||
|
(sixlowpan_nd_opt_ar_t *)opt,
|
||||||
|
NULL, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -242,9 +242,10 @@ gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, e
|
|||||||
return pkt;
|
return pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6, uint8_t icmpv6_type,
|
uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6,
|
||||||
sixlowpan_nd_opt_ar_t *ar_opt, uint8_t *sl2a,
|
uint8_t icmpv6_type, ipv6_addr_t *addr,
|
||||||
size_t sl2a_len)
|
sixlowpan_nd_opt_ar_t *ar_opt,
|
||||||
|
uint8_t *sl2a, size_t sl2a_len)
|
||||||
{
|
{
|
||||||
eui64_t eui64;
|
eui64_t eui64;
|
||||||
gnrc_ipv6_netif_t *ipv6_iface;
|
gnrc_ipv6_netif_t *ipv6_iface;
|
||||||
@ -262,7 +263,7 @@ uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6, ui
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ipv6_iface = gnrc_ipv6_netif_get(iface);
|
ipv6_iface = gnrc_ipv6_netif_get(iface);
|
||||||
nc_entry = gnrc_ipv6_nc_get(iface, &ipv6->src);
|
nc_entry = gnrc_ipv6_nc_get(iface, addr);
|
||||||
switch (icmpv6_type) {
|
switch (icmpv6_type) {
|
||||||
case ICMPV6_NBR_ADV:
|
case ICMPV6_NBR_ADV:
|
||||||
if (!(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN)) {
|
if (!(ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN)) {
|
||||||
@ -273,6 +274,12 @@ uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6, ui
|
|||||||
/* discard silently: see https://tools.ietf.org/html/rfc6775#section-5.5.2 */
|
/* discard silently: see https://tools.ietf.org/html/rfc6775#section-5.5.2 */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* we expect the sender to be already in neighbor cache, if not we
|
||||||
|
* ignore it */
|
||||||
|
if (nc_entry == NULL) {
|
||||||
|
DEBUG("6lo nd: sending router not in neighbor cache\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
switch (ar_opt->status) {
|
switch (ar_opt->status) {
|
||||||
case SIXLOWPAN_ND_STATUS_SUCCESS:
|
case SIXLOWPAN_ND_STATUS_SUCCESS:
|
||||||
DEBUG("6lo nd: address registration successful\n");
|
DEBUG("6lo nd: address registration successful\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user