From: Denis Ovsienko Date: Tue, 14 Jun 2022 19:35:41 +0000 (+0100) Subject: Remove the unused CHASE_CHAIN props. X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/e6129d599345f9fc9bd2352fda902322d7c24b82 Remove the unused CHASE_CHAIN props. CHASE_CHAIN is not correlated with the build process, it has been undefined since it was introduced in commit 7fe3c11 in 1999, possibly as a leftover from earlier prototypes. If defined, the code still compiles fine, but quietly changes the behaviour in meaningful ways, which is a wrong thing to do. Remove the macro and the associated dead code. A practical side effect of this change is that gen_protochain() now can be conditional solely on NO_PROTOCHAIN, which simplifies getting the latter right to solve the build problem stated in GH #852. --- diff --git a/gencode.c b/gencode.c index 2813c772..91973013 100644 --- a/gencode.c +++ b/gencode.c @@ -1,4 +1,3 @@ -/*#define CHASE_CHAIN*/ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 * The Regents of the University of California. All rights reserved. @@ -6412,9 +6411,7 @@ static struct block * gen_proto(compiler_state_t *cstate, bpf_u_int32 v, int proto, int dir) { struct block *b0, *b1; -#ifndef CHASE_CHAIN struct block *b2; -#endif if (dir != Q_DEFAULT) bpf_error(cstate, "direction applied to 'proto'"); @@ -6446,11 +6443,7 @@ gen_proto(compiler_state_t *cstate, bpf_u_int32 v, int proto, int dir) * So we always check for ETHERTYPE_IP. */ b0 = gen_linktype(cstate, ETHERTYPE_IP); -#ifndef CHASE_CHAIN b1 = gen_cmp(cstate, OR_LINKPL, 9, BPF_B, v); -#else - b1 = gen_protochain(cstate, v, Q_IP); -#endif gen_and(b0, b1); return b1; @@ -6512,7 +6505,6 @@ gen_proto(compiler_state_t *cstate, bpf_u_int32 v, int proto, int dir) case Q_IPV6: b0 = gen_linktype(cstate, ETHERTYPE_IPV6); -#ifndef CHASE_CHAIN /* * Also check for a fragment header before the final * header. @@ -6522,9 +6514,6 @@ gen_proto(compiler_state_t *cstate, bpf_u_int32 v, int proto, int dir) gen_and(b2, b1); b2 = gen_cmp(cstate, OR_LINKPL, 6, BPF_B, v); gen_or(b2, b1); -#else - b1 = gen_protochain(cstate, v, Q_IPV6); -#endif gen_and(b0, b1); return b1;