aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--gencode.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 1b0ea5e2..25d51c81 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,8 @@ Monthday, Month DD, YYYY:
Support user names and passwords in rpcap:// and rpcaps:// URLs.
Documentation:
Improve some protocol details in pcap-filter(7).
+ Building and testing:
+ Fix building without protochain support. (GH #852)
Monthday, Month DD, YYYY:
Summary for 1.10.2 libpcap release (so far!)
diff --git a/gencode.c b/gencode.c
index 91973013..ea272e17 100644
--- a/gencode.c
+++ b/gencode.c
@@ -564,7 +564,9 @@ static struct block *gen_portrangeop6(compiler_state_t *, u_int, u_int,
bpf_u_int32, int);
static struct block *gen_portrange6(compiler_state_t *, u_int, u_int, int, int);
static int lookup_proto(compiler_state_t *, const char *, int);
+#if !defined(NO_PROTOCHAIN)
static struct block *gen_protochain(compiler_state_t *, bpf_u_int32, int);
+#endif /* !defined(NO_PROTOCHAIN) */
static struct block *gen_proto(compiler_state_t *, bpf_u_int32, int, int);
static struct slist *xfer_to_x(compiler_state_t *, struct arth *);
static struct slist *xfer_to_a(compiler_state_t *, struct arth *);
@@ -6070,12 +6072,10 @@ lookup_proto(compiler_state_t *cstate, const char *name, int proto)
return v;
}
+#if !defined(NO_PROTOCHAIN)
static struct block *
gen_protochain(compiler_state_t *cstate, bpf_u_int32 v, int proto)
{
-#ifdef NO_PROTOCHAIN
- return gen_proto(cstate, v, proto);
-#else
struct block *b0, *b;
struct slist *s[100];
int fix2, fix3, fix4, fix5;
@@ -6369,8 +6369,8 @@ gen_protochain(compiler_state_t *cstate, bpf_u_int32 v, int proto)
gen_and(b0, b);
return b;
-#endif
}
+#endif /* !defined(NO_PROTOCHAIN) */
static struct block *
gen_check_802_11_data_frame(compiler_state_t *cstate)
@@ -6953,12 +6953,14 @@ gen_scode(compiler_state_t *cstate, const char *name, struct qual q)
else
bpf_error(cstate, "unknown protocol: %s", name);
+#if !defined(NO_PROTOCHAIN)
case Q_PROTOCHAIN:
real_proto = lookup_proto(cstate, name, proto);
if (real_proto >= 0)
return gen_protochain(cstate, real_proto, proto);
else
bpf_error(cstate, "unknown protocol: %s", name);
+#endif /* !defined(NO_PROTOCHAIN) */
case Q_UNDEF:
syntax(cstate);
@@ -7131,8 +7133,10 @@ gen_ncode(compiler_state_t *cstate, const char *s, bpf_u_int32 v, struct qual q)
case Q_PROTO:
return gen_proto(cstate, v, proto, dir);
+#if !defined(NO_PROTOCHAIN)
case Q_PROTOCHAIN:
return gen_protochain(cstate, v, proto);
+#endif
case Q_UNDEF:
syntax(cstate);