1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: remove NETOPT_IPV6_IID dependency from lwip_sock_ip

This commit is contained in:
Martine Lenders 2019-03-29 13:13:17 +01:00
parent 31f72e29be
commit 397adf79ca
2 changed files with 6 additions and 36 deletions

View File

@ -29,6 +29,7 @@ ifneq (0, $(LWIP_IPV6))
endif
USEMODULE += inet_csum
USEMODULE += l2util
USEMODULE += lwip_netdev
USEMODULE += lwip_sock_ip
USEMODULE += netdev_eth

View File

@ -50,14 +50,6 @@ static kernel_pid_t _check_pid = KERNEL_PID_UNDEF;
static mutex_t _netdev_buffer_mutex = MUTEX_INIT;
static uint8_t _netdev_buffer_size;
static inline void _get_iid(uint8_t *iid)
{
uint8_t _local_ip[] = _TEST_ADDR6_LOCAL;
memcpy(iid, &_local_ip[8], sizeof(uint64_t));
iid[0] ^= 0x2;
}
static int _get_max_pkt_size(netdev_t *dev, void *value, size_t max_len)
{
return netdev_eth_get(dev, NETOPT_MAX_PDU_SIZE, value, max_len);
@ -79,24 +71,13 @@ static int _get_src_len(netdev_t *dev, void *value, size_t max_len)
static int _get_addr(netdev_t *dev, void *value, size_t max_len)
{
uint8_t iid[ETHERNET_ADDR_LEN + 2];
uint8_t *addr = value;
static const uint8_t _local_ip[] = _TEST_ADDR6_LOCAL;
(void)dev;
if (max_len < ETHERNET_ADDR_LEN) {
return -EOVERFLOW;
}
_get_iid(iid);
addr[0] = iid[0];
addr[1] = iid[1];
addr[2] = iid[2];
addr[3] = iid[5];
addr[4] = iid[6];
addr[5] = iid[7];
return ETHERNET_ADDR_LEN;
assert(max_len >= ETHERNET_ADDR_LEN);
return l2util_ipv6_iid_to_addr(NETDEV_TYPE_ETHERNET,
(eui64_t *)&_local_ip[8],
value);
}
static int _get_addr_len(netdev_t *dev, void *value, size_t max_len)
@ -109,16 +90,6 @@ static int _get_device_type(netdev_t *dev, void *value, size_t max_len)
return netdev_eth_get(dev, NETOPT_DEVICE_TYPE, value, max_len);
}
static int _get_ipv6_iid(netdev_t *dev, void *value, size_t max_len)
{
(void)dev;
if (max_len != sizeof(uint64_t)) {
return -EOVERFLOW;
}
_get_iid(value);
return sizeof(uint64_t);
}
static void _netdev_isr(netdev_t *dev)
{
dev->event_callback(dev, NETDEV_EVENT_RX_COMPLETE);
@ -181,8 +152,6 @@ void _net_init(void)
_get_addr_len);
netdev_test_set_get_cb(&netdev, NETOPT_DEVICE_TYPE,
_get_device_type);
netdev_test_set_get_cb(&netdev, NETOPT_IPV6_IID,
_get_ipv6_iid);
netdev_test_set_recv_cb(&netdev, _netdev_recv);
netdev_test_set_isr_cb(&netdev, _netdev_isr);
/* netdev needs to be set-up */