net/arp: change arptable struct from arp_entry_s to arpreq
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
1a81a936df
commit
c74cb1aaa5
@ -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)
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user