Skip to content

Commit d1044aa

Browse files
fix(vpcnatgateway): bgp speaker would crash if no ipv4 is available (#6059)
GoBGP v4 seems to crash when serializing with an invalid RouterID, whereas on older version, it defaulted to 0.0.0.0. There's functionally no problem with multiple peers having the same RouterID when doing eBGP. If using route reflectors, it might be more of a problem. In that case, users can use the --router-id parameter. Note that this case should not occur anyway, the NAT GW doesn't support IPv6 only networks right now as it cannot do NATv6. This is purely a failover to prevent crashes. Signed-off-by: SkalaNetworks <contact@skala.network>
1 parent 16106fc commit d1044aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/speaker/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ func ParseFlags() (*Configuration, error) {
183183
if config.RouterID == nil {
184184
if podIPv4 != "" {
185185
config.RouterID = net.ParseIP(podIPv4)
186-
} else {
187-
config.RouterID = net.ParseIP(podIPv6)
188186
}
187+
189188
if config.RouterID == nil {
190-
return nil, errors.New("no router id or POD_IPS")
189+
// RouterID must be an IPv4. If no IPv4 exists on the speaker, fallback to 0.0.0.0 to avoid GoBGP crashing.
190+
config.RouterID = net.ParseIP("0.0.0.0")
191191
}
192192
}
193193

0 commit comments

Comments
 (0)