diff --git a/libnetwork/drivers/bridge/brmanager/brmanager.go b/libnetwork/drivers/bridge/brmanager/brmanager.go index 22922d8253..e90d6febf6 100644 --- a/libnetwork/drivers/bridge/brmanager/brmanager.go +++ b/libnetwork/drivers/bridge/brmanager/brmanager.go @@ -15,11 +15,11 @@ type driver struct{} // // Deprecated: use [Register]. func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error { - return Register(dc, nil) + return Register(dc) } // Register registers a new instance of the bridge manager driver with r. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, diff --git a/libnetwork/drivers/host/host.go b/libnetwork/drivers/host/host.go index 7681541066..ee9adbc4d8 100644 --- a/libnetwork/drivers/host/host.go +++ b/libnetwork/drivers/host/host.go @@ -20,10 +20,10 @@ type driver struct { // // Deprecated: use [Register]. func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error { - return Register(dc, nil) + return Register(dc) } -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(NetworkType, &driver{}, driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, diff --git a/libnetwork/drivers/ipvlan/ivmanager/ivmanager.go b/libnetwork/drivers/ipvlan/ivmanager/ivmanager.go index e7e5a285d2..d3d841ecb3 100644 --- a/libnetwork/drivers/ipvlan/ivmanager/ivmanager.go +++ b/libnetwork/drivers/ipvlan/ivmanager/ivmanager.go @@ -15,11 +15,11 @@ type driver struct{} // // Deprecated: use [Register]. func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error { - return Register(dc, nil) + return Register(dc) } // Register registers a new instance of the ipvlan manager driver. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.GlobalScope, diff --git a/libnetwork/drivers/macvlan/mvmanager/mvmanager.go b/libnetwork/drivers/macvlan/mvmanager/mvmanager.go index ba69cd933f..b490c6769e 100644 --- a/libnetwork/drivers/macvlan/mvmanager/mvmanager.go +++ b/libnetwork/drivers/macvlan/mvmanager/mvmanager.go @@ -15,11 +15,11 @@ type driver struct{} // // Deprecated: use [Register]. func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error { - return Register(dc, nil) + return Register(dc) } // Register registers a new instance of the macvlan manager driver. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(networkType, &driver{}, driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.GlobalScope, diff --git a/libnetwork/drivers/null/null.go b/libnetwork/drivers/null/null.go index e275cf33b9..6246231df9 100644 --- a/libnetwork/drivers/null/null.go +++ b/libnetwork/drivers/null/null.go @@ -17,7 +17,7 @@ type driver struct { } // Register registers a new instance of the null driver. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(NetworkType, &driver{}, driverapi.Capability{ DataScope: datastore.LocalScope, }) diff --git a/libnetwork/drivers/overlay/ovmanager/ovmanager.go b/libnetwork/drivers/overlay/ovmanager/ovmanager.go index 127496dfba..256de20207 100644 --- a/libnetwork/drivers/overlay/ovmanager/ovmanager.go +++ b/libnetwork/drivers/overlay/ovmanager/ovmanager.go @@ -50,11 +50,11 @@ type network struct { // // Deprecated: use [Register]. func Init(dc driverapi.DriverCallback, _ map[string]interface{}) error { - return Register(dc, nil) + return Register(dc) } // Register registers a new instance of the overlay driver. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { return r.RegisterDriver(networkType, newDriver(), driverapi.Capability{ DataScope: datastore.GlobalScope, ConnectivityScope: datastore.GlobalScope, diff --git a/libnetwork/drivers/windows/overlay/overlay_windows.go b/libnetwork/drivers/windows/overlay/overlay_windows.go index 73c2e722de..ba02d251d2 100644 --- a/libnetwork/drivers/windows/overlay/overlay_windows.go +++ b/libnetwork/drivers/windows/overlay/overlay_windows.go @@ -26,7 +26,7 @@ type driver struct { } // Register registers a new instance of the overlay driver. -func Register(r driverapi.Registerer, _ map[string]interface{}) error { +func Register(r driverapi.Registerer) error { d := &driver{ networks: networkTable{}, } diff --git a/libnetwork/drivers_freebsd.go b/libnetwork/drivers_freebsd.go index 937115690a..b0e19ea911 100644 --- a/libnetwork/drivers_freebsd.go +++ b/libnetwork/drivers_freebsd.go @@ -5,5 +5,5 @@ import ( ) func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error { - return null.Register(r, driverConfig(null.NetworkType)) + return null.Register(r) } diff --git a/libnetwork/drivers_linux.go b/libnetwork/drivers_linux.go index a179d668c8..59b3f4e731 100644 --- a/libnetwork/drivers_linux.go +++ b/libnetwork/drivers_linux.go @@ -13,15 +13,19 @@ import ( ) func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error { + noConfig := func(fn func(driverapi.Registerer) error) func(driverapi.Registerer, map[string]interface{}) error { + return func(r driverapi.Registerer, _ map[string]interface{}) error { return fn(r) } + } + for _, nr := range []struct { ntype string register func(driverapi.Registerer, map[string]interface{}) error }{ {ntype: bridge.NetworkType, register: bridge.Register}, - {ntype: host.NetworkType, register: host.Register}, + {ntype: host.NetworkType, register: noConfig(host.Register)}, {ntype: ipvlan.NetworkType, register: ipvlan.Register}, {ntype: macvlan.NetworkType, register: macvlan.Register}, - {ntype: null.NetworkType, register: null.Register}, + {ntype: null.NetworkType, register: noConfig(null.Register)}, {ntype: overlay.NetworkType, register: overlay.Register}, } { if err := nr.register(r, driverConfig(nr.ntype)); err != nil { diff --git a/libnetwork/drivers_windows.go b/libnetwork/drivers_windows.go index f104ed88c1..56bab61b59 100644 --- a/libnetwork/drivers_windows.go +++ b/libnetwork/drivers_windows.go @@ -12,12 +12,12 @@ import ( func registerNetworkDrivers(r driverapi.Registerer, driverConfig func(string) map[string]interface{}) error { for _, nr := range []struct { ntype string - register func(driverapi.Registerer, map[string]interface{}) error + register func(driverapi.Registerer) error }{ {ntype: null.NetworkType, register: null.Register}, {ntype: overlay.NetworkType, register: overlay.Register}, } { - if err := nr.register(r, driverConfig(nr.ntype)); err != nil { + if err := nr.register(r); err != nil { return fmt.Errorf("failed to register %q driver: %w", nr.ntype, err) } }