From 65cacad456f79cf0e9012e053f9294fcded7ceee Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Tue, 31 Jul 2001 15:19:07 +0000 Subject: [PATCH] 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 --- usr.sbin/ppp/arp.c | 18 +++++++++--------- usr.sbin/ppp/arp.h | 2 +- usr.sbin/ppp/mp.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index 9d89c0d396a..e5dcea19b0d 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -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; diff --git a/usr.sbin/ppp/arp.h b/usr.sbin/ppp/arp.h index cd5056ee8c7..ac0a1cae728 100644 --- a/usr.sbin/ppp/arp.h +++ b/usr.sbin/ppp/arp.h @@ -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); diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 448b9e29eee..8892cd26e41 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/ppp/mp.c @@ -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);