diff --git a/src/sbin/pluginctl b/src/sbin/pluginctl index 160dd5a0d..8c31b3ace 100755 --- a/src/sbin/pluginctl +++ b/src/sbin/pluginctl @@ -3,7 +3,7 @@ /* * Copyright (C) 2019 Deciso B.V. - * Copyright (C) 2019-2023 Franco Fichtner + * Copyright (C) 2019-2024 Franco Fichtner * Copyright (C) 2017 Alexander Shursha * All rights reserved. * @@ -148,8 +148,9 @@ $opts = getopt('46cDdfghIirSsXx', [], $optind); $args = array_slice($argv, $optind); if (isset($opts['h'])) { - echo "Usage: pluginctl [-4|-c|-D|-d|-f|-g|-h|-I|-i|-r|-S|-s|-X|-x] ...\n\n"; + echo "Usage: pluginctl [-4|-6|-c|-D|-d|-f|-g|-h|-I|-i|-r|-S|-s|-X|-x] ...\n\n"; echo "\t-4 IPv4 address mode, return primary address of interface\n"; + echo "\t-6 IPv4 address mode, return primary address of interface\n"; echo "\t-c configure mode (default), executes plugin [_configure] hook\n"; echo "\t-D ifconfig mode, lists available devices\n"; echo "\t-d device mode, lists registered devices\n"; @@ -163,11 +164,11 @@ if (isset($opts['h'])) { echo "\t-s service mode (e.g. myservice restart)\n"; echo "\t-X XMLRPC sync metadata dump\n"; echo "\t-x XMLRPC sync key/value list\n"; -} elseif (isset($opts['4'])) { +} elseif (isset($opts['4']) || isset($opts['6'])) { $int = $args[0] ?? ''; $ret = []; if (!empty($config['interfaces'][$int])) { - $raw = interfaces_primary_address($int); + $raw = isset($opts['4']) ? interfaces_primary_address($int) : interfaces_primary_address6($int); $ret = [ 'address' => $raw[0], 'network' => $raw[1],