diff --git a/net/arp/arp.h b/net/arp/arp.h index 9e477b15fc..da9ff4a4b9 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -489,7 +489,7 @@ void arp_hdr_update(FAR struct net_driver_s *dev, FAR uint16_t *pipaddr, ****************************************************************************/ #ifdef CONFIG_NETLINK_ROUTE -unsigned int arp_snapshot(FAR struct arp_entry_s *snapshot, +unsigned int arp_snapshot(FAR struct arpreq *snapshot, unsigned int nentries); #else # define arp_snapshot(s,n) (0) diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 1f940453e6..da8ccb343d 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -456,10 +456,11 @@ void arp_cleanup(FAR struct net_driver_s *dev) ****************************************************************************/ #ifdef CONFIG_NETLINK_ROUTE -unsigned int arp_snapshot(FAR struct arp_entry_s *snapshot, +unsigned int arp_snapshot(FAR struct arpreq *snapshot, unsigned int nentries) { FAR struct arp_entry_s *tabptr; + FAR struct sockaddr_in *outaddr; clock_t now; unsigned int ncopied; int i; @@ -474,7 +475,16 @@ unsigned int arp_snapshot(FAR struct arp_entry_s *snapshot, if (tabptr->at_ipaddr != 0 && now - tabptr->at_time <= ARP_MAXAGE_TICK) { - memcpy(&snapshot[ncopied], tabptr, sizeof(struct arp_entry_s)); + outaddr = (FAR struct sockaddr_in *)&snapshot[ncopied].arp_pa; + outaddr->sin_family = AF_INET; + outaddr->sin_port = 0; + outaddr->sin_addr.s_addr = tabptr->at_ipaddr; + memcpy(snapshot[ncopied].arp_ha.sa_data, + tabptr->at_ethaddr.ether_addr_octet, + sizeof(struct ether_addr)); + strlcpy((FAR char *)snapshot[ncopied].arp_dev, + tabptr->at_dev->d_ifname, + sizeof(snapshot[ncopied].arp_dev)); ncopied++; } } diff --git a/net/netlink/netlink_route.c b/net/netlink/netlink_route.c index 4e09229bbc..f42200a691 100644 --- a/net/netlink/netlink_route.c +++ b/net/netlink/netlink_route.c @@ -357,7 +357,7 @@ static int netlink_get_arptable(NETLINK_HANDLE handle, * the number of valid entries in the ARP table. */ - tabsize = CONFIG_NET_ARPTAB_SIZE * sizeof(struct arp_entry_s); + tabsize = CONFIG_NET_ARPTAB_SIZE * sizeof(struct arpreq); rspsize = SIZEOF_NLROUTE_RECVFROM_RESPONSE_S(tabsize); allocsize = SIZEOF_NLROUTE_RECVFROM_RSPLIST_S(tabsize); @@ -380,7 +380,7 @@ static int netlink_get_arptable(NETLINK_HANDLE handle, */ net_lock(); - ncopied = arp_snapshot((FAR struct arp_entry_s *)entry->payload.data, + ncopied = arp_snapshot((FAR struct arpreq *)entry->payload.data, CONFIG_NET_ARPTAB_SIZE); net_unlock(); @@ -392,7 +392,7 @@ static int netlink_get_arptable(NETLINK_HANDLE handle, { FAR struct getneigh_recvfrom_rsplist_s *newentry; - tabsize = ncopied * sizeof(struct arp_entry_s); + tabsize = ncopied * sizeof(struct arpreq); rspsize = SIZEOF_NLROUTE_RECVFROM_RESPONSE_S(tabsize); allocsize = SIZEOF_NLROUTE_RECVFROM_RSPLIST_S(tabsize);