|
41 | 41 |
|
42 | 42 | #include "netdev/netdev.h"
|
43 | 43 | #include "arp/arp.h"
|
| 44 | +#include "net/if_arp.h" |
44 | 45 | #include "neighbor/neighbor.h"
|
45 | 46 | #include "route/route.h"
|
46 | 47 | #include "netlink/netlink.h"
|
@@ -246,6 +247,44 @@ static_assert(sizeof(g_ifa_ipv6_policy) / sizeof(g_ifa_ipv6_policy[0]) ==
|
246 | 247 | ****************************************************************************/
|
247 | 248 |
|
248 | 249 | #ifndef CONFIG_NETLINK_DISABLE_GETLINK
|
| 250 | + |
| 251 | +static uint16_t netlink_convert_device_type(uint8_t lltype) |
| 252 | +{ |
| 253 | + switch (lltype) |
| 254 | + { |
| 255 | + case NET_LL_ETHERNET: |
| 256 | + return ARPHRD_ETHER; |
| 257 | + |
| 258 | + case NET_LL_IEEE80211: |
| 259 | + return ARPHRD_IEEE80211; |
| 260 | + |
| 261 | + case NET_LL_LOOPBACK: |
| 262 | + return ARPHRD_LOOPBACK; |
| 263 | + |
| 264 | + case NET_LL_SLIP: |
| 265 | + return ARPHRD_SLIP; |
| 266 | + |
| 267 | + case NET_LL_TUN: |
| 268 | + case NET_LL_BLUETOOTH: |
| 269 | + case NET_LL_PKTRADIO: |
| 270 | + case NET_LL_MBIM: |
| 271 | + return ARPHRD_NONE; |
| 272 | + |
| 273 | + case NET_LL_IEEE802154: |
| 274 | + return ARPHRD_IEEE802154; |
| 275 | + |
| 276 | + case NET_LL_CAN: |
| 277 | + return ARPHRD_CAN; |
| 278 | + |
| 279 | + case NET_LL_CELL: |
| 280 | + return ARPHRD_PHONET_PIPE; |
| 281 | + |
| 282 | + default: |
| 283 | + nerr("ERROR: invalid lltype %d\n", lltype); |
| 284 | + return ARPHRD_VOID; |
| 285 | + } |
| 286 | +} |
| 287 | + |
249 | 288 | static FAR struct netlink_response_s *
|
250 | 289 | netlink_get_device(FAR struct net_driver_s *dev,
|
251 | 290 | FAR const struct nlroute_sendto_request_s *req)
|
@@ -275,7 +314,7 @@ netlink_get_device(FAR struct net_driver_s *dev,
|
275 | 314 | resp->hdr.nlmsg_pid = req ? req->hdr.nlmsg_pid : 0;
|
276 | 315 |
|
277 | 316 | resp->iface.ifi_family = req ? req->gen.rtgen_family : AF_PACKET;
|
278 |
| - resp->iface.ifi_type = dev->d_lltype; |
| 317 | + resp->iface.ifi_type = netlink_convert_device_type(dev->d_lltype); |
279 | 318 | #ifdef CONFIG_NETDEV_IFINDEX
|
280 | 319 | resp->iface.ifi_index = dev->d_ifindex;
|
281 | 320 | #endif
|
|
0 commit comments