From 97664d8a6af0d70303b5015b22e472a853423764 Mon Sep 17 00:00:00 2001 From: alice02 Date: Tue, 19 Dec 2017 00:46:17 +0900 Subject: [PATCH] pkg/ipam: Skip ip.SettleAddresses if only IPv4 is used This change improves the performance of the ipam.ConfigureIface. Some plugins are slow because of the ip.SettleAddress in ipam.ConfigureIface. It seems to be only needed for IPv6, so should be skipped if only IPv4 is used. --- pkg/ipam/ipam_linux.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ipam/ipam_linux.go b/pkg/ipam/ipam_linux.go index 6c8ef20c..1fe89d8b 100644 --- a/pkg/ipam/ipam_linux.go +++ b/pkg/ipam/ipam_linux.go @@ -65,7 +65,9 @@ func ConfigureIface(ifName string, res *current.Result) error { } } - ip.SettleAddresses(ifName, 10) + if v6gw != nil { + ip.SettleAddresses(ifName, 10) + } for _, r := range res.Routes { routeIsV4 := r.Dst.IP.To4() != nil