diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index a94f46921..291847525 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4394,8 +4394,7 @@ function interfaces_primary_address($interface, $ifconfig_details = null) break; /* all done */ } - /* DO NOT REORDER */ - return [ 'address' => $ifcfgip, 'network' => $network, 'bits' => $subnetbits, 'device' => $device ]; + return [ $ifcfgip, $network, $subnetbits, $device ]; } function _interfaces_primary_address6($interface, $ifconfig_details = null, $allow_track = true, $link_local = false) diff --git a/src/sbin/pluginctl b/src/sbin/pluginctl index 1c1e27cb9..44f47a395 100755 --- a/src/sbin/pluginctl +++ b/src/sbin/pluginctl @@ -162,7 +162,14 @@ if (isset($opts['h'])) { echo "\t-S service metadata dump\n"; echo "\t-s service mode (e.g. myservice restart)\n"; } elseif (isset($opts['4'])) { - echo json_encode(interfaces_primary_address($args[0] ?? null), JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT) . PHP_EOL; + $raw = interfaces_primary_address($args[0] ?? null); + $ret = [ + 'address' => $raw[0], + 'network' => $raw[1], + 'bits' => $raw[2], + 'device' => $raw[3], + ]; + echo json_encode($ret, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT) . PHP_EOL; } elseif (isset($opts['D'])) { echo json_encode(legacy_interfaces_details($args[0] ?? null), JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT) . PHP_EOL; } elseif (isset($opts['d'])) {