diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-10-15 10:19:24 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-10-15 10:19:24 +0000 |
commit | 6ed910fabebba6e93d5e2bf6697821a9891bfcdb (patch) | |
tree | 1532e1c4b17329547e57e8b1a2f1be2c9432e684 | |
parent | 3fa98cf9acfc55c8bfae6d076524177bd1d9d7c9 (diff) | |
download | src-6ed910fabebba6e93d5e2bf6697821a9891bfcdb.tar.gz src-6ed910fabebba6e93d5e2bf6697821a9891bfcdb.zip |
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.
Notes
Notes:
svn path=/head/; revision=256518
-rw-r--r-- | contrib/ipfilter/ipf.h | 7 | ||||
-rw-r--r-- | sys/net/if_var.h | 3 | ||||
-rw-r--r-- | sys/netinet/in_var.h | 2 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 2 | ||||
-rw-r--r-- | sys/netipx/ipx_if.h | 3 | ||||
-rw-r--r-- | usr.sbin/ifmcstat/ifmcstat.c | 1 |
6 files changed, 14 insertions, 4 deletions
diff --git a/contrib/ipfilter/ipf.h b/contrib/ipfilter/ipf.h index 280f98d938c2..d4bd5249550f 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 3288a4f555a4..58121f5e7e0f 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 8657dbb7ed13..9143cff11ff9 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 09928b3a5500..229cc33472a9 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 ab5ee799cf3e..7725b4ad99a3 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 599e8503896a..b1ae171a7d6e 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> |