47 lines
1.3 KiB
Plaintext
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:
|