Skip to content

Commit

Permalink
[VM Agent] Fix agent crash issue with nil pointer exception (antrea-i…
Browse files Browse the repository at this point in the history
…o#6748)

Set default value on config.Egress.SNATFullyRandomPorts with VM Agent scenario
to avoid agent crash, although routeClient is not really consumed.

Fixes antrea-io#6747 

Signed-off-by: Wenying Dong <wenyingd@vmware.com>
  • Loading branch information
wenyingd authored and hangyan committed Oct 29, 2024
1 parent 15536bf commit 8b006ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,10 @@ func (o *Options) setExternalNodeDefaultOptions() {
if o.config.ExternalNode.ExternalNodeNamespace == "" {
o.config.ExternalNode.ExternalNodeNamespace = "default"
}
// Regardless of whether the egress feature is enabled, o.config.Egress.SNATFullyRandomPorts should not be nil to prevent a crash in NewClient().
if o.config.Egress.SNATFullyRandomPorts == nil {
o.config.Egress.SNATFullyRandomPorts = ptr.To(o.config.SNATFullyRandomPorts)
}
}

func (o *Options) setMulticlusterDefaultOptions() {
Expand Down

0 comments on commit 8b006ab

Please sign in to comment.