@@ -78,8 +78,7 @@ lxc_deliver_to_host(struct __ctx_buff *ctx, __u32 src_sec_identity)
7878}
7979#endif
8080
81- #if defined(ENABLE_HOST_ROUTING ) || defined(ENABLE_ROUTING )
82- static __always_inline int
81+ static __always_inline __maybe_unused int
8382lxc_redirect_to_host (struct __ctx_buff * ctx , __u32 src_sec_identity ,
8483 __be16 proto , struct trace_ctx * trace )
8584{
@@ -88,7 +87,6 @@ lxc_redirect_to_host(struct __ctx_buff *ctx, __u32 src_sec_identity,
8887 trace -> reason , trace -> monitor , proto );
8988 return ctx_redirect (ctx , CONFIG (cilium_net_ifindex ), BPF_F_INGRESS );
9089}
91- #endif
9290
9391/* Per-packet LB is needed if all LB cases can not be handled in bpf_sock.
9492 * Most services with L7 LB flag can not be redirected to their proxy port
@@ -726,7 +724,7 @@ ipv6_forward_to_destination(struct __ctx_buff *ctx, struct ipv6hdr *ip6,
726724 if (CONFIG (enable_identity_mark ))
727725 set_identity_mark (ctx , SECLABEL_IPV6 , MARK_MAGIC_IDENTITY );
728726
729- if (is_defined (ENABLE_ROUTING ) || hairpin_flow || is_defined ( ENABLE_HOST_ROUTING )) {
727+ if (is_defined (ENABLE_ROUTING ) || hairpin_flow || CONFIG ( enable_bpf_host_routing )) {
730728 const struct endpoint_info * ep ;
731729 union v6addr daddr ;
732730
@@ -749,8 +747,8 @@ ipv6_forward_to_destination(struct __ctx_buff *ctx, struct ipv6hdr *ip6,
749747 */
750748 ep = __lookup_ip6_endpoint (& daddr );
751749 if (ep ) {
752- # if defined( ENABLE_HOST_ROUTING ) || defined( ENABLE_ROUTING )
753- if ( ep -> flags & ENDPOINT_MASK_HOST_DELIVERY ) {
750+ if (( ep -> flags & ENDPOINT_MASK_HOST_DELIVERY ) &&
751+ ( CONFIG ( enable_bpf_host_routing ) || is_defined ( ENABLE_ROUTING )) ) {
754752 if (is_defined (ENABLE_ROUTING ) &&
755753 is_defined (ENABLE_HOST_FIREWALL ) &&
756754 dst_sec_identity == HOST_ID )
@@ -760,7 +758,6 @@ ipv6_forward_to_destination(struct __ctx_buff *ctx, struct ipv6hdr *ip6,
760758
761759 goto pass_to_stack ;
762760 }
763- #endif /* ENABLE_HOST_ROUTING || ENABLE_ROUTING */
764761
765762 /* If the packet is from L7 LB it is coming from the host */
766763 return ipv6_local_delivery (ctx , ETH_HLEN , SECLABEL_IPV6 ,
@@ -785,7 +782,7 @@ ipv6_forward_to_destination(struct __ctx_buff *ctx, struct ipv6hdr *ip6,
785782 bpf_htons (ETH_P_IPV6 ));
786783 }
787784#endif
788- if (is_defined ( ENABLE_HOST_ROUTING )) {
785+ if (CONFIG ( enable_bpf_host_routing )) {
789786 int oif = 0 ;
790787 __u32 tbid = CONFIG (rt_info );
791788
@@ -1227,7 +1224,7 @@ ipv4_forward_to_destination(struct __ctx_buff *ctx, struct iphdr *ip4,
12271224 * that endpoint.
12281225 */
12291226 if (is_defined (ENABLE_ROUTING ) || hairpin_flow ||
1230- is_defined ( ENABLE_HOST_ROUTING )) {
1227+ CONFIG ( enable_bpf_host_routing )) {
12311228 __be32 daddr = ip4 -> daddr ;
12321229 const struct endpoint_info * ep ;
12331230
@@ -1250,8 +1247,8 @@ ipv4_forward_to_destination(struct __ctx_buff *ctx, struct iphdr *ip4,
12501247 */
12511248 ep = __lookup_ip4_endpoint (daddr );
12521249 if (ep ) {
1253- # if defined( ENABLE_HOST_ROUTING ) || defined( ENABLE_ROUTING )
1254- if ( ep -> flags & ENDPOINT_MASK_HOST_DELIVERY ) {
1250+ if (( ep -> flags & ENDPOINT_MASK_HOST_DELIVERY ) &&
1251+ ( CONFIG ( enable_bpf_host_routing ) || is_defined ( ENABLE_ROUTING )) ) {
12551252 if (is_defined (ENABLE_ROUTING ) &&
12561253 is_defined (ENABLE_HOST_FIREWALL ) &&
12571254 dst_sec_identity == HOST_ID )
@@ -1261,7 +1258,6 @@ ipv4_forward_to_destination(struct __ctx_buff *ctx, struct iphdr *ip4,
12611258
12621259 goto pass_to_stack ;
12631260 }
1264- #endif /* ENABLE_HOST_ROUTING || ENABLE_ROUTING */
12651261
12661262 /* If the packet is from L7 LB it is coming from the host */
12671263 return ipv4_local_delivery (ctx , ETH_HLEN , SECLABEL_IPV4 ,
@@ -1351,7 +1347,7 @@ ipv4_forward_to_destination(struct __ctx_buff *ctx, struct iphdr *ip4,
13511347 }
13521348#endif /* TUNNEL_MODE */
13531349
1354- if (is_defined ( ENABLE_HOST_ROUTING )) {
1350+ if (CONFIG ( enable_bpf_host_routing )) {
13551351 int oif = 0 ;
13561352 __u32 tbid = CONFIG (rt_info );
13571353
0 commit comments