Skip to content

Commit

Permalink
wireguard backend: avoid error message if route already exists
Browse files Browse the repository at this point in the history
While processing node add events, flannel-wg routes are added irrespective of whether they already exist. This causes an error message for each wg peer. This might be misleading since there is actually no problem. By add or replacing the route, this can be avoided.

Fixes flannel-io#1963
  • Loading branch information
Malte Lehmann authored and Malte Lehmann committed May 5, 2024
1 parent 6d18ae7 commit 216d4ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/backend/wireguard/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (dev *wgDevice) addRoute(dst *net.IPNet) error {
Dst: dst,
}

err := netlink.RouteAdd(&route)
err := netlink.RouteReplace(&route)
if err != nil {
return fmt.Errorf("failed to add route %s: %w", dev.attrs.name, err)
}
Expand Down

0 comments on commit 216d4ac

Please sign in to comment.