@@ -316,14 +316,14 @@ func (c *Client) Initialize(nodeConfig *config.NodeConfig, done func()) error {
316316 }
317317 }
318318
319- // In hybrid mode, traffic originating from remote Pod CIDRs is forwarded like this:
319+ // In hybrid mode, or encap mode with WireGuard enabled, traffic originating from remote Pod CIDRs is forwarded like this:
320320 // remote Pods -> tunnel (remote Node OVS) -> tunnel (local Node OVS) -> antrea-gw0 (local Node) -> external network.
321321 //
322322 // To ensure reply packets follow a symmetric path, Antrea uses policy routing on the local Node. However, the
323323 // kernel's strict RPF check only validates source paths against the main routing table. Since the transport
324324 // interface (not antrea‑gw0) is listed as the next-hop for these routes, strict RPF drops the reply packets
325325 // (because policy routing is ignored by rp_filter). As a result, we set its rp_filter to loose mode (2).
326- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
326+ if c .egressEnabled && ( c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncryptionMode == config . TrafficEncryptionModeWireGuard ) {
327327 if err := util .EnsureRPFilterOnInterface (c .nodeConfig .GatewayConfig .Name , 2 ); err != nil {
328328 return fmt .Errorf ("failed to set %s rp_filter to 2 (loose mode): %w" , c .nodeConfig .GatewayConfig .Name , err )
329329 }
@@ -337,7 +337,7 @@ func (c *Client) Initialize(nodeConfig *config.NodeConfig, done func()) error {
337337 }
338338 }
339339 // Set up the policy routing ip rule to support Egress in hybrid mode.
340- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
340+ if c .egressEnabled && ( c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncryptionMode == config . TrafficEncryptionModeWireGuard ) {
341341 if err := c .initEgressIPRules (); err != nil {
342342 return fmt .Errorf ("failed to initialize ip rules for Egress in hybrid mode: %w" , err )
343343 }
@@ -540,7 +540,7 @@ func (c *Client) syncNeighbor() error {
540540 return restoreNeighbor (v .(* netlink.Neigh ))
541541 })
542542 }
543- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
543+ if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncapMode == config . TrafficEncryptionModeWireGuard {
544544 c .egressNeighbors .Range (func (_ , v interface {}) bool {
545545 return restoreNeighbor (v .(* netlink.Neigh ))
546546 })
@@ -902,7 +902,7 @@ func (c *Client) syncIPTables(cleanupStaleJumpRules bool) error {
902902 jumpRules = append (jumpRules , jumpRule {iptables .FilterTable , iptables .InputChain , antreaInputChain , "Antrea: jump to Antrea input rules" , false })
903903 jumpRules = append (jumpRules , jumpRule {iptables .FilterTable , iptables .OutputChain , antreaOutputChain , "Antrea: jump to Antrea output rules" , false })
904904 }
905- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
905+ if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncapMode == config . TrafficEncryptionModeWireGuard {
906906 jumpRules = append (jumpRules , jumpRule {iptables .MangleTable , iptables .PostRoutingChain , antreaPostRoutingChain , "Antrea: jump to Antrea postrouting rules" , false })
907907 }
908908
@@ -1152,7 +1152,7 @@ func (c *Client) restoreIptablesData(podCIDR *net.IPNet,
11521152 writeLine (iptablesData , "*mangle" )
11531153 writeLine (iptablesData , iptables .MakeChainLine (antreaPreRoutingChain ))
11541154 writeLine (iptablesData , iptables .MakeChainLine (antreaOutputChain ))
1155- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
1155+ if c .egressEnabled && ( c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncapMode == config . TrafficEncryptionModeWireGuard ) {
11561156 writeLine (iptablesData , iptables .MakeChainLine (antreaPostRoutingChain ))
11571157 }
11581158
@@ -1163,7 +1163,7 @@ func (c *Client) restoreIptablesData(podCIDR *net.IPNet,
11631163 c .writeEKSMangleRules (iptablesData )
11641164 }
11651165
1166- if c .egressEnabled && c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid {
1166+ if c .egressEnabled && ( c .networkConfig .TrafficEncapMode == config .TrafficEncapModeHybrid || c . networkConfig . TrafficEncapMode == config . TrafficEncryptionModeWireGuard ) {
11671167 writeLine (iptablesData , []string {
11681168 "-A" , antreaPreRoutingChain ,
11691169 "-m" , "comment" , "--comment" , `"Antrea: restore fwmark from connmark for reply Egress packets to remote Pods"` ,
0 commit comments