Make IPFIREWALL compile without INET6

This commit is contained in:
Poul-Henning Kamp 2005-04-19 09:56:14 +00:00
parent 376c9e2db7
commit 7292e12676

View File

@ -36,6 +36,7 @@
#include "opt_ipfw.h" #include "opt_ipfw.h"
#include "opt_ipdn.h" #include "opt_ipdn.h"
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_ipsec.h" #include "opt_ipsec.h"
#ifndef INET #ifndef INET
#error IPFIREWALL requires INET. #error IPFIREWALL requires INET.
@ -559,6 +560,7 @@ verify_path(struct in_addr src, struct ifnet *ifp)
return 1; return 1;
} }
#ifdef INET6
/* /*
* ipv6 specific rules here... * ipv6 specific rules here...
*/ */
@ -637,6 +639,8 @@ hash_packet6(struct ipfw_flow_id *id)
} }
/* end of ipv6 opcodes */ /* end of ipv6 opcodes */
#endif /* INET6 */
static u_int64_t norule_counter; /* counter for ipfw_log(NULL...) */ static u_int64_t norule_counter; /* counter for ipfw_log(NULL...) */
#define SNPARGS(buf, len) buf + len, sizeof(buf) > len ? sizeof(buf) - len : 0 #define SNPARGS(buf, len) buf + len, sizeof(buf) > len ? sizeof(buf) - len : 0
@ -854,8 +858,12 @@ hash_packet(struct ipfw_flow_id *id)
{ {
u_int32_t i; u_int32_t i;
i = IS_IP6_FLOW_ID(id) ? hash_packet6(id): #ifdef INET6
(id->dst_ip) ^ (id->src_ip) ^ (id->dst_port) ^ (id->src_port); if (IS_IP6_FLOW_ID(id))
i = hash_packet6(id):
else
#endif /* INET6 */
i = (id->dst_ip) ^ (id->src_ip) ^ (id->dst_port) ^ (id->src_port);
i &= (curr_dyn_buckets - 1); i &= (curr_dyn_buckets - 1);
return i; return i;
} }
@ -2424,6 +2432,7 @@ check_body:
icmptype_match(ICMP(ulp), (ipfw_insn_u32 *)cmd) ); icmptype_match(ICMP(ulp), (ipfw_insn_u32 *)cmd) );
break; break;
#ifdef INET6
case O_ICMP6TYPE: case O_ICMP6TYPE:
match = is_ipv6 && offset == 0 && match = is_ipv6 && offset == 0 &&
proto==IPPROTO_ICMPV6 && proto==IPPROTO_ICMPV6 &&
@ -2431,6 +2440,7 @@ check_body:
ICMP6(ulp)->icmp6_type, ICMP6(ulp)->icmp6_type,
(ipfw_insn_u32 *)cmd); (ipfw_insn_u32 *)cmd);
break; break;
#endif /* INET6 */
case O_IPOPT: case O_IPOPT:
match = (hlen > 0 && match = (hlen > 0 &&
@ -2576,9 +2586,12 @@ check_body:
/* XXX BED: verify_path was verify_rev_path in the diff... */ /* XXX BED: verify_path was verify_rev_path in the diff... */
match = ((oif != NULL) || match = ((oif != NULL) ||
(m->m_pkthdr.rcvif == NULL) || (m->m_pkthdr.rcvif == NULL) ||
(is_ipv6 ? (
#ifdef INET6
is_ipv6 ?
verify_rev_path6(&(args->f_id.src_ip6), verify_rev_path6(&(args->f_id.src_ip6),
m->m_pkthdr.rcvif) : m->m_pkthdr.rcvif) :
#endif
verify_path(src_ip, m->m_pkthdr.rcvif))); verify_path(src_ip, m->m_pkthdr.rcvif)));
break; break;
@ -2640,6 +2653,7 @@ check_body:
} }
break; break;
#ifdef INET6
case O_IP6_SRC_ME: case O_IP6_SRC_ME:
match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6); match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6);
break; break;
@ -2662,6 +2676,7 @@ check_body:
case O_IP6: case O_IP6:
match = is_ipv6; match = is_ipv6;
break; break;
#endif
/* /*
* The second set of opcodes represents 'actions', * The second set of opcodes represents 'actions',