openbsd-ports/sysutils/moreutils/patches/patch-ifdata_c
sthen d94d6330a1 import sysutils/moreutils: ok dcoppa@
moreutils is a growing collection of the unix tools that nobody thought
to write long ago when unix was young, including amongst others:

lckdo: execute a program with a lock held
mispipe: pipe two commands, returning the exit status of the first
pee: tee standard input to pipes
sponge: soak up standard input and write to a file
ts: timestamp standard input
vidir: edit a directory in your text editor
vipe: insert a text editor into a pipe
zrun: automatically uncompress arguments to command
2011-05-04 14:11:59 +00:00

47 lines
1.3 KiB
Plaintext

$OpenBSD: patch-ifdata_c,v 1.1.1.1 2011/05/04 14:11:59 sthen Exp $
--- ifdata.c.orig Fri Apr 29 17:12:23 2011
+++ ifdata.c Fri Apr 29 17:19:47 2011
@@ -10,10 +10,14 @@
#include <linux/if.h>
#endif
-#if defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
#include <net/if.h>
#endif
+#ifndef s6_addr16
+#define s6_addr16 __u6_addr.__u6_addr16
+#endif
+
#include <netinet/in.h>
#include <errno.h>
#include <fcntl.h>
@@ -220,7 +224,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))
@@ -388,7 +392,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));
@@ -400,7 +404,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: