Skip to content

Commit

Permalink
bpf, egressgw: gate use of EGRESS_POLICY_MAP on define
Browse files Browse the repository at this point in the history
EGRESS_POLICY_MAP is only defined if the egress gateway is enabled.
Allow including egressgw.h even if that is not the case, so that
the helpers can be reused.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
  • Loading branch information
lmb committed Aug 18, 2023
1 parent a94fa56 commit 2fe8930
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bpf/tests/lib/egressgw.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static __always_inline __be16 client_port(enum egressgw_test t)
return CLIENT_PORT + (__be16)t;
}

#ifdef ENABLE_EGRESS_GATEWAY
static __always_inline void add_egressgw_policy_entry(__be32 saddr, __be32 daddr, __u8 cidr,
__be32 gateway_ip, __be32 egress_ip)
{
Expand Down Expand Up @@ -67,6 +68,7 @@ static __always_inline void del_egressgw_policy_entry(__be32 saddr, __be32 daddr

map_delete_elem(&EGRESS_POLICY_MAP, &in_key);
}
#endif /* ENABLE_EGRESS_GATEWAY */

static __always_inline int egressgw_pktgen(struct __ctx_buff *ctx,
struct egressgw_test_ctx test_ctx)
Expand Down

0 comments on commit 2fe8930

Please sign in to comment.