summaryrefslogtreecommitdiff
path: root/ifdata.c
diff options
context:
space:
mode:
authorMichael Reed <m.reed@mykolab.com>2016-01-06 15:24:30 -0500
committerJoey Hess <joeyh@joeyh.name>2016-01-07 18:27:52 -0400
commit2929eeaf06c42e1f3a3fc07831d585e637432ad3 (patch)
tree53aeab480c703ac418e9e003b6e9b7ff39ea2b30 /ifdata.c
parentb92196912d363683f24e71b0b2351324d50f5375 (diff)
downloadmoreutils-2929eeaf06c42e1f3a3fc07831d585e637432ad3.tar.gz
ifdata.c: Fix compilation on OpenBSD
OpenBSD's <net/if_var.h> already defines `if_mtu'. Original patch: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/moreutils/patches/patch-ifdata_c
Diffstat (limited to 'ifdata.c')
-rw-r--r--ifdata.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ifdata.c b/ifdata.c
index 4210b75..99f30e9 100644
--- a/ifdata.c
+++ b/ifdata.c
@@ -18,7 +18,7 @@
#include <net/if.h>
#endif
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__OpenBSD__)
#define s6_addr16 __u6_addr.__u6_addr16
#include <net/if.h>
#endif
@@ -242,7 +242,7 @@ struct sockaddr *if_network(const char *iface) {
return saddr;
}
-int if_mtu(const char *iface) {
+int ifd_if_mtu(const char *iface) {
static struct ifreq req;
if (do_socket_ioctl(iface, SIOCGIFMTU, &req, NULL, PRINT_ERROR))
@@ -420,7 +420,7 @@ void please_do(int ndo, int *todo, const char *ifname) {
print_addr(if_bcast(ifname, &req));
break;
case DO_PMTU:
- printf("%d", if_mtu(ifname));
+ printf("%d", ifd_if_mtu(ifname));
break;
case DO_PNETWORK:
print_addr(if_network(ifname));
@@ -432,7 +432,7 @@ void please_do(int ndo, int *todo, const char *ifname) {
printf(" ");
print_addr(if_bcast(ifname, &req));
printf(" ");
- printf("%d", if_mtu(ifname));
+ printf("%d", ifd_if_mtu(ifname));
break;
#if defined(__linux__)
case DO_SINPACKETS: