mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
ng_ndp: code restructuring
Some code restructuring to be in line with other code of similar format.
This commit is contained in:
parent
910ade1fb2
commit
1e4f8b4837
@ -528,7 +528,6 @@ kernel_pid_t ng_ndp_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_len,
|
||||
ng_pktsnip_t *ng_ndp_nbr_sol_build(ng_ipv6_addr_t *tgt, ng_pktsnip_t *options)
|
||||
{
|
||||
ng_pktsnip_t *pkt;
|
||||
ng_ndp_nbr_sol_t *nbr_sol;
|
||||
|
||||
DEBUG("ndp: building neighbor solicitation message\n");
|
||||
|
||||
@ -540,9 +539,10 @@ ng_pktsnip_t *ng_ndp_nbr_sol_build(ng_ipv6_addr_t *tgt, ng_pktsnip_t *options)
|
||||
pkt = ng_icmpv6_build(options, NG_ICMPV6_NBR_SOL, 0, sizeof(ng_ndp_nbr_sol_t));
|
||||
|
||||
if (pkt != NULL) {
|
||||
nbr_sol = pkt->data;
|
||||
ng_ndp_nbr_sol_t *nbr_sol = pkt->data;
|
||||
nbr_sol->resv.u32 = 0;
|
||||
memcpy(&nbr_sol->tgt, tgt, sizeof(ng_ipv6_addr_t));
|
||||
nbr_sol->tgt.u64[0].u64 = tgt->u64[0].u64;
|
||||
nbr_sol->tgt.u64[1].u64 = tgt->u64[1].u64;
|
||||
}
|
||||
|
||||
return pkt;
|
||||
@ -552,7 +552,6 @@ ng_pktsnip_t *ng_ndp_nbr_adv_build(uint8_t flags, ng_ipv6_addr_t *tgt,
|
||||
ng_pktsnip_t *options)
|
||||
{
|
||||
ng_pktsnip_t *pkt;
|
||||
ng_ndp_nbr_adv_t *nbr_adv;
|
||||
|
||||
DEBUG("ndp: building neighbor advertisement message\n");
|
||||
|
||||
@ -563,15 +562,14 @@ ng_pktsnip_t *ng_ndp_nbr_adv_build(uint8_t flags, ng_ipv6_addr_t *tgt,
|
||||
|
||||
pkt = ng_icmpv6_build(options, NG_ICMPV6_NBR_ADV, 0, sizeof(ng_ndp_nbr_adv_t));
|
||||
|
||||
if (pkt == NULL) {
|
||||
return NULL;
|
||||
if (pkt != NULL) {
|
||||
ng_ndp_nbr_adv_t *nbr_adv = pkt->data;
|
||||
nbr_adv->flags = (flags & NG_NDP_NBR_ADV_FLAGS_MASK);
|
||||
nbr_adv->resv[0] = nbr_adv->resv[1] = nbr_adv->resv[2] = 0;
|
||||
nbr_adv->tgt.u64[0].u64 = tgt->u64[0].u64;
|
||||
nbr_adv->tgt.u64[1].u64 = tgt->u64[1].u64;
|
||||
}
|
||||
|
||||
nbr_adv = pkt->data;
|
||||
nbr_adv->flags = (flags & NG_NDP_NBR_ADV_FLAGS_MASK);
|
||||
nbr_adv->resv[0] = nbr_adv->resv[1] = nbr_adv->resv[2] = 0;
|
||||
memcpy(&nbr_adv->tgt, tgt, sizeof(ng_ipv6_addr_t));
|
||||
|
||||
return pkt;
|
||||
}
|
||||
|
||||
@ -681,10 +679,10 @@ static void _send_nbr_sol(kernel_pid_t iface, ng_ipv6_addr_t *tgt,
|
||||
return;
|
||||
}
|
||||
|
||||
LL_PREPEND(pkt, hdr);
|
||||
|
||||
((ng_netif_hdr_t *)hdr->data)->if_pid = iface;
|
||||
|
||||
LL_PREPEND(pkt, hdr);
|
||||
|
||||
ng_netapi_send(ng_ipv6_pid, pkt);
|
||||
}
|
||||
|
||||
@ -759,10 +757,10 @@ static void _send_nbr_adv(kernel_pid_t iface, ng_ipv6_addr_t *tgt,
|
||||
return;
|
||||
}
|
||||
|
||||
LL_PREPEND(pkt, hdr);
|
||||
|
||||
((ng_netif_hdr_t *)hdr->data)->if_pid = iface;
|
||||
|
||||
LL_PREPEND(pkt, hdr);
|
||||
|
||||
if (ng_ipv6_netif_addr_is_non_unicast(tgt)) {
|
||||
/* avoid collision for anycast addresses
|
||||
* (see https://tools.ietf.org/html/rfc4861#section-7.2.7) */
|
||||
|
Loading…
Reference in New Issue
Block a user