mirror of
https://github.com/rancher/os.git
synced 2025-09-05 00:37:12 +00:00
Added wildcard matching on MAC addresses.
This commit is contained in:
committed by
niusmallnan
parent
66c5f6130a
commit
a6c1645d47
@@ -111,6 +111,11 @@ func findMatch(link netlink.Link, netCfg *NetworkConfig) (InterfaceConfig, bool)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(netConf.Match, "mac") {
|
||||
if strings.Contains(netConf.Match, "*") {
|
||||
// If selector contains wildcard * and MAC address matches wildcard then return
|
||||
return netConf, glob.Glob(netConf.Match[4:], link.Attrs().HardwareAddr.String())
|
||||
}
|
||||
|
||||
haAddr, err := net.ParseMAC(netConf.Match[4:])
|
||||
if err != nil {
|
||||
log.Errorf("Failed to parse mac %s: %v", netConf.Match[4:], err)
|
||||
|
Reference in New Issue
Block a user