diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 5532a0c159..af334bfbf7 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -139,6 +139,17 @@ typedef enum { NETOPT_TX_END_IRQ, NETOPT_AUTOCCA, /**< en/disable to check automatically * before sending the channel is clear. */ + + /** + * @brief read-only check for a wired interface. + * + * If the interface is wireless this function will return -ENOTSUP, a + * positive value otherwise. + * + * @note Setting this option will always return -EONOTSUP. + */ + NETOPT_IS_WIRED, + /* add more options if needed */ /** diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index 6c05246642..84505c6ef6 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -46,6 +46,7 @@ static const char *_netopt_strmap[] = { [NETOPT_TX_START_IRQ] = "NETOPT_TX_START_IRQ", [NETOPT_TX_END_IRQ] = "NETOPT_TX_END_IRQ", [NETOPT_AUTOCCA] = "NETOPT_AUTOCCA", + [NETOPT_IS_WIRED] = "NETOPT_IS_WIRED", [NETOPT_NUMOF] = "NETOPT_NUMOF", }; diff --git a/sys/net/gnrc/link_layer/netdev_eth/gnrc_netdev_eth.c b/sys/net/gnrc/link_layer/netdev_eth/gnrc_netdev_eth.c index 04659180d5..8b78893689 100644 --- a/sys/net/gnrc/link_layer/netdev_eth/gnrc_netdev_eth.c +++ b/sys/net/gnrc/link_layer/netdev_eth/gnrc_netdev_eth.c @@ -273,6 +273,10 @@ static int _get(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t max_len) DEBUG("promiscous mode\n"); return _get_promiscousmode((gnrc_netdev_eth_t *)dev, value, max_len); + case NETOPT_IS_WIRED: + DEBUG("is wired\n"); + return 1; + default: DEBUG("[not supported: %d]\n", opt); return -ENOTSUP;