Open dlipovetsky opened 1 year ago
Hi @dlipovetsky,
Thanks for reporting this issue.
You are correct, there is an unchecked condition where the underlying struct is nil
. Just to check before creating a fix, could you provide more code that you use for the Edge Gateway as I didn't manage to get a nil structure while fetching one, maybe there are more things to fix in the code.
@adezxc Sure! https://github.com/dlipovetsky/dnat-rules-example
Thanks for looking into this.
Describe the bug
I get a segmentation fault when adding a DNAT rule to an Edge Gateway.
The root cause appears to be that the
AddNATRuleAsync
method assumes thatEdgeGateway.Configuration.EdgeGatewayServiceConfiguration
is notnil
, and references itsNatService
field: https://github.com/vmware/go-vcloud-director/blob/c3b8ae89e81a01b16a51784630ce6d3b23263f99/govcd/edgegateway.go#L469-L474.Reproduction steps
Expected behavior
A DNAT rule is added to the edge gateway.
Additional context
I have successfully created DNAT rules on the edge gateway using the UI.
VCD version: 10.4.1.21373066 go-vcloud-director version: v2.20.0