]> The Tcpdump Group git mirrors - libpcap/commitdiff
Remove the unused CHASE_CHAIN props.
authorDenis Ovsienko <[email protected]>
Tue, 14 Jun 2022 19:35:41 +0000 (20:35 +0100)
committerDenis Ovsienko <[email protected]>
Tue, 14 Jun 2022 20:35:54 +0000 (21:35 +0100)
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.

gencode.c

index 2813c772c1b3fbd614b1b43d8440b9ea98705c44..9197301321033263b0c48c8e6c6a7489e6de73ba 100644 (file)
--- 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;