Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netdev: remove NETOPT_IPV6_IID support for network devices #14354

Merged
merged 8 commits into from
Jun 25, 2020
12 changes: 0 additions & 12 deletions cpu/nrf5x_common/radio/nrfmin/nrfmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,6 @@ uint16_t nrfmin_get_addr(void)
return my_addr;
}

void nrfmin_get_iid(uint16_t *iid)
{
iid[0] = 0;
iid[1] = 0xff00;
iid[2] = 0x00fe;
iid[3] = my_addr;
}

uint16_t nrfmin_get_channel(void)
{
return (uint16_t)(NRF_RADIO->FREQUENCY >> 2);
Expand Down Expand Up @@ -506,10 +498,6 @@ static int nrfmin_get(netdev_t *dev, netopt_t opt, void *val, size_t max_len)
assert(max_len >= sizeof(uint16_t));
*((uint16_t *)val) = NETDEV_TYPE_NRFMIN;
return sizeof(uint16_t);
case NETOPT_IPV6_IID:
assert(max_len >= sizeof(uint64_t));
nrfmin_get_iid((uint16_t *)val);
return sizeof(uint64_t);
default:
return -ENOTSUP;
}
Expand Down
26 changes: 1 addition & 25 deletions drivers/cc110x/cc110x_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,26 +505,6 @@ static int cc110x_send(netdev_t *netdev, const iolist_t *iolist)
return (int)size;
}

/**
* @brief Generate an IPv6 interface identifier for a CC110X transceiver
*
* @param dev Transceiver to create the IPv6 interface identifier (IID)
* @param iid Store the generated IID here
*
* @return Returns the size of @ref eui64_t to confirm with the API
* in @ref netdev_driver_t::get
*/
static int cc110x_get_iid(cc110x_t *dev, eui64_t *iid)
{
static const eui64_t empty_iid = {
.uint8 = { 0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x00 }
};

*iid = empty_iid;
iid->uint8[7] = dev->addr;
return sizeof(eui64_t);
}

/**
* @brief Checks if the CC110x's address filter is disabled
* @param dev Transceiver to check if in promiscuous mode
Expand All @@ -551,6 +531,7 @@ static int cc110x_get(netdev_t *netdev, netopt_t opt,
{
cc110x_t *dev = (cc110x_t *)netdev;

(void)max_len; /* only used in assert() */
switch (opt) {
case NETOPT_DEVICE_TYPE:
assert(max_len == sizeof(uint16_t));
Expand All @@ -574,11 +555,6 @@ static int cc110x_get(netdev_t *netdev, netopt_t opt,
assert(max_len >= CC1XXX_ADDR_SIZE);
*((uint8_t *)val) = dev->addr;
return CC1XXX_ADDR_SIZE;
case NETOPT_IPV6_IID:
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}
return cc110x_get_iid(dev, val);
case NETOPT_CHANNEL:
assert(max_len == sizeof(uint16_t));
*((uint16_t *)val) = dev->channel;
Expand Down
21 changes: 4 additions & 17 deletions drivers/netdev_eth/netdev_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,14 @@
#define ENABLE_DEBUG (0)
#include "debug.h"

static int _get_iid(netdev_t *netdev, eui64_t *value, size_t max_len)
{
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}

eui48_t mac;
netdev->driver->get(netdev, NETOPT_ADDRESS, mac.uint8, sizeof(eui48_t));
eui48_to_ipv6_iid(value, &mac);

return sizeof(eui64_t);
}

int netdev_eth_get(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
{
int res = 0;

#ifndef MODULE_L2FILTER
(void)dev;
#endif
(void)max_len; /* only used in assert() */
switch (opt) {
case NETOPT_DEVICE_TYPE:
{
Expand Down Expand Up @@ -76,10 +67,6 @@ int netdev_eth_get(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
res = 1;
break;
}
case NETOPT_IPV6_IID:
{
return _get_iid(dev, value, max_len);
}
#ifdef MODULE_L2FILTER
case NETOPT_L2FILTER:
{
Expand Down
28 changes: 1 addition & 27 deletions drivers/netdev_ieee802154/netdev_ieee802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@
#define ENABLE_DEBUG (0)
#include "debug.h"

static int _get_iid(netdev_ieee802154_t *dev, eui64_t *value, size_t max_len)
{
(void)max_len;

uint8_t addr[IEEE802154_LONG_ADDRESS_LEN];
uint16_t addr_len;

assert(max_len >= sizeof(eui64_t));

dev->netdev.driver->get(&dev->netdev, NETOPT_SRC_LEN, &addr_len,
sizeof(addr_len));
if (addr_len == IEEE802154_LONG_ADDRESS_LEN) {
dev->netdev.driver->get(&dev->netdev, NETOPT_ADDRESS_LONG, addr,
addr_len);
}
else {
dev->netdev.driver->get(&dev->netdev, NETOPT_ADDRESS, addr,
addr_len);
}
ieee802154_get_iid(value, addr, addr_len);

return sizeof(eui64_t);
}

void netdev_ieee802154_reset(netdev_ieee802154_t *dev)
{
/* Only the least significant byte of the random value is used */
Expand Down Expand Up @@ -106,6 +82,7 @@ int netdev_ieee802154_get(netdev_ieee802154_t *dev, netopt_t opt, void *value,
{
int res = -ENOTSUP;

(void)max_len; /* only used in assert() */
switch (opt) {
case NETOPT_ADDRESS:
assert(max_len >= sizeof(dev->short_addr));
Expand Down Expand Up @@ -170,9 +147,6 @@ int netdev_ieee802154_get(netdev_ieee802154_t *dev, netopt_t opt, void *value,
*((uint16_t *)value) = NETDEV_TYPE_IEEE802154;
res = sizeof(uint16_t);
break;
case NETOPT_IPV6_IID:
res = _get_iid(dev, value, max_len);
break;
#ifdef MODULE_L2FILTER
case NETOPT_L2FILTER:
assert(max_len >= sizeof(l2filter_t **));
Expand Down
13 changes: 0 additions & 13 deletions drivers/xbee/xbee.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,19 +763,6 @@ static int xbee_get(netdev_t *ndev, netopt_t opt, void *value, size_t max_len)
assert(max_len == sizeof(uint16_t));
*((uint16_t *)value) = NETDEV_TYPE_IEEE802154;
return sizeof(uint16_t);
case NETOPT_IPV6_IID:
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}
if (dev->addr_flags & XBEE_ADDR_FLAGS_LONG) {
ieee802154_get_iid(value, dev->addr_long.uint8,
IEEE802154_LONG_ADDRESS_LEN);
}
else {
ieee802154_get_iid(value, dev->addr_short,
IEEE802154_SHORT_ADDRESS_LEN);
}
return sizeof(eui64_t);
case NETOPT_CHANNEL:
return _get_channel(dev, (uint8_t *)value, max_len);
case NETOPT_MAX_PDU_SIZE:
Expand Down
4 changes: 0 additions & 4 deletions pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ static int _netdev_get(netdev_t *netdev, netopt_t opt,
*((uint16_t *)value) = NETDEV_TYPE_BLE;
res = sizeof(uint16_t);
break;
case NETOPT_IPV6_IID:
eui48_to_ipv6_iid((eui64_t *)value, (eui48_t *)_ble_netif->l2addr);
res = sizeof(uint64_t);
break;
default:
break;
}
Expand Down
7 changes: 3 additions & 4 deletions sys/include/net/netopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ typedef enum {
* RFC 4291, section 2.5.1
* </a>
*
* @deprecated Do not implement this in a network device. Other APIs
* utilizing [netopt](@ref net_netopt) may still implement it.
* Existing support of drivers will be dropped after the
* 2019.07 release.
* @note Do not implement this in a network device driver. Other APIs
* utilizing [netopt](@ref net_netopt) such as @ref net_gnrc_netif
* or @ref net_netif may still implement it.
*
* The generation of the interface identifier is dependent on the link-layer.
* Please refer to the appropriate IPv6 over `<link>` specification for
Expand Down
6 changes: 0 additions & 6 deletions tests/gnrc_ipv6_nib_6ln/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,6 @@ int _mock_netif_get(gnrc_netapi_opt_t *opt)
*val = sizeof(_loc_l2);
return sizeof(uint16_t);
}
case NETOPT_IPV6_IID:
if (opt->data_len < sizeof(_loc_iid)) {
return -EOVERFLOW;
}
memcpy(opt->data, _loc_iid, sizeof(_loc_iid));
return sizeof(_loc_iid);
case NETOPT_IS_WIRED:
return 1;
case NETOPT_MAX_PDU_SIZE: {
Expand Down