svn commit: r256518 - in head: contrib/ipfilter sys/net sys/netinet sys/netinet6 sys/netipx usr.sbin/ifmcstat
Gleb Smirnoff
glebius at FreeBSD.org
Tue Oct 15 10:19:26 UTC 2013
Author: glebius
Date: Tue Oct 15 10:19:24 2013
New Revision: 256518
URL: http://svnweb.freebsd.org/changeset/base/256518
Log:
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.
Modified:
head/contrib/ipfilter/ipf.h
head/sys/net/if_var.h
head/sys/netinet/in_var.h
head/sys/netinet6/in6_var.h
head/sys/netipx/ipx_if.h
head/usr.sbin/ifmcstat/ifmcstat.c
Modified: head/contrib/ipfilter/ipf.h
==============================================================================
--- head/contrib/ipfilter/ipf.h Tue Oct 15 10:12:19 2013 (r256517)
+++ head/contrib/ipfilter/ipf.h Tue Oct 15 10:19:24 2013 (r256518)
@@ -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>
Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h Tue Oct 15 10:12:19 2013 (r256517)
+++ head/sys/net/if_var.h Tue Oct 15 10:19:24 2013 (r256518)
@@ -788,6 +788,7 @@ drbr_inuse(struct ifnet *ifp, struct buf
* 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 */
Modified: head/sys/netinet/in_var.h
==============================================================================
--- head/sys/netinet/in_var.h Tue Oct 15 10:12:19 2013 (r256517)
+++ head/sys/netinet/in_var.h Tue Oct 15 10:19:24 2013 (r256518)
@@ -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" */
Modified: head/sys/netinet6/in6_var.h
==============================================================================
--- head/sys/netinet6/in6_var.h Tue Oct 15 10:12:19 2013 (r256517)
+++ head/sys/netinet6/in6_var.h Tue Oct 15 10:19:24 2013 (r256518)
@@ -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 {
Modified: head/sys/netipx/ipx_if.h
==============================================================================
--- head/sys/netipx/ipx_if.h Tue Oct 15 10:12:19 2013 (r256517)
+++ head/sys/netipx/ipx_if.h Tue Oct 15 10:19:24 2013 (r256518)
@@ -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" */
Modified: head/usr.sbin/ifmcstat/ifmcstat.c
==============================================================================
--- head/usr.sbin/ifmcstat/ifmcstat.c Tue Oct 15 10:12:19 2013 (r256517)
+++ head/usr.sbin/ifmcstat/ifmcstat.c Tue Oct 15 10:19:24 2013 (r256518)
@@ -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>
More information about the svn-src-all
mailing list