GH-1216: Enable Mobile IPv6 support by default

This removes the ENABLE_MOBILE_IPV6 #define variable. It also marks the
--enable-mobile-ipv6 configure argument as deprecated.
This commit is contained in:
Tim Wojtulewicz 2021-06-24 14:36:08 -07:00
parent 2e5d1d924f
commit b14cd1ef16
14 changed files with 12 additions and 72 deletions

4
NEWS
View file

@ -92,6 +92,10 @@ Removed Functionality
- Support for the RocksDB Broker data store was previously broken and unusable, - Support for the RocksDB Broker data store was previously broken and unusable,
so all code/options related to it are now removed. so all code/options related to it are now removed.
- Support for the ENABLE_MOBILE_IPV6 compiler variable has been removed. Mobile
IPv6 is now enabled by default. The --enable-mobile-ipv6 returns a warning
that it will be removed in v5.1 and no longer has any effect.
Deprecated Functionality Deprecated Functionality
------------------------ ------------------------

10
configure vendored
View file

@ -170,10 +170,11 @@ append_cache_entry INSTALL_ZEEK_ARCHIVER BOOL true
append_cache_entry INSTALL_ZEEKCTL BOOL true append_cache_entry INSTALL_ZEEKCTL BOOL true
append_cache_entry INSTALL_ZKG BOOL true append_cache_entry INSTALL_ZKG BOOL true
append_cache_entry CPACK_SOURCE_IGNORE_FILES STRING append_cache_entry CPACK_SOURCE_IGNORE_FILES STRING
append_cache_entry ENABLE_MOBILE_IPV6 BOOL false
append_cache_entry ZEEK_SANITIZERS STRING "" append_cache_entry ZEEK_SANITIZERS STRING ""
append_cache_entry ZEEK_INCLUDE_PLUGINS STRING "" append_cache_entry ZEEK_INCLUDE_PLUGINS STRING ""
has_enable_mobile_ipv6=0
# parse arguments # parse arguments
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case "$1" in case "$1" in
@ -265,7 +266,7 @@ while [ $# -ne 0 ]; do
append_cache_entry ENABLE_DEBUG BOOL true append_cache_entry ENABLE_DEBUG BOOL true
;; ;;
--enable-mobile-ipv6) --enable-mobile-ipv6)
append_cache_entry ENABLE_MOBILE_IPV6 BOOL true has_enable_mobile_ipv6=1
;; ;;
--enable-perftools) --enable-perftools)
append_cache_entry ENABLE_PERFTOOLS BOOL true append_cache_entry ENABLE_PERFTOOLS BOOL true
@ -440,3 +441,8 @@ fi
echo "# This is the command used to configure this build" > config.status echo "# This is the command used to configure this build" > config.status
echo $command >> config.status echo $command >> config.status
chmod u+x config.status chmod u+x config.status
if [ $has_enable_mobile_ipv6 -eq 1 ]; then
echo
echo "NOTE: The --enable-mobile-ipv6 argument no longer has any effect and will be removed in v5.1."
fi

View file

@ -157,7 +157,6 @@ RecordValPtr IPv6_Hdr::ToVal(VectorValPtr chain) const
} }
break; break;
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
{ {
static auto ip6_mob_type = id::find_type<RecordType>("ip6_mobility_hdr"); static auto ip6_mob_type = id::find_type<RecordType>("ip6_mobility_hdr");
@ -290,7 +289,6 @@ RecordValPtr IPv6_Hdr::ToVal(VectorValPtr chain) const
rv->Assign(5, std::move(msg)); rv->Assign(5, std::move(msg));
} }
break; break;
#endif //ENABLE_MOBILE_IPV6
default: default:
break; break;
@ -445,9 +443,7 @@ static inline bool isIPv6ExtHeader(uint8_t type)
case IPPROTO_FRAGMENT: case IPPROTO_FRAGMENT:
case IPPROTO_AH: case IPPROTO_AH:
case IPPROTO_ESP: case IPPROTO_ESP:
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
#endif
return true; return true;
default: default:
return false; return false;
@ -457,9 +453,7 @@ static inline bool isIPv6ExtHeader(uint8_t type)
IPv6_Hdr_Chain::~IPv6_Hdr_Chain() IPv6_Hdr_Chain::~IPv6_Hdr_Chain()
{ {
for ( size_t i = 0; i < chain.size(); ++i ) delete chain[i]; for ( size_t i = 0; i < chain.size(); ++i ) delete chain[i];
#ifdef ENABLE_MOBILE_IPV6
delete homeAddr; delete homeAddr;
#endif
delete finalDst; delete finalDst;
} }
@ -509,11 +503,9 @@ void IPv6_Hdr_Chain::Init(const struct ip6_hdr* ip6, int total_len,
if ( current_type == IPPROTO_ROUTING ) if ( current_type == IPPROTO_ROUTING )
ProcessRoutingHeader((const struct ip6_rthdr*) hdrs, cur_len); ProcessRoutingHeader((const struct ip6_rthdr*) hdrs, cur_len);
#ifdef ENABLE_MOBILE_IPV6
// Only Mobile IPv6 has a destination option we care about right now. // Only Mobile IPv6 has a destination option we care about right now.
if ( current_type == IPPROTO_DSTOPTS ) if ( current_type == IPPROTO_DSTOPTS )
ProcessDstOpts((const struct ip6_dest*) hdrs, cur_len); ProcessDstOpts((const struct ip6_dest*) hdrs, cur_len);
#endif
hdrs += cur_len; hdrs += cur_len;
length += cur_len; length += cur_len;
@ -521,9 +513,7 @@ void IPv6_Hdr_Chain::Init(const struct ip6_hdr* ip6, int total_len,
} while ( current_type != IPPROTO_FRAGMENT && } while ( current_type != IPPROTO_FRAGMENT &&
current_type != IPPROTO_ESP && current_type != IPPROTO_ESP &&
#ifdef ENABLE_MOBILE_IPV6
current_type != IPPROTO_MOBILITY && current_type != IPPROTO_MOBILITY &&
#endif
isIPv6ExtHeader(next_type) ); isIPv6ExtHeader(next_type) );
} }
@ -540,10 +530,8 @@ bool IPv6_Hdr_Chain::IsFragment() const
IPAddr IPv6_Hdr_Chain::SrcAddr() const IPAddr IPv6_Hdr_Chain::SrcAddr() const
{ {
#ifdef ENABLE_MOBILE_IPV6
if ( homeAddr ) if ( homeAddr )
return IPAddr(*homeAddr); return IPAddr(*homeAddr);
#endif
if ( chain.empty() ) if ( chain.empty() )
{ {
reporter->InternalWarning("empty IPv6 header chain"); reporter->InternalWarning("empty IPv6 header chain");
@ -595,7 +583,6 @@ void IPv6_Hdr_Chain::ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t le
} }
break; break;
#ifdef ENABLE_MOBILE_IPV6
case 2: // Defined by Mobile IPv6 RFC 6275. case 2: // Defined by Mobile IPv6 RFC 6275.
{ {
if ( r->ip6r_segleft > 0 ) if ( r->ip6r_segleft > 0 )
@ -607,7 +594,6 @@ void IPv6_Hdr_Chain::ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t le
} }
} }
break; break;
#endif
default: default:
reporter->Weird(SrcAddr(), DstAddr(), "unknown_routing_type", reporter->Weird(SrcAddr(), DstAddr(), "unknown_routing_type",
@ -616,7 +602,6 @@ void IPv6_Hdr_Chain::ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t le
} }
} }
#ifdef ENABLE_MOBILE_IPV6
void IPv6_Hdr_Chain::ProcessDstOpts(const struct ip6_dest* d, uint16_t len) void IPv6_Hdr_Chain::ProcessDstOpts(const struct ip6_dest* d, uint16_t len)
{ {
// Skip two bytes to get the beginning of the first option structure. These // Skip two bytes to get the beginning of the first option structure. These
@ -672,7 +657,6 @@ void IPv6_Hdr_Chain::ProcessDstOpts(const struct ip6_dest* d, uint16_t len)
} }
} }
} }
#endif
VectorValPtr IPv6_Hdr_Chain::ToVal() const VectorValPtr IPv6_Hdr_Chain::ToVal() const
{ {
@ -712,11 +696,9 @@ VectorValPtr IPv6_Hdr_Chain::ToVal() const
case IPPROTO_ESP: case IPPROTO_ESP:
ext_hdr->Assign(6, std::move(v)); ext_hdr->Assign(6, std::move(v));
break; break;
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
ext_hdr->Assign(7, std::move(v)); ext_hdr->Assign(7, std::move(v));
break; break;
#endif
default: default:
reporter->InternalWarning("IPv6_Hdr_Chain bad header %d", type); reporter->InternalWarning("IPv6_Hdr_Chain bad header %d", type);
continue; continue;
@ -749,10 +731,8 @@ IPv6_Hdr_Chain* IPv6_Hdr_Chain::Copy(const ip6_hdr* new_hdr) const
IPv6_Hdr_Chain* rval = new IPv6_Hdr_Chain; IPv6_Hdr_Chain* rval = new IPv6_Hdr_Chain;
rval->length = length; rval->length = length;
#ifdef ENABLE_MOBILE_IPV6
if ( homeAddr ) if ( homeAddr )
rval->homeAddr = new IPAddr(*homeAddr); rval->homeAddr = new IPAddr(*homeAddr);
#endif
if ( finalDst ) if ( finalDst )
rval->finalDst = new IPAddr(*finalDst); rval->finalDst = new IPAddr(*finalDst);

View file

@ -26,8 +26,6 @@ using VectorValPtr = IntrusivePtr<VectorVal>;
namespace detail { class FragReassembler; } namespace detail { class FragReassembler; }
#ifdef ENABLE_MOBILE_IPV6
#ifndef IPPROTO_MOBILITY #ifndef IPPROTO_MOBILITY
#define IPPROTO_MOBILITY 135 #define IPPROTO_MOBILITY 135
#endif #endif
@ -40,8 +38,6 @@ struct ip6_mobility {
uint16_t ip6mob_chksum; uint16_t ip6mob_chksum;
}; };
#endif //ENABLE_MOBILE_IPV6
/** /**
* Base class for IPv6 header/extensions. * Base class for IPv6 header/extensions.
*/ */
@ -66,9 +62,7 @@ public:
case IPPROTO_ROUTING: case IPPROTO_ROUTING:
case IPPROTO_FRAGMENT: case IPPROTO_FRAGMENT:
case IPPROTO_AH: case IPPROTO_AH:
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
#endif
((ip6_ext*)data)->ip6e_nxt = next_type; ((ip6_ext*)data)->ip6e_nxt = next_type;
break; break;
case IPPROTO_ESP: case IPPROTO_ESP:
@ -93,9 +87,7 @@ public:
case IPPROTO_ROUTING: case IPPROTO_ROUTING:
case IPPROTO_FRAGMENT: case IPPROTO_FRAGMENT:
case IPPROTO_AH: case IPPROTO_AH:
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
#endif
return ((ip6_ext*)data)->ip6e_nxt; return ((ip6_ext*)data)->ip6e_nxt;
case IPPROTO_ESP: case IPPROTO_ESP:
default: default:
@ -114,9 +106,7 @@ public:
case IPPROTO_HOPOPTS: case IPPROTO_HOPOPTS:
case IPPROTO_DSTOPTS: case IPPROTO_DSTOPTS:
case IPPROTO_ROUTING: case IPPROTO_ROUTING:
#ifdef ENABLE_MOBILE_IPV6
case IPPROTO_MOBILITY: case IPPROTO_MOBILITY:
#endif
return 8 + 8 * ((ip6_ext*)data)->ip6e_len; return 8 + 8 * ((ip6_ext*)data)->ip6e_len;
case IPPROTO_FRAGMENT: case IPPROTO_FRAGMENT:
return 8; return 8;
@ -262,13 +252,11 @@ protected:
*/ */
void ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t len); void ProcessRoutingHeader(const struct ip6_rthdr* r, uint16_t len);
#ifdef ENABLE_MOBILE_IPV6
/** /**
* Inspect a Destination Option header's options for things we need to * Inspect a Destination Option header's options for things we need to
* remember, such as the Home Address option from Mobile IPv6. * remember, such as the Home Address option from Mobile IPv6.
*/ */
void ProcessDstOpts(const struct ip6_dest* d, uint16_t len); void ProcessDstOpts(const struct ip6_dest* d, uint16_t len);
#endif
std::vector<IPv6_Hdr*> chain; std::vector<IPv6_Hdr*> chain;
@ -277,12 +265,10 @@ protected:
*/ */
uint16_t length = 0; uint16_t length = 0;
#ifdef ENABLE_MOBILE_IPV6
/** /**
* Home Address of the packet's source as defined by Mobile IPv6 (RFC 6275). * Home Address of the packet's source as defined by Mobile IPv6 (RFC 6275).
*/ */
IPAddr* homeAddr = nullptr; IPAddr* homeAddr = nullptr;
#endif
/** /**
* The final destination address in chain's first Routing header that has * The final destination address in chain's first Routing header that has
@ -394,7 +380,6 @@ public:
return ((const u_char*) ip6) + ip6_hdrs->TotalLength(); return ((const u_char*) ip6) + ip6_hdrs->TotalLength();
} }
#ifdef ENABLE_MOBILE_IPV6
/** /**
* Returns a pointer to the mobility header of the IP packet, if present, * Returns a pointer to the mobility header of the IP packet, if present,
* else a null pointer. * else a null pointer.
@ -408,7 +393,6 @@ public:
else else
return (const ip6_mobility*)(*ip6_hdrs)[ip6_hdrs->Size()-1]->Data(); return (const ip6_mobility*)(*ip6_hdrs)[ip6_hdrs->Size()-1]->Data();
} }
#endif
/** /**
* Returns the length of the IP packet's payload (length of packet minus * Returns the length of the IP packet's payload (length of packet minus

View file

@ -100,7 +100,6 @@ int icmp_checksum(const struct icmp* icmpp, int len)
return detail::in_cksum(reinterpret_cast<const uint8_t*>(icmpp), len); return detail::in_cksum(reinterpret_cast<const uint8_t*>(icmpp), len);
} }
#ifdef ENABLE_MOBILE_IPV6
int mobility_header_checksum(const IP_Hdr* ip) int mobility_header_checksum(const IP_Hdr* ip)
{ {
const ip6_mobility* mh = ip->MobilityHeader(); const ip6_mobility* mh = ip->MobilityHeader();
@ -124,7 +123,6 @@ int mobility_header_checksum(const IP_Hdr* ip)
return sum; return sum;
} }
#endif
int icmp6_checksum(const struct icmp* icmpp, const IP_Hdr* ip, int len) int icmp6_checksum(const struct icmp* icmpp, const IP_Hdr* ip, int len)
{ {

View file

@ -178,9 +178,7 @@ extern int ones_complement_checksum(const IPAddr& a, uint32_t sum);
extern int icmp6_checksum(const struct icmp* icmpp, const IP_Hdr* ip, int len); extern int icmp6_checksum(const struct icmp* icmpp, const IP_Hdr* ip, int len);
extern int icmp_checksum(const struct icmp* icmpp, int len); extern int icmp_checksum(const struct icmp* icmpp, int len);
#ifdef ENABLE_MOBILE_IPV6
extern int mobility_header_checksum(const IP_Hdr* ip); extern int mobility_header_checksum(const IP_Hdr* ip);
#endif
// True if sequence # a is between b and c (b <= a <= c). It must be true // True if sequence # a is between b and c (b <= a <= c). It must be true
// that b <= c in the sequence space. // that b <= c in the sequence space.

View file

@ -196,7 +196,6 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
return true; return true;
} }
#ifdef ENABLE_MOBILE_IPV6
// We stop building the chain when seeing IPPROTO_MOBILITY so it's always // We stop building the chain when seeing IPPROTO_MOBILITY so it's always
// last if present. // last if present.
if ( packet->ip_hdr->LastHeader() == IPPROTO_MOBILITY ) if ( packet->ip_hdr->LastHeader() == IPPROTO_MOBILITY )
@ -217,7 +216,6 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
return true; return true;
} }
#endif
// Set the data pointer to match the payload from the IP header. This makes sure that it's also pointing // Set the data pointer to match the payload from the IP header. This makes sure that it's also pointing
// at the reassembled data for a fragmented packet. // at the reassembled data for a fragmented packet.

View file

@ -1,15 +0,0 @@
# @TEST-REQUIRES: grep -q "#undef ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -r $TRACES/mobile-ipv6/mip6_back.trace %INPUT
# @TEST-EXEC: btest-diff unknown_protocols.log
@load policy/misc/unknown-protocols
event mobile_ipv6_message(p: pkt_hdr)
{
if ( ! p?$ip6 ) return;
for ( i in p$ip6$exts )
if ( p$ip6$exts[i]$id == IPPROTO_MOBILITY )
print p$ip6;
}

View file

@ -1,4 +1,2 @@
# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -C -r $TRACES/ipv6-mobility-dst-opts.trace # @TEST-EXEC: zeek -C -r $TRACES/ipv6-mobility-dst-opts.trace
# @TEST-EXEC: btest-diff weird.log # @TEST-EXEC: btest-diff weird.log

View file

@ -1,5 +1,3 @@
# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/ipv6-mobile-hoa.trace %INPUT >output # @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/ipv6-mobile-hoa.trace %INPUT >output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output

View file

@ -1,5 +1,3 @@
# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/ipv6-mobile-routing.trace %INPUT >output # @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/ipv6-mobile-routing.trace %INPUT >output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output

View file

@ -1,5 +1,3 @@
# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -r $TRACES/chksums/mip6-bad-mh-chksum.pcap # @TEST-EXEC: zeek -r $TRACES/chksums/mip6-bad-mh-chksum.pcap
# @TEST-EXEC: mv weird.log bad.out # @TEST-EXEC: mv weird.log bad.out
# @TEST-EXEC: zeek -r $TRACES/chksums/ip6-hoa-tcp-bad-chksum.pcap # @TEST-EXEC: zeek -r $TRACES/chksums/ip6-hoa-tcp-bad-chksum.pcap

View file

@ -1,5 +1,3 @@
# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/zeek-config.h
#
# @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_back.trace %INPUT >output # @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_back.trace %INPUT >output
# @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_be.trace %INPUT >>output # @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_be.trace %INPUT >>output
# @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_brr.trace %INPUT >>output # @TEST-EXEC: zeek -b -r $TRACES/mobile-ipv6/mip6_brr.trace %INPUT >>output

View file

@ -116,9 +116,6 @@
/* Use Google's perftools */ /* Use Google's perftools */
#cmakedefine USE_PERFTOOLS_DEBUG #cmakedefine USE_PERFTOOLS_DEBUG
/* Analyze Mobile IPv6 traffic */
#cmakedefine ENABLE_MOBILE_IPV6
/* Use libCurl. */ /* Use libCurl. */
#cmakedefine USE_CURL #cmakedefine USE_CURL