Merge pull request #1497 from gravitl/bugfix_v0.15.1_flush_routes

add check for nil peer.Endpoint
This commit is contained in:
Alex Feiszli 2022-08-30 16:13:07 -04:00 committed by GitHub
commit 3c29de63d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,6 +106,9 @@ func FlushPeerRoutes(iface, currentAddr string, peers []wgtypes.Peer) {
for _, allowedIP := range peer.AllowedIPs {
deleteRoute(iface, &allowedIP, currentAddr)
}
if peer.Endpoint == nil {
continue
}
if hasRoute && !ncutils.IpIsPrivate(peer.Endpoint.IP) {
ipNet, err := ncutils.GetIPNetFromString(peer.Endpoint.IP.String())
if err != nil {