Merge pull request #11299 from llueder/ndp_cpp_compliant
net/ndp: make addr array ptr c++ compliant
This commit is contained in:
commit
062bc732ea
@ -334,10 +334,27 @@ typedef struct __attribute__((packed)) {
|
|||||||
} ndp_opt_mtu_t;
|
} ndp_opt_mtu_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recursive DNS server option format
|
* @brief Recursive DNS server option format without payload
|
||||||
* @extends ndp_opt_t
|
* @extends ndp_opt_t
|
||||||
*
|
*
|
||||||
* @see [RFC 8106, section 5.1](https://tools.ietf.org/html/rfc8106#section-5.1)
|
* @see [RFC 8106, section 5.1](https://tools.ietf.org/html/rfc8106#section-5.1)
|
||||||
|
* @see ndp_opt_rdnss_impl_t
|
||||||
|
*/
|
||||||
|
typedef struct __attribute__((packed)) {
|
||||||
|
uint8_t type; /**< option type */
|
||||||
|
uint8_t len; /**< length in units of 8 octets */
|
||||||
|
network_uint16_t resv; /**< reserved field */
|
||||||
|
network_uint32_t ltime; /**< lifetime in seconds */
|
||||||
|
} ndp_opt_rdnss_t;
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
/**
|
||||||
|
* @brief Recursive DNS server option format with payload
|
||||||
|
* @extends ndp_opt_rdnss_t
|
||||||
|
* @details Auxiliary struct that contains a zero-length array as convenience
|
||||||
|
* pointer to the addresses. Only for use in C, invalid in ISO-C++.
|
||||||
|
*
|
||||||
|
* @see [RFC 8106, section 5.1](https://tools.ietf.org/html/rfc8106#section-5.1)
|
||||||
*/
|
*/
|
||||||
typedef struct __attribute__((packed)) {
|
typedef struct __attribute__((packed)) {
|
||||||
uint8_t type; /**< option type */
|
uint8_t type; /**< option type */
|
||||||
@ -345,7 +362,8 @@ typedef struct __attribute__((packed)) {
|
|||||||
network_uint16_t resv; /**< reserved field */
|
network_uint16_t resv; /**< reserved field */
|
||||||
network_uint32_t ltime; /**< lifetime in seconds */
|
network_uint32_t ltime; /**< lifetime in seconds */
|
||||||
ipv6_addr_t addrs[]; /**< addresses of IPv6 recursive DNS servers */
|
ipv6_addr_t addrs[]; /**< addresses of IPv6 recursive DNS servers */
|
||||||
} ndp_opt_rdnss_t;
|
} ndp_opt_rdnss_impl_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -413,7 +413,7 @@ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
|||||||
const ndp_opt_mtu_t *mtuo);
|
const ndp_opt_mtu_t *mtuo);
|
||||||
#if GNRC_IPV6_NIB_CONF_DNS
|
#if GNRC_IPV6_NIB_CONF_DNS
|
||||||
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
||||||
const ndp_opt_rdnss_t *rdnsso);
|
const ndp_opt_rdnss_impl_t *rdnsso);
|
||||||
#endif
|
#endif
|
||||||
#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
|
#if GNRC_IPV6_NIB_CONF_MULTIHOP_P6C
|
||||||
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
||||||
@ -732,7 +732,7 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
|
|||||||
case NDP_OPT_RDNSS:
|
case NDP_OPT_RDNSS:
|
||||||
next_timeout = _min(_handle_rdnsso(netif,
|
next_timeout = _min(_handle_rdnsso(netif,
|
||||||
(icmpv6_hdr_t *)rtr_adv,
|
(icmpv6_hdr_t *)rtr_adv,
|
||||||
(ndp_opt_rdnss_t *)opt),
|
(ndp_opt_rdnss_impl_t *)opt),
|
||||||
next_timeout);
|
next_timeout);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -1352,7 +1352,7 @@ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
|||||||
|
|
||||||
#if GNRC_IPV6_NIB_CONF_DNS
|
#if GNRC_IPV6_NIB_CONF_DNS
|
||||||
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
|
||||||
const ndp_opt_rdnss_t *rdnsso)
|
const ndp_opt_rdnss_impl_t *rdnsso)
|
||||||
{
|
{
|
||||||
uint32_t ltime = UINT32_MAX;
|
uint32_t ltime = UINT32_MAX;
|
||||||
const ipv6_addr_t *addr;
|
const ipv6_addr_t *addr;
|
||||||
|
|||||||
@ -234,7 +234,7 @@ gnrc_pktsnip_t *gnrc_ndp_opt_rdnss_build(uint32_t ltime, ipv6_addr_t *addrs,
|
|||||||
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_RDNSS, opt_size, next);
|
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_RDNSS, opt_size, next);
|
||||||
|
|
||||||
if (pkt != NULL) {
|
if (pkt != NULL) {
|
||||||
ndp_opt_rdnss_t *rdnss_opt = pkt->data;
|
ndp_opt_rdnss_impl_t *rdnss_opt = pkt->data;
|
||||||
rdnss_opt->resv.u16 = 0;
|
rdnss_opt->resv.u16 = 0;
|
||||||
rdnss_opt->ltime = byteorder_htonl(ltime);
|
rdnss_opt->ltime = byteorder_htonl(ltime);
|
||||||
for (unsigned i = 0; i < addrs_num; i++) {
|
for (unsigned i = 0; i < addrs_num; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user