1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

gnrc netif: add link-type indicator for IPv6 IFs

This commit is contained in:
Oleg Hahm 2015-08-24 00:24:16 +02:00
parent 4dbd491097
commit 61a61c35b1
2 changed files with 16 additions and 4 deletions

View File

@ -143,6 +143,11 @@ extern "C" {
*/
#define GNRC_IPV6_NETIF_FLAGS_ADV_CUR_HL (0x0010)
/**
* @brief Flag to indicate if the interface is operating over a wired link
*/
#define GNRC_IPV6_NETIF_FLAGS_IS_WIRED (0x2000)
/**
* @brief Flag to indicate that the interface has other address
* configuration.

View File

@ -695,7 +695,7 @@ void gnrc_ipv6_netif_init_by_dev(void)
for (size_t i = 0; i < ifnum; i++) {
ipv6_addr_t addr;
eui64_t iid;
uint16_t mtu;
uint16_t tmp;
gnrc_ipv6_netif_t *ipv6_if = gnrc_ipv6_netif_get(ifs[i]);
if (ipv6_if == NULL) {
@ -743,15 +743,22 @@ void gnrc_ipv6_netif_init_by_dev(void)
_add_addr_to_entry(ipv6_if, &addr, 64, 0);
/* set link MTU */
if ((gnrc_netapi_get(ifs[i], NETOPT_MAX_PACKET_SIZE, 0, &mtu,
if ((gnrc_netapi_get(ifs[i], NETOPT_MAX_PACKET_SIZE, 0, &tmp,
sizeof(uint16_t)) >= 0)) {
if (mtu >= IPV6_MIN_MTU) {
ipv6_if->mtu = mtu;
if (tmp >= IPV6_MIN_MTU) {
ipv6_if->mtu = tmp;
}
/* otherwise leave at GNRC_IPV6_NETIF_DEFAULT_MTU as initialized in
* gnrc_ipv6_netif_add() */
}
if (gnrc_netapi_get(ifs[i], NETOPT_IS_WIRED, 0, &tmp, sizeof(int)) > 0) {
ipv6_if->flags = GNRC_IPV6_NETIF_FLAGS_IS_WIRED;
}
else {
ipv6_if->flags = 0;
}
mutex_unlock(&ipv6_if->mutex);
}
}