static struct block *gen_ip_proto(compiler_state_t *, const uint8_t);
static struct block *gen_ip6_proto(compiler_state_t *, const uint8_t);
static struct block *gen_ipfrag(compiler_state_t *);
-static struct block *gen_portatom(compiler_state_t *, int, bpf_u_int32);
-static struct block *gen_portrangeatom(compiler_state_t *, u_int, bpf_u_int32,
- bpf_u_int32);
-static struct block *gen_portatom6(compiler_state_t *, int, bpf_u_int32);
-static struct block *gen_portrangeatom6(compiler_state_t *, u_int, bpf_u_int32,
- bpf_u_int32);
-static struct block *gen_portop(compiler_state_t *, u_int, uint8_t, int);
-static struct block *gen_port(compiler_state_t *, u_int, int, int);
-static struct block *gen_portrangeop(compiler_state_t *, u_int, u_int,
+static struct block *gen_portatom(compiler_state_t *, int, uint16_t);
+static struct block *gen_portrangeatom(compiler_state_t *, u_int, uint16_t,
+ uint16_t);
+static struct block *gen_portatom6(compiler_state_t *, int, uint16_t);
+static struct block *gen_portrangeatom6(compiler_state_t *, u_int, uint16_t,
+ uint16_t);
+static struct block *gen_portop(compiler_state_t *, uint16_t, uint8_t, int);
+static struct block *gen_port(compiler_state_t *, uint16_t, int, int);
+static struct block *gen_portrangeop(compiler_state_t *, uint16_t, uint16_t,
uint8_t, int);
-static struct block *gen_portrange(compiler_state_t *, u_int, u_int, int, int);
-struct block *gen_portop6(compiler_state_t *, u_int, uint8_t, int);
-static struct block *gen_port6(compiler_state_t *, u_int, int, int);
-static struct block *gen_portrangeop6(compiler_state_t *, u_int, u_int,
+static struct block *gen_portrange(compiler_state_t *, uint16_t, uint16_t,
+ int, int);
+static struct block *gen_portop6(compiler_state_t *, uint16_t, uint8_t, int);
+static struct block *gen_port6(compiler_state_t *, uint16_t, int, int);
+static struct block *gen_portrangeop6(compiler_state_t *, uint16_t, uint16_t,
uint8_t, int);
-static struct block *gen_portrange6(compiler_state_t *, u_int, u_int, int, int);
+static struct block *gen_portrange6(compiler_state_t *, uint16_t, uint16_t,
+ 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);
* headers).
*/
static struct block *
-gen_portatom(compiler_state_t *cstate, int off, bpf_u_int32 v)
+gen_portatom(compiler_state_t *cstate, int off, uint16_t v)
{
return gen_cmp(cstate, OR_TRAN_IPV4, off, BPF_H, v);
}
static struct block *
-gen_portatom6(compiler_state_t *cstate, int off, bpf_u_int32 v)
+gen_portatom6(compiler_state_t *cstate, int off, uint16_t v)
{
return gen_cmp(cstate, OR_TRAN_IPV6, off, BPF_H, v);
}
static struct block *
-gen_portop(compiler_state_t *cstate, u_int port, uint8_t proto, int dir)
+gen_portop(compiler_state_t *cstate, uint16_t port, uint8_t proto, int dir)
{
struct block *b0, *b1, *tmp;
}
static struct block *
-gen_port(compiler_state_t *cstate, u_int port, int proto, int dir)
+gen_port(compiler_state_t *cstate, uint16_t port, int proto, int dir)
{
struct block *b0, *b1, *tmp;
}
struct block *
-gen_portop6(compiler_state_t *cstate, u_int port, uint8_t proto, int dir)
+gen_portop6(compiler_state_t *cstate, uint16_t port, uint8_t proto, int dir)
{
struct block *b0, *b1, *tmp;
}
static struct block *
-gen_port6(compiler_state_t *cstate, u_int port, int proto, int dir)
+gen_port6(compiler_state_t *cstate, uint16_t port, int proto, int dir)
{
struct block *b0, *b1, *tmp;
/* gen_portrange code */
static struct block *
-gen_portrangeatom(compiler_state_t *cstate, u_int off, bpf_u_int32 v1,
- bpf_u_int32 v2)
+gen_portrangeatom(compiler_state_t *cstate, u_int off, uint16_t v1,
+ uint16_t v2)
{
if (v1 == v2)
return gen_portatom(cstate, off, v1);
}
static struct block *
-gen_portrangeop(compiler_state_t *cstate, u_int port1, u_int port2,
+gen_portrangeop(compiler_state_t *cstate, uint16_t port1, uint16_t port2,
uint8_t proto, int dir)
{
struct block *b0, *b1, *tmp;
}
static struct block *
-gen_portrange(compiler_state_t *cstate, u_int port1, u_int port2,
+gen_portrange(compiler_state_t *cstate, uint16_t port1, uint16_t port2,
int proto, int dir)
{
struct block *b0, *b1, *tmp;
}
static struct block *
-gen_portrangeatom6(compiler_state_t *cstate, u_int off, bpf_u_int32 v1,
- bpf_u_int32 v2)
+gen_portrangeatom6(compiler_state_t *cstate, u_int off, uint16_t v1,
+ uint16_t v2)
{
if (v1 == v2)
return gen_portatom6(cstate, off, v1);
}
static struct block *
-gen_portrangeop6(compiler_state_t *cstate, u_int port1, u_int port2,
+gen_portrangeop6(compiler_state_t *cstate, uint16_t port1, uint16_t port2,
uint8_t proto, int dir)
{
struct block *b0, *b1, *tmp;
}
static struct block *
-gen_portrange6(compiler_state_t *cstate, u_int port1, u_int port2,
+gen_portrange6(compiler_state_t *cstate, uint16_t port1, uint16_t port2,
int proto, int dir)
{
struct block *b0, *b1, *tmp;
if (port > 65535)
bpf_error(cstate, "illegal port number %d > 65535", port);
// real_proto can be PROTO_UNDEF
- b = gen_port(cstate, port, real_proto, dir);
- gen_or(gen_port6(cstate, port, real_proto, dir), b);
+ b = gen_port(cstate, (uint16_t)port, real_proto, dir);
+ gen_or(gen_port6(cstate, (uint16_t)port, real_proto, dir), b);
return b;
case Q_PORTRANGE:
bpf_error(cstate, "illegal port number %d > 65535", port2);
// real_proto can be PROTO_UNDEF
- b = gen_portrange(cstate, port1, port2, real_proto, dir);
- gen_or(gen_portrange6(cstate, port1, port2, real_proto, dir), b);
+ b = gen_portrange(cstate, (uint16_t)port1, (uint16_t)port2,
+ real_proto, dir);
+ gen_or(gen_portrange6(cstate, (uint16_t)port1, (uint16_t)port2,
+ real_proto, dir), b);
return b;
case Q_GATEWAY:
// proto can be PROTO_UNDEF
{
struct block *b;
- b = gen_port(cstate, v, proto, dir);
- gen_or(gen_port6(cstate, v, proto, dir), b);
+ b = gen_port(cstate, (uint16_t)v, proto, dir);
+ gen_or(gen_port6(cstate, (uint16_t)v, proto, dir), b);
return b;
}
// proto can be PROTO_UNDEF
{
struct block *b;
- b = gen_portrange(cstate, v, v, proto, dir);
- gen_or(gen_portrange6(cstate, v, v, proto, dir), b);
+ b = gen_portrange(cstate, (uint16_t)v, (uint16_t)v,
+ proto, dir);
+ gen_or(gen_portrange6(cstate, (uint16_t)v, (uint16_t)v,
+ proto, dir), b);
return b;
}
* specified. Parameterized to handle both IPv4 and IPv6. */
static struct block *
gen_geneve_check(compiler_state_t *cstate,
- struct block *(*gen_portfn)(compiler_state_t *, u_int, int, int),
+ struct block *(*gen_portfn)(compiler_state_t *, uint16_t, int, int),
enum e_offrel offrel, bpf_u_int32 vni, int has_vni)
{
struct block *b0, *b1;
* specified. Parameterized to handle both IPv4 and IPv6. */
static struct block *
gen_vxlan_check(compiler_state_t *cstate,
- struct block *(*gen_portfn)(compiler_state_t *, u_int, int, int),
+ struct block *(*gen_portfn)(compiler_state_t *, uint16_t, int, int),
enum e_offrel offrel, bpf_u_int32 vni, int has_vni)
{
struct block *b0, *b1;