3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-28 21:19:24 +01:00
Commit Graph

351 Commits

Author SHA1 Message Date
Tim Kourt
19529a4d3a client: Don't register agent without a need
Register agent iff no '--dontask' command-line option has been provided
or there are some other command line options besides '--dontask'
2019-09-19 12:36:12 -05:00
Tim Kourt
411834e089 client: Remove unused API 2019-09-19 12:36:12 -05:00
Tim Kourt
79ccff464f client: Provide '--help' command-line option
In addition, this improves the 'help' display
2019-09-19 11:29:09 -05:00
Tim Kourt
d369a650ab client: Don’t prompt for secrets if '--dontask' is used 2019-09-19 11:26:40 -05:00
Tim Kourt
62d286a745 client: Add '--dontask' command-line option
This option prevents iwctl from prompting user for the secrets
if they were not provided as the command-line arguments.
2019-09-19 11:26:19 -05:00
Tim Kourt
0a1cd37228 client: Enable lookup of command options with no arguments.
Previously, command_option_get used to return NULL in the following
two scenarios: when command-line option with a such name didn’t exists
or its argument was not provided. This worked great for the cmd-line
options with the required arguments. With introduction of the cmd-line
options with no or optional arguments the function was changed to return
a boolean value indicating the existence of a such option and then, if
it had an argument - value_out variable would have been set.

Thereafter, this patch modifies the current usages of command_option_get.
Note, in these particular applications of command_option_get there is no
need to check the returned value from command_option_get, since these
options have the required arguments and we can only check if the value_out
parameter has been set or not.
2019-09-19 11:25:53 -05:00
Tim Kourt
8be98d6149 client: Change semantics of return value from command_init
Instead of returning the mode of execution, command_init now
returns whether we are done and need to exit.

Thereafter, the mode of execution is now obtain though the command
module’s API.
2019-09-17 16:17:30 -05:00
Tim Kourt
df32279a31 client: Enable non-interactive mode support for agent prompts 2019-09-02 16:12:37 -05:00
Tim Kourt
02e38304b3 client: Prompt user for missing secrets in non-interactive mode
In non-interactive mode, prompt user for the missing secrets if
no command-line options were given.
2019-09-02 16:12:37 -05:00
Tim Kourt
589f6182b5 client: Set exit status on agent reg. failure 2019-09-02 16:12:37 -05:00
Tim Kourt
6c64016402 client: Make agent registration unconditional 2019-09-02 16:12:37 -05:00
Tim Kourt
ebad9bf9be client: Enhance secret masking
Due to the changed IO behavior, pasting of the secrets
into the agent prompt became impossible. The reimplemented
logic allows to add (paste) an arbitrary number of characters
into a desired position of a secret string up to its max lengths.
The deletion has also been reworked to accommodate the new behavior.
2019-08-27 13:25:14 -05:00
Tim Kourt
44fcb2b1d7 client: Preserve command history in between the instances
This also limits the number of entries in history to 24.
2019-08-27 10:30:01 -05:00
Tim Kourt
cc7cab63d2 client: Enable agent to query command-line options
Enable agent to query the command-line options for the requested
credentials in non-interactive mode.
2019-08-15 15:06:59 -05:00
Tim Kourt
c806e6a32a client: Don't quit on agent manager's callbacks in non-interactive mode
In non-interactive mode the agent managers' agent registration callback
precede the actual action command's callback such as 'connect'. iwctl
continues execution until anything else besides the agent registration
callback arrives unless the agent registration has failed.
2019-08-15 15:06:59 -05:00
Tim Kourt
a306b79e8f client: Move definition of agent manager interface
Make the definition of the agent manager interface public.
2019-08-15 15:06:59 -05:00
Tim Kourt
13b22b3744 client: Change agent registration scenarios
Previously, agent was registered only for the interactive mode.
This patch enables agent registration in non-interactive mode
taking into consideration the existence of the command-line options.
2019-08-15 15:06:59 -05:00
Tim Kourt
1c7344fdf6 client: Check status of the command-line option parsing
Check status of the command-line option parsing and quit on error.
2019-08-15 15:06:59 -05:00
Tim Kourt
6d31c9313f client: Introduce command options
Enable parsing of the command-line options by the command module.
The parsed command-line option values are stored in command_options
list and made available through the module’s public API:
command_option_get – allows querying options by name,
command_has_options – checks existence of the options.
2019-08-15 15:06:59 -05:00
Tim Kourt
09f454b19f client: Refactor error message formating 2019-08-15 15:06:59 -05:00
Tim Kourt
34800bfa63 client: Enable word completion for the SSIDs with spaces
"I--> results in "IWD 1"
2019-07-23 17:20:39 -05:00
Tim Kourt
f1dd6b1084 client: Fix network name completion after restart of iwd
Previously, on service disappeared event the list of the known
proxy objects was cleared, but pointers to the default entity
per command family wasn’t reset. Reset default entities for
the command families to remove the dead pointers to the deleted
proxy objects.

==1325== Invalid read of size 8
==1325==    at 0x4055D4: proxy_interface_is_same (dbus-proxy.c:439)
==1325==    by 0x407C28: match_by_partial_name (network.c:220)
==1325==    by 0x40547C: proxy_interface_find_all (dbus-proxy.c:424)
==1325==    by 0x405592: proxy_property_str_completion (dbus-proxy.c:153)
==1325==    by 0x407DA9: network_name_completion (network.c:241)
==1325==    by 0x4E596D5: rl_completion_matches (in /usr/lib64/libreadline.so.7.0)
2019-07-18 23:37:54 -05:00
Tim Kourt
e343162531 client: Add 'set-property' cmd for known networks 2019-04-11 10:57:14 -05:00
Tim Kourt
c7855af5d5 client: Add 'Autoconnect' property for known networks 2019-04-11 10:56:55 -05:00
Tim Kourt
bb33c5db8c client: Add 'Yes', 'No' property type support
This property type will be used for the argument completion among
the properties that require Yes or No value.
2019-04-11 10:54:07 -05:00
Tim Kourt
f5674a2356 client: Eliminate property_value_options struct
property_value_options is replaced with an array of strings
that represent value options for the properties
2019-04-11 10:53:17 -05:00
Tim Kourt
f1e5bc0645 client: Add 'show' cmd for known networks 2019-04-11 10:53:05 -05:00
Tim Kourt
d081f5f871 client: Switch known-networks cmd pattern to common scheme
Switch the command pattern to match the common command scheme
where the entity name (network name) follows the command family name:
From
	known-network forget <network name>
To
	known-network <network name> forget

In addition, it extracts the network match by name logic into its
own function for the further reusability. In the case of ambiguity
between the network objects with the same SSID but different security
types the logic asks to specify the security type in addition
to the network name as follows:
	known-network <network name.security> forget
2019-04-11 10:53:03 -05:00
Tim Kourt
4fa5a9869b client: Add arg completion for the known networks
Enables tab-completion for the network names in known networks
command family. In addition, tab-completion is added for the
entity commands.
2019-04-11 10:51:13 -05:00
Tim Kourt
b30b84373d client: Fix property completion mem leak 2019-04-09 00:05:07 -05:00
Tim Kourt
bb4f4c8159 client: Remove DBus disconnect message 2019-04-09 00:04:47 -05:00
Tim Kourt
6e8ad37ff3 client: Use proper output func 2019-04-09 00:04:47 -05:00
Tim Kourt
3d0f1dae12 client: Remove 'quit' message 2019-04-09 00:04:47 -05:00
Tim Kourt
7ac111cff4 client: Remove unused state 2019-03-22 18:10:47 -05:00
Tim Kourt
acbba6028b client: Remove unused interface 2019-03-21 17:02:20 -05:00
Jason Phan
25823752b3 client: Fix prompt masking
Entering 23 characters at a prompt resulted in 9 extra characters being
added to the line. At this point, you would only be abel to backspace
until the 9th character.

It seems that claling both rl_replace_line("", 0) and rl_redisplay()
before rl_replace_line(masked_input.mask, 0) causes this to happen. Both
calls are redundant anyways as iwctl functions exactly the same without
them (plus no more bug).
2019-03-21 16:16:59 -05:00
Jason Phan
52afe193e6 client: agent: fix agent prompt calls
The password and passphrase processing function calls were switched.
2019-03-20 13:00:11 -05:00
Tim Kourt
569ffdd508 client: Add 'show' command to device in station mode 2019-02-26 12:33:26 -06:00
Marcel Holtmann
42f5d905b1 client: List all enum values in switch statement 2018-12-07 08:58:53 +01:00
Denis Kenzior
5d1e24568f client: Reword station/ap/adhoc list command help
This also fixes a typo in station list help that refers to Station
devices as 'Ad-Hoc'
2018-11-29 20:34:10 -06:00
Tim Kourt
10a4e01657 client: Fix mem leak 2018-11-12 19:25:19 -06:00
Tim Kourt
b0e5b9de02 client: Optimize network property lookups 2018-11-12 11:10:23 -06:00
Tim Kourt
13c4095b77 client: Add SupportedModes property to the adapters 2018-11-12 10:38:00 -06:00
Tim Kourt
a7c28c4977 client: Fix display of the quoted params 2018-11-12 10:37:19 -06:00
Tim Kourt
5afe4576a1 client: Enable 'help', 'version' cmds in non-interactive mode 2018-11-12 10:37:09 -06:00
Tim Kourt
7df4f2e86b client: Fix display refresh after agent prompt
The line count was one line off after the Agent prompt, thus making
the command output to scroll up on each refresh.
2018-11-12 10:36:58 -06:00
Tim Kourt
9c8be9404b client: Update properties for inline display 2018-11-12 10:36:56 -06:00
Denis Kenzior
48b74d6531 client: Update to the new GetHiddenAccessPoints API 2018-11-09 14:06:20 -06:00
Tim Kourt
19f45d9752 client: Implement GetHiddenStations API 2018-11-09 11:34:43 -06:00
Tim Kourt
67f245a497 client: Fix argv for display refresh 2018-11-09 11:34:43 -06:00
Tim Kourt
97cdffc4cd client: Add property 'hidden' to known network 2018-11-09 11:34:43 -06:00
Tim Kourt
a435f8fd4d client: Fix header display for known network list 2018-11-09 11:34:43 -06:00
Marcel Holtmann
63bafa7adf client: Fix includes for using with -std=c99 compiler option 2018-11-01 22:19:45 +01:00
Marcel Holtmann
72a64fa7fb build: Adjust to the latest ELL signal API changes 2018-11-01 22:09:19 +01:00
Andrew Zaborowski
558341a689 client: Fix two format strings 2018-11-01 15:04:56 -05:00
Marcel Holtmann
fe034229eb client: Use l_main_run_with_signal instead of open coding it 2018-11-01 20:48:03 +01:00
Denis Kenzior
405de7019c client: Unify device sibling interface arg completion
Station, WSC, Ad-Hoc and AP family_arg_completion functions were
identical except for which commands they were referencing and the
interface type they were interested in.  Combine all these into a single
function.
2018-09-14 22:59:19 -05:00
Denis Kenzior
304d328bf3 client: Move Device.GetOrderedNetworks to station 2018-09-14 21:45:08 -05:00
Denis Kenzior
7e792071d3 client: Add network_get_name 2018-09-14 21:44:42 -05:00
Denis Kenzior
b64ba2ba0e client: Add network_get_type 2018-09-14 21:44:22 -05:00
Denis Kenzior
8fd8852bf1 client: Move device connect method to station 2018-09-14 21:33:40 -05:00
Denis Kenzior
86e8b8c322 client: Move Device.ConnectHiddenNetwork to station 2018-09-14 21:27:55 -05:00
Denis Kenzior
189a96e91a client: Move Device.Scan method to Station 2018-09-14 21:20:33 -05:00
Denis Kenzior
81dd689611 client: Move Device.Disconnect to Station 2018-09-14 21:20:31 -05:00
Denis Kenzior
6b46beef45 client: Move properties from Device to Station 2018-09-14 21:12:11 -05:00
Denis Kenzior
904d65ce79 client: Get rid of dbus_proxy bind/unbind 2018-09-14 03:47:17 -05:00
Denis Kenzior
48870d0911 client: Expand proxy_property_str_completion
This function now takes an extra argument 'extra_interface'.  When
non-NULL, the property match is furthered filtered by checking whether
the proxy_interface on the given path also contains an interface of type
'extra_interface'
2018-09-14 03:47:17 -05:00
Denis Kenzior
5aa5e2fef6 client: wsc: Get rid of bind/unbind_interface 2018-09-14 03:47:17 -05:00
Denis Kenzior
d90eb32cb0 client: ap: Get rid of bind/unbind_interface 2018-09-14 03:47:17 -05:00
Denis Kenzior
3dab3a1680 client: adhoc: Get rid of bind/unbind_interface 2018-09-14 03:47:17 -05:00
Denis Kenzior
71ea1e102a client: Add device_proxy_find 2018-09-14 03:47:17 -05:00
Denis Kenzior
f85685c9e4 client: Add proxy_interface_get_path 2018-09-14 03:47:17 -05:00
Denis Kenzior
ad13680420 client: dbus-proxy: Relax requirements for find_all
If the function is not provided, assume that we want to match all
proxies of a given interface.
2018-09-14 03:47:17 -05:00
Tim Kourt
a7aecb8573 client: add noninteractive support into main 2018-08-06 12:42:09 -05:00
Tim Kourt
9944b7b3b5 client: add noninteractive support into proxy 2018-08-06 12:42:06 -05:00
Tim Kourt
1d931d8a68 client: add noninteractive support for cmds 2018-08-06 12:42:03 -05:00
Tim Kourt
ef2878d5ee client: rename generic cmd list 2018-08-06 12:32:49 -05:00
Tim Kourt
2ba4efe39e client: add new command statuses
Split CMD_STATUS_OK into CMD_STATUS_DONE and CMD_STATUS_TRIGGERED.
The split is necessary for the enablement of noninteractive mode.
2018-08-06 12:32:22 -05:00
Tim Kourt
ce4a272186 client: move static array inits out of display_init() 2018-08-03 14:42:04 -05:00
Tim Kourt
664723f427 client: remove unused ordered networks from device 2018-08-02 20:54:41 -05:00
Tim Kourt
273d5d264a client: truncate long property strings
provide accessors for the vendor and model properties
2018-08-02 20:54:32 -05:00
Tim Kourt
8238ca7fce client: destroy builder on append failure 2018-08-02 20:54:28 -05:00
Tim Kourt
a3bc408ae4 client: truncate value string to the column length 2018-08-02 20:54:25 -05:00
Andrew Zaborowski
f6aa2c7236 client: Fix comparing current prompt against previous
We'd add the new command propmpt to history if it was different from
what current_history() returned which may not be the last command
executed, so we'd possibly add multiple identical commands to history
and skip some that were new.  Instead compare against
history_get(last index).
Also remove an always-true part of the condition on the next line.
2018-08-01 09:32:00 -05:00
Andrew Zaborowski
2e08b3e129 client: Update known-networks commands with DBus API changes 2018-07-31 11:57:52 -05:00
Andrew Zaborowski
15ade259e6 client: Fix parsing commands with no "entity" part
The code would assume that a command with argc >= 3 would always be
composed of <family name> <entity> <command> and thus
"known-networks forget <ssid>" could not be executed.  Instead of
checking argc >= 3 check whether command->entity is non-NULL.
2018-07-31 11:38:35 -05:00
Andrew Zaborowski
18e672fa2f client: Make sure network_args.type is initialised
Otherwise match_by_device_and_args might segfault.
2018-07-31 11:24:33 -05:00
Andrew Zaborowski
61bdb7e19f client: Free previous property values on update 2018-07-31 11:23:04 -05:00
Andrew Zaborowski
242a13df5a client: Drop known network LastSeenTime property 2018-07-31 11:20:09 -05:00
Tim Kourt
e3737fd44e client: fix mem leak after arg parsing 2018-07-30 13:18:35 -05:00
Tim Kourt
efe45e4180 client: add client support for AdHoc 2018-07-30 09:00:57 -05:00
Tim Kourt
727a44aab4 client: add AdHoc concept into device 2018-07-30 09:00:57 -05:00
Tim Kourt
0fec184eae client: add client support for AP 2018-07-30 09:00:57 -05:00
Tim Kourt
f9dc72088e client: add access point concept into device 2018-07-30 09:00:57 -05:00
Tim Kourt
6c80e1e277 client: add AdHoc and AccessPoint Dbus interfaces 2018-07-30 09:00:57 -05:00
Denis Kenzior
67e590cfeb client: Utilize l_parse_args 2018-07-30 08:59:55 -05:00
Tim Kourt
527c0060bc client: add property completion for set-property cmd
In addition, it defines the value options for the Power, WDS and
Mode properties. The builder variant appenders for 'Set' cmd
are also defined here.
2018-07-25 16:05:18 -05:00
Tim Kourt
5549219217 client: switch adapter to use proxy property completion
In addition, it defines the value options for the Power property
2018-07-25 16:05:16 -05:00
Tim Kourt
687dcc6145 client: add variant appender for the on/off properties 2018-07-25 16:05:12 -05:00
Tim Kourt
6ba707fca8 client: add completion for proxy property names and values 2018-07-25 16:05:09 -05:00
Tim Kourt
1e78ed5a7d client: add property setter for device 2018-07-25 16:04:59 -05:00
Tim Kourt
f7171665d1 client: add property setter for adapter 2018-07-25 15:26:48 -05:00
Tim Kourt
d3742ba651 client: add property setter for proxy
v2: renamed builder_append_value_variant -> append
2018-07-25 15:26:31 -05:00
Tim Kourt
c5cf3b083f client: add cmd line token finder
This allows to inspect the cmd line for the existence of a provided
token. This enables the completers to look back to what was entered
before them and make decisions based on that information. For
example, this can be used in completion of the property values
to identify the property for which the value is being completed.
2018-07-25 11:47:10 -05:00
Tim Kourt
bb1a0adec7 client: introduce proxy property utils
All of the shared functions related to the processing of the
proxy properties will reside in this collection.
2018-07-25 11:21:14 -05:00
Tim Kourt
2df7f76393 client: rename all local setters to follow nomenclature 2018-07-25 11:17:32 -05:00
Tim Kourt
46a188eb39 client: rename property setters
As the local objects are updated from DBus, the new name is more
appropriate for the purpose.
2018-07-25 11:16:54 -05:00
Tim Kourt
dbe36df5ae client: remove wsc capability indicator 2018-07-25 11:16:33 -05:00
Tim Kourt
a865f60c54 client: add 'Mode' property to device 2018-07-25 11:16:23 -05:00
Denis Kenzior
49d011dabe client: Use connect-hidden instead of create-hidden 2018-07-13 12:36:09 -05:00
Tim Kourt
f545f94581 client: add support for the hidden networks 2018-07-11 17:23:54 -05:00
Antonio Quartulli
8fdce84abb client: add support for WDS Device property 2018-06-13 21:20:44 -05:00
Tim Kourt
bb4df24fc5 client: workaround for readline prompt setting issue 2018-05-31 19:40:22 -05:00
Tim Kourt
33da1d77c2 client: change connect cmd logic
Change connection logic form using a list of the previously
obtained ordered networks to use network proxy objects.
This excludes the need to run get-networks command before
the connect command.
2018-05-31 19:39:58 -05:00
Tim Kourt
8a5927dc81 client: add network selection by device and args 2018-05-31 19:39:46 -05:00
Tim Kourt
0b84e31c40 client: change network_connect param type
Take network proxy object instead of just a path into
network_connect
2018-05-31 19:39:22 -05:00
Tim Kourt
b0a681d5b3 client: autocompletion for the network names 2018-05-31 19:38:50 -05:00
Tim Kourt
61ac55872e client: introduce a concept of a default device 2018-05-31 19:36:59 -05:00
Tim Kourt
fd23c87110 client: define default entity setter for cmd families 2018-05-31 19:30:44 -05:00
Tim Kourt
e71687e901 client: add proxy_interface comparison func. 2018-05-31 19:29:51 -05:00
Tim Kourt
53124e8fff client: abstract the value parameter for completion 2018-05-31 19:29:15 -05:00
Tim Kourt
0716334e61 client: Enable agent to control its prompt 2018-05-04 19:37:38 -05:00
Tim Kourt
3dc9f69c46 client: Expand agent functionality
Expand agent to support the inquiries for the
usernames and passwords
2018-05-04 19:37:00 -05:00
Tim Kourt
394e274f5f client: mask passphrase input 2018-05-03 16:34:26 -05:00
Tim Kourt
f9973a37f9 client: add new line 2018-05-03 16:00:23 -05:00
Tim Kourt
2c18646466 client: enable agent 2018-05-03 16:00:23 -05:00
Tim Kourt
8b4d4d17ec client: implement agent API 2018-05-03 16:00:23 -05:00
Tim Kourt
2817aeb35d client: disable cmd completion for the agent prompt 2018-05-03 16:00:23 -05:00
Tim Kourt
af14445509 client: add agent prompt to display 2018-05-03 16:00:23 -05:00
Tim Kourt
85a1678147 client: introduce agent 2018-05-03 16:00:23 -05:00
Tim Kourt
d1a00d9b34 client: implement agent-manager API 2018-05-03 16:00:23 -05:00
Tim Kourt
5c765bc886 client: switch to network argument parser 2018-03-28 14:43:58 -05:00
Tim Kourt
f1c5134448 client: add network args parser 2018-03-28 14:32:57 -05:00
Marcel Holtmann
f41fa52f99 client: Set saveptr argument of strtok_r to NULL for initial invocation 2017-08-30 23:17:53 +02:00
Tim Kourt
9bb19526d9 client: Exclude unnecessary checks
Arrays are guaranteed to be initialized during
the compilation time.
2017-08-23 16:26:05 -05:00
Tim Kourt
8071b51168 client: do display quit on exit 2017-06-09 14:08:21 -05:00
Tim Kourt
3bfbe72e33 client: Disable cmd refresh on console resize 2017-06-09 14:08:21 -05:00
Tim Kourt
2fb671e0d4 client: add flashing indicator for the updatable tables 2017-06-09 14:08:21 -05:00
Tim Kourt
5c9ed0ccf0 client: Allow switching between bars and dbms for rssi output 2017-05-30 17:19:54 -05:00
Tim Kourt
e6d4a34773 client: Add caption for misc. cmds 2017-05-30 17:14:08 -05:00
Denis Kenzior
f64dea81b8 client: Fix dbms to bar conversion utility
Andrew: Note the values aren't guaranteed to be round 100 multiples, so
-6050 is also possible.

Instead of a switch case, use if statements instead
2017-05-19 19:22:32 -05:00
Tim Kourt
17cad2777d client: convert dbms value into stars 2017-05-19 18:06:17 -05:00
Tim Kourt
02f47a164c client: fix dependency unbind logic 2017-05-19 18:05:16 -05:00
Tim Kourt
e42aee89b1 client: display table header for the empty lists 2017-05-19 18:04:43 -05:00
Tim Kourt
305af40636 client: fix display completion leak 2017-05-12 17:46:44 -05:00
Tim Kourt
89351da35f client: Add WSC list command 2017-05-12 17:46:44 -05:00
Tim Kourt
b530f4fb77 client: add completion for the cmds without entity 2017-05-12 17:46:44 -05:00
Tim Kourt
8eaeb66220 client: check for WSC-capability in arg completion 2017-05-12 17:46:44 -05:00
Tim Kourt
006e60d291 client: allow interface search by NULL property 'value' 2017-05-12 17:46:44 -05:00
Tim Kourt
14a18ce3df client: Add basic ops for wsc 2017-05-12 17:46:44 -05:00