Make pf compile without INET support by adding #ifdef INETs and

correcting few #includes.

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	4 days
This commit is contained in:
Bjoern A. Zeeb 2011-04-27 19:34:01 +00:00
parent 74e9dcf786
commit 5084821ac2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221132
3 changed files with 16 additions and 4 deletions

View File

@ -82,17 +82,17 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#include <net/bpf.h>
#ifdef INET
#if defined(INET) || defined(INET6)
#include <netinet/in.h>
#endif
#ifdef INET
#include <netinet/in_var.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#endif
#ifdef INET6
#ifndef INET
#include <netinet/in.h>
#endif
#include <netinet6/in6_var.h>
#include <netinet6/nd6.h>
#endif /* INET6 */

View File

@ -2039,8 +2039,10 @@ pf_send_icmp(struct mbuf *m, u_int8_t type, u_int8_t code, sa_family_t af,
struct pf_mtag *pf_mtag;
struct mbuf *m0;
#ifdef __FreeBSD__
#ifdef INET
struct ip *ip;
#endif
#endif
#ifdef __FreeBSD__
m0 = m_copypacket(m, M_DONTWAIT);

View File

@ -216,10 +216,12 @@ static void pf_clear_srcnodes(void);
/*
* Wrapper functions for pfil(9) hooks
*/
#ifdef INET
static int pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp,
int dir, struct inpcb *inp);
static int pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp,
int dir, struct inpcb *inp);
#endif
#ifdef INET6
static int pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp,
int dir, struct inpcb *inp);
@ -3622,6 +3624,7 @@ shutdown_pf(void)
return (error);
}
#ifdef INET
static int
pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
struct inpcb *inp)
@ -3696,6 +3699,7 @@ pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
}
return chk;
}
#endif
#ifdef INET6
static int
@ -3761,15 +3765,19 @@ hook_pf(void)
pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
if (pfh_inet == NULL)
return (ESRCH); /* XXX */
#ifdef INET
pfil_add_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet);
pfil_add_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet);
#endif
#ifdef INET6
pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
if (pfh_inet6 == NULL) {
#ifdef INET
pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK,
pfh_inet);
pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
pfh_inet);
#endif
return (ESRCH); /* XXX */
}
pfil_add_hook(pf_check6_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet6);
@ -3796,10 +3804,12 @@ dehook_pf(void)
pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET);
if (pfh_inet == NULL)
return (ESRCH); /* XXX */
#ifdef INET
pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK,
pfh_inet);
pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK,
pfh_inet);
#endif
#ifdef INET6
pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6);
if (pfh_inet6 == NULL)