freebsd-src/usr.sbin/arp/arp.h
Andrey V. Elsukov c26d6bf9da arp: fix adding proxy entries for P2P interfaces
The old rtsock implementation used in-kernel workaround to do so.
When route to specified destination address used P2P interface, the
kernel did the search with ifa_ifwithnet() for most suitable network
and then add proxy entry to this interface.

Use similar approach with netlink implementation. We already have
get_ether_addr() function that does almost the same thing as
ifa_ifwithnet(). Use it when we find that destination route uses
P2P interface and then try to guess suitable interface. This should
fix the use of netlink-based arp(8) in mpd5.

Rename get_ether_addr() to get_ifinfo(), since now it is used to find
only ifindex in case when hwaddr is specified by user.
Also make set_nl() and delete_nl() prototype similar to rtsock.
And allow '-i' to be used with '-S', since we already allow the same
for '-s'.

PR:		290221
Reported by:	eugen
Reviewed by:	eugen
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53113
2025-10-17 11:22:36 +03:00

22 lines
524 B
C

#ifndef _USR_SBIN_ARP_ARP_H_
#define _USR_SBIN_ARP_ARP_H_
int valid_type(int type);
int get_ifinfo(in_addr_t ipaddr, struct ether_addr *hwaddr, uint32_t *pifindex);
struct sockaddr_in *getaddr(char *host);
struct arp_opts {
bool aflag;
bool nflag;
time_t expire_time;
int flags;
char *rifname;
uint32_t rifindex;
};
extern struct arp_opts opts;
int print_entries_nl(uint32_t ifindex, struct in_addr addr);
int delete_nl(char *host);
int set_nl(struct sockaddr_in *dst, struct sockaddr_dl *sdl, char *host);
#endif