From bd5558bfbfc2a9eb0db8ffe10b3e8c4c2ccec0c8 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Mon, 23 Dec 2024 10:10:23 +0800 Subject: [PATCH] include/netinet/arp.h: change the type of arp_dev from uint8_t to char the same variable type in linux is char, in order to avoid modifying the third-party library code when porting the third-party library code. Signed-off-by: zhanghongyu --- include/netinet/arp.h | 2 +- net/arp/arp_table.c | 3 +-- net/netdev/netdev_ioctl.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/netinet/arp.h b/include/netinet/arp.h index 5a310c5dc47da..7fd7d43c3e952 100644 --- a/include/netinet/arp.h +++ b/include/netinet/arp.h @@ -71,7 +71,7 @@ struct aligned_data(sizeof(uint32_t)) arpreq struct sockaddr arp_ha; /* Hardware address */ struct sockaddr arp_netmask; /* Netmask of protocol address */ uint8_t arp_flags; /* Flags */ - uint8_t arp_dev[IFNAMSIZ + 1]; /* Device name (zero terminated) */ + char arp_dev[IFNAMSIZ + 1]; /* Device name (zero terminated) */ }; /**************************************************************************** diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 9e5a0a771e27c..595f262dd7db8 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -243,8 +243,7 @@ static void arp_get_arpreq(FAR struct arpreq *output, outaddr->sin_addr.s_addr = input->at_ipaddr; memcpy(output->arp_ha.sa_data, input->at_ethaddr.ether_addr_octet, sizeof(struct ether_addr)); - strlcpy((FAR char *)output->arp_dev, input->at_dev->d_ifname, - sizeof(output->arp_dev)); + strlcpy(output->arp_dev, input->at_dev->d_ifname, sizeof(output->arp_dev)); } #endif diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index e1749eedcd76a..e754be749d388 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -1361,7 +1361,7 @@ static bool ioctl_arpreq_parse(FAR struct arpreq *req, { *addr = (FAR struct sockaddr_in *)&req->arp_pa; *dev = req->arp_dev[0] != '\0' ? - netdev_findbyname((FAR const char *)req->arp_dev) : + netdev_findbyname(req->arp_dev) : netdev_findby_ripv4addr(INADDR_ANY, (*addr)->sin_addr.s_addr); return true; }