summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-10-15 10:19:24 +0000
committerglebius <glebius@FreeBSD.org>2013-10-15 10:19:24 +0000
commit1c87562bdb8818f73d1face0bb6c8f2d02fb4ce4 (patch)
tree1532e1c4b17329547e57e8b1a2f1be2c9432e684
parent870799d07ae4a7419826ef3a32e06efdd0b376e9 (diff)
downloadFreeBSD-src-1c87562bdb8818f73d1face0bb6c8f2d02fb4ce4.zip
FreeBSD-src-1c87562bdb8818f73d1face0bb6c8f2d02fb4ce4.tar.gz
Hide 'struct ifaddr' definition from userland. Two tools left that use it,
namely ipftest(1) and ifmcstat(1). These sniff structure definition using _WANT_IFADDR define. Sponsored by: Netflix Sponsored by: Nginx, Inc.
-rw-r--r--contrib/ipfilter/ipf.h7
-rw-r--r--sys/net/if_var.h3
-rw-r--r--sys/netinet/in_var.h2
-rw-r--r--sys/netinet6/in6_var.h2
-rw-r--r--sys/netipx/ipx_if.h3
-rw-r--r--usr.sbin/ifmcstat/ifmcstat.c1
6 files changed, 14 insertions, 4 deletions
diff --git a/contrib/ipfilter/ipf.h b/contrib/ipfilter/ipf.h
index 280f98d..d4bd524 100644
--- a/contrib/ipfilter/ipf.h
+++ b/contrib/ipfilter/ipf.h
@@ -42,9 +42,10 @@ struct file;
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
-#if __FreeBSD_version >= 300000
-# include <net/if_var.h>
-#endif
+
+#define _WANT_IFADDR
+#include <net/if_var.h>
+
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 3288a4f..58121f5 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -788,6 +788,7 @@ drbr_inuse(struct ifnet *ifp, struct buf_ring *br)
* chunk of malloc'ed memory, where we store the three addresses
* (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here.
*/
+#if defined(_KERNEL) || defined(_WANT_IFADDR)
struct ifaddr {
struct sockaddr *ifa_addr; /* address of interface */
struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
@@ -806,6 +807,8 @@ struct ifaddr {
(struct ifaddr *, struct sockaddr *);
struct mtx ifa_mtx;
};
+#endif
+
#define IFA_ROUTE RTF_UP /* route installed */
#define IFA_RTSELF RTF_HOST /* loopback route to self installed */
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 8657dbb..9143cff 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -50,6 +50,7 @@ struct in_ifinfo {
struct in_multi *ii_allhosts; /* 224.0.0.1 membership */
};
+#if defined(_KERNEL) || defined(_WANT_IFADDR)
/*
* Interface address, Internet version. One of these structures
* is allocated for each Internet address on an interface.
@@ -70,6 +71,7 @@ struct in_ifaddr {
#define ia_broadaddr ia_dstaddr
struct sockaddr_in ia_sockmask; /* reserve space for general netmask */
};
+#endif
struct in_aliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 09928b3..229cc33 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -110,6 +110,7 @@ struct in6_ifextra {
#define LLTABLE6(ifp) (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable)
+#if defined(_KERNEL) || defined(_WANT_IFADDR)
struct in6_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
@@ -140,6 +141,7 @@ struct in6_ifaddr {
/* List of in6_ifaddr's. */
TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr);
LIST_HEAD(in6_ifaddrlisthead, in6_ifaddr);
+#endif
/* control structure to manage address selection policy */
struct in6_addrpolicy {
diff --git a/sys/netipx/ipx_if.h b/sys/netipx/ipx_if.h
index ab5ee79..7725b4a 100644
--- a/sys/netipx/ipx_if.h
+++ b/sys/netipx/ipx_if.h
@@ -70,7 +70,7 @@
* The ifaddr structure contains the protocol-independent part
* of the structure and is assumed to be first.
*/
-
+#ifdef _KERNEL
struct ipx_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
@@ -81,6 +81,7 @@ struct ipx_ifaddr {
#define ia_broadaddr ia_dstaddr
struct sockaddr_ipx ia_netmask; /* space for my network mask */
};
+#endif /* _KERNEL */
struct ipx_aliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
diff --git a/usr.sbin/ifmcstat/ifmcstat.c b/usr.sbin/ifmcstat/ifmcstat.c
index 599e850..b1ae171 100644
--- a/usr.sbin/ifmcstat/ifmcstat.c
+++ b/usr.sbin/ifmcstat/ifmcstat.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/tree.h>
#include <net/if.h>
+#define _WANT_IFADDR
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/if_dl.h>
OpenPOWER on IntegriCloud