Remove an irritating diagnostic emitted to LogPHASE when a

static proxy arp entry is deleted.

Rename a function (for consistency) and remove some whitespace
(for readability).

MFC after:	1 week
This commit is contained in:
Brian Somers 2001-07-31 15:19:07 +00:00
parent 4ce050bf39
commit 65cacad456
3 changed files with 11 additions and 11 deletions

View File

@ -104,7 +104,7 @@ arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add, int s)
*/
memset(&arpmsg, 0, sizeof arpmsg);
if (!get_ether_addr(s, addr, &arpmsg.hwa)) {
if (!arp_EtherAddr(s, addr, &arpmsg.hwa, 0)) {
log_Printf(LogWARN, "%s: Cannot determine ethernet address for proxy ARP\n",
inet_ntoa(addr));
return 0;
@ -144,7 +144,6 @@ arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add, int s)
int
arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s)
{
return (arp_ProxySub(bundle, addr, 1, s));
}
@ -154,7 +153,6 @@ arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s)
int
arp_ClearProxy(struct bundle *bundle, struct in_addr addr, int s)
{
return (arp_ProxySub(bundle, addr, 0, s));
}
@ -178,7 +176,7 @@ arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s)
* Get the hardware address of an interface on the same subnet as our local
* address.
*/
if (!get_ether_addr(s, addr, &dls.sdl)) {
if (!arp_EtherAddr(s, addr, &dls.sdl, 1)) {
log_Printf(LOG_PHASE_BIT, "Cannot determine ethernet address for "
"proxy ARP\n");
return 0;
@ -220,12 +218,13 @@ arp_ClearProxy(struct bundle *bundle, struct in_addr addr, int s)
/*
* get_ether_addr - get the hardware address of an interface on the
* arp_EtherAddr - get the hardware address of an interface on the
* the same subnet as ipaddr.
*/
int
get_ether_addr(int s, struct in_addr ipaddr, struct sockaddr_dl *hwaddr)
arp_EtherAddr(int s, struct in_addr ipaddr, struct sockaddr_dl *hwaddr,
int verbose)
{
int mib[6], skip;
size_t needed;
@ -243,7 +242,7 @@ get_ether_addr(int s, struct in_addr ipaddr, struct sockaddr_dl *hwaddr)
mib[5] = 0;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) {
log_Printf(LogERROR, "get_ether_addr: sysctl: estimate: %s\n",
log_Printf(LogERROR, "arp_EtherAddr: sysctl: estimate: %s\n",
strerror(errno));
return 0;
}
@ -299,8 +298,9 @@ get_ether_addr(int s, struct in_addr ipaddr, struct sockaddr_dl *hwaddr)
if ((ifa->sin_addr.s_addr & netmask->sin_addr.s_addr) ==
(ipaddr.s_addr & netmask->sin_addr.s_addr)) {
log_Printf(LogPHASE, "Found interface %.*s for %s\n",
dl->sdl_alen, dl->sdl_data, inet_ntoa(ipaddr));
log_Printf(verbose ? LogPHASE : LogDEBUG,
"Found interface %.*s for %s\n", dl->sdl_alen,
dl->sdl_data, inet_ntoa(ipaddr));
memcpy(hwaddr, dl, dl->sdl_len);
free(buf);
return 1;

View File

@ -33,4 +33,4 @@ struct bundle;
extern int arp_ClearProxy(struct bundle *, struct in_addr, int);
extern int arp_SetProxy(struct bundle *, struct in_addr, int);
extern int get_ether_addr(int, struct in_addr, struct sockaddr_dl *);
extern int arp_EtherAddr(int, struct in_addr, struct sockaddr_dl *, int);

View File

@ -998,7 +998,7 @@ mp_SetEnddisc(struct cmdargs const *arg)
log_Printf(LogERROR, "set enddisc: socket(): %s\n", strerror(errno));
return 2;
}
if (get_ether_addr(s, addr, &hwaddr)) {
if (arp_EtherAddr(s, addr, &hwaddr, 1)) {
mp->cfg.enddisc.class = ENDDISC_MAC;
memcpy(mp->cfg.enddisc.address, hwaddr.sdl_data + hwaddr.sdl_nlen,
hwaddr.sdl_alen);