Fix custom mac address with a custom cni network

The cni plugin `tuning` is required to set a custom mac address.
This plugin is configured in the default cni config file which is
packaged with podman but was not included the generated config form
`podman network create`.

Fixes #8385

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2020-11-24 15:09:20 +01:00
parent cd6c4cb0af
commit 9602e290de
4 changed files with 36 additions and 0 deletions

View File

@ -129,6 +129,16 @@ func (f FirewallConfig) Bytes() ([]byte, error) {
return json.MarshalIndent(f, "", "\t")
}
// TuningConfig describes the tuning plugin
type TuningConfig struct {
PluginType string `json:"type"`
}
// Bytes outputs the configuration as []byte
func (f TuningConfig) Bytes() ([]byte, error) {
return json.MarshalIndent(f, "", "\t")
}
// DNSNameConfig describes the dns container name resolution plugin config
type DNSNameConfig struct {
PluginType string `json:"type"`

View File

@ -176,6 +176,7 @@ func createBridge(name string, options entities.NetworkCreateOptions, runtimeCon
plugins = append(plugins, bridge)
plugins = append(plugins, NewPortMapPlugin())
plugins = append(plugins, NewFirewallPlugin())
plugins = append(plugins, NewTuningPlugin())
// if we find the dnsname plugin or are rootless, we add configuration for it
// the rootless-cni-infra container has the dnsname plugin always installed
if (HasDNSNamePlugin(runtimeConfig.Network.CNIPluginDirs) || rootless.IsRootless()) && !options.DisableDNS {

View File

@ -119,6 +119,13 @@ func NewFirewallPlugin() FirewallConfig {
}
}
// NewTuningPlugin creates a generic tuning section
func NewTuningPlugin() TuningConfig {
return TuningConfig{
PluginType: "tuning",
}
}
// NewDNSNamePlugin creates the dnsname config with a given
// domainname
func NewDNSNamePlugin(domainName string) DNSNameConfig {