Package: openstack-cluster-installer Version: 42.3.0~bpo12+1 Severity: minor Tags: patch
During auto-racking the switchport name and NIC firmware version are rejected by OCI due to containing the / character: # lldpcli show n | grep -E '(SysDescr|PortID)' SysDescr: Dell EMC Networking OS10 Enterprise. PortID: ifname ethernet1/1/7 # ethtool -i eno12399np0 | grep firmware-version firmware-version: 220.0.57.0/pkg 22.00.07.60 I have attached a patch which updates the regex to permit the / character. I've also updated the error messages to contain the rejected data, as this may aid others in troubleshooting similar problems in the future? -- Regards Jim
diff --git a/src/report.php b/src/report.php index 1ade880a..e44cea94 100644 --- a/src/report.php +++ b/src/report.php @@ -585,33 +585,33 @@ if($n == 0){ if(isset($iface["name"]) && isset($iface["macaddr"]) && isset($iface["max_speed"])){ $if_name = $iface["name"]; $reg = '/^[0-9a-zA-Z-]{1,64}$/'; - if(!preg_match($reg,$if_name)) die("Network interface device name suspicious line ".__LINE__." file ".__FILE__); + if(!preg_match($reg,$if_name)) die("Network interface device name '$if_name' suspicious line ".__LINE__." file ".__FILE__); $safe_if_name = $if_name; $if_macaddr = $iface["macaddr"]; $reg = '/^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/'; - if(!preg_match($reg,$if_macaddr)) die("Network interface MAC address suspicious line ".__LINE__." file ".__FILE__); + if(!preg_match($reg,$if_macaddr)) die("Network interface MAC address '$if_macaddr' suspicious line ".__LINE__." file ".__FILE__); $safe_if_macaddr = $if_macaddr; $if_max_speed = $iface["max_speed"]; $reg = '/^[0-9]{1,10}$/'; - if(!preg_match($reg,$if_max_speed)) die("Network interface max_speed suspicious line ".__LINE__." file ".__FILE__); + if(!preg_match($reg,$if_max_speed)) die("Network interface max_speed '$if_max_speed' suspicious line ".__LINE__." file ".__FILE__); $safe_if_max_speed = $if_max_speed; $if_switch_hostname = $iface["switch_hostname"]; $reg = '/^((?!-))(xn--)?[a-z0-9][.a-z0-9-]{0,61}[a-z0-9]{0,1}$/'; - if(!preg_match($reg,$if_switch_hostname)) die("Switch hostname suspicious line ".__LINE__." file ".__FILE__); + if(!preg_match($reg,$if_switch_hostname)) die("Switch hostname '$if_switch_hostname' suspicious line ".__LINE__." file ".__FILE__); $safe_if_switch_hostname = $if_switch_hostname; $if_switchport_name = $iface["switchport_name"]; - $reg = '/^[.:0-9a-zA-Z-]{1,64}$/'; - if(!preg_match($reg,$if_switchport_name)) die("Switchport name suspicious line ".__LINE__." file ".__FILE__); + $reg = '/^[\/.:0-9a-zA-Z-]{1,64}$/'; + if(!preg_match($reg,$if_switchport_name)) die("Switchport name '$if_switchport_name' suspicious line ".__LINE__." file ".__FILE__); $safe_if_switchport_name = $if_switchport_name; if(isset($iface["firmware_version"]) && $iface["firmware_version"] != ""){ $if_firmware_version = $iface["firmware_version"]; - $reg = '/^[.:0-9a-zA-Z-]{1,64}$/'; - if(!preg_match($reg,$if_firmware_version)) die("Iface firmware version suspicious line ".__LINE__." file ".__FILE__); + $reg = '/^[\/.:0-9a-zA-Z-]{1,64}$/'; + if(!preg_match($reg,$if_firmware_version)) die("Iface firmware version '$if_firmware_version' suspicious line ".__LINE__." file ".__FILE__); $safe_if_firmware_version = $if_firmware_version; }else{ $safe_if_firmware_version = ""; @@ -620,7 +620,7 @@ if($n == 0){ if(isset($iface["driver"]) && $iface["driver"] != ""){ $if_driver = $iface["driver"]; $reg = '/^[_.:0-9a-zA-Z-]{1,64}$/'; - if(!preg_match($reg,$if_driver)) die("Iface driver name suspicious line ".__LINE__." file ".__FILE__); + if(!preg_match($reg,$if_driver)) die("Iface driver name '$if_driver' suspicious line ".__LINE__." file ".__FILE__); $safe_if_driver = $if_driver; }else{ $safe_if_driver = "";