Skip to content

Commit

Permalink
[VM Agent] Fix agent crash issue with nil pointer exception (#6748)
Browse files Browse the repository at this point in the history
Set default value on config.Egress.SNATFullyRandomPorts with VM Agent scenario
to avoid agent crash, although routeClient is not really consumed.

Fixes #6747 

Signed-off-by: Wenying Dong <[email protected]>
  • Loading branch information
wenyingd authored Oct 16, 2024
1 parent 9fd5d83 commit d6f809f
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 d6f809f

Please sign in to comment.