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

360 Commits

Author SHA1 Message Date
James Prestwood
4913a4dd6e client: re-enable iwctl refresh for 'station <wlan> show'
When diagnostics got added to iwctl the refresh capabilities were
accidentally removed. This re-enables refresh.
2021-03-29 13:11:50 -05:00
James Prestwood
e7c7e7de41 client: add AverageRSSI to list of diagnostic values 2021-03-16 11:26:05 -05:00
Jonathan Liu
fe6f4153c5 client: add missing bracket for "ap <wlan> show"
Fixes: 9659c936cd ("client: implement "ap <wlan> show"")
2021-03-05 08:52:08 -06:00
James Prestwood
a327e3f4d8 client: remove warning on mkdir return
This fixes up a previous commit which breaks iwctl. The
check was added to satisfy static analysis but it ended
up preventing iwctl from starting. In this case mkdir
can fail (e.g. if the directory already exists) and only
if it fails should the history be read. Otherwise a
successful mkdir return indicates the history folder is
new and there is no reason to try reading it.
2021-02-09 14:49:17 -06:00
James Prestwood
17ba7e415b client: check mkdir return in display_init
Printing a warning is about all that we can do at this
point during initialization.
2021-02-08 14:23:15 -06:00
James Prestwood
3f1cd5a596 display: use l_strlcpy to avoid potential overflow
If 'entry' exceeds the length of 'line' we could overflow. Instead
use l_strlcpy and pass in the remaining amount of data left in
the buffer.
2021-02-08 14:23:04 -06:00
James Prestwood
5a65bc37fe diagnostics: check dbus variant parsing
If the diagnostics dictionary is invalid print an
error and do not continue parsing.
2021-02-08 13:55:49 -06:00
James Prestwood
5370fefdad client: update to work with diagnostic changes
The diagnostic interface will now only come up when station is
connected. This avoids the need for display station to return
a 'connected' out parameter. We can instead just see that
the diagnostic interface doesn't exist.
2021-02-03 13:37:19 -06:00
James Prestwood
bb7c515887 client: add Frequency to station show 2021-02-03 12:54:59 -06:00
James Prestwood
479506013c client: ap: show Name in 'ap <wlan> show'
This will show some basic AP information like Started and
network Name. Some cleanup was done to make the AP interface
and client table columns line up.
2021-02-02 15:54:10 -06:00
James Prestwood
68303ae485 client: add support for AP StartProfile
StartProfile was added to the AP interface but the required
command was never added to iwctl. This command requires a
profile exists in <configuration dir>/ap/. The syntax is as
follows:

ap <wlanX> start-profile <profile_name>
2021-02-01 15:37:46 -06:00
Denis Kenzior
944e0b5e23 client: Update copyrights 2021-01-25 10:46:07 -06:00
James Prestwood
8539c7aa9e client: remove display_dictionary
This has been replaced by diagnostic_display
2021-01-22 15:02:54 -06:00
James Prestwood
053afbf19b client: update station to use diagnostic_display 2021-01-22 15:02:35 -06:00
James Prestwood
9659c936cd client: implement "ap <wlan> show"
This command uses GetDiagnostics to show a list of connected
clients and some information about them. The information
contained for each connected station nearly maps 1:1 with the
station diagnostics information shown in "station <wlan> show"
apart from "ConnectedBss" which is now "Address".
2021-01-22 15:02:23 -06:00
James Prestwood
11d1d860f0 client: implement diagnostic module
For now this module serves as a helper for printing diagnostic
dictionary values. The new API (diagnostic_display) takes a
Dbus iterator which has been entered into a dictionary and
prints out each key and value. A mapping struct was defined
which maps keys to types and units. For simple cases the mapping
will consist of a dbus type character and a units string,
e.g. dBm, Kbit/s etc. For more complex printing which requires
processing the value the 'units' void* cant be set to a
function which can be custom written to handle the value.
2021-01-22 15:01:05 -06:00
James Prestwood
9ac59700d1 client: implement display_dictionary
This takes a Dbus iterator which has been entered into a
dictionary and prints out each key and value. It requires
a mapping which maps keys to types and units. For simple
cases the mapping will consist of a dbus type character
and a units string, e.g. dBm, Kbit/s etc. For more complex
printing which requires processing the value the 'units'
void* cant be set to a function which can be custom written
to handle the value.
2021-01-21 13:48:43 -06:00
James Prestwood
4233e0ca3a client: add AccessPointDiagnostic interface definition 2021-01-20 14:12:17 -06:00
James Prestwood
1f8f209c04 client: add station diagnostic information to 'show'
The information requested with GetDiagnostics will now appear in
the "station <iface> show" command. If IWD is not connected, or
there is no diagnostic interface (older IWD version) 'show' will
behave as it always has, only showing scanning/connected.
2021-01-19 13:10:12 -06:00
James Prestwood
c15cdbe753 client: add diagnostic interface definition 2021-01-19 13:10:12 -06:00
Ronan Pigott
0193940e50 client: ignore control sequence length in prompt
Readline uses the characters \001 and \002 to mark the start and end
of zero-length character sequnces in the prompt before prompt
expansion. Without these characters the input point can become offset
from the visual end of the prompt when performing some actions.
2020-12-09 09:40:40 -06:00
Denis Kenzior
9047157b5e client: Reset prompt on agent exit
When the client is interrupted in the middle of user input entry and the
input is masked, the terminal might be left in a weird state.  Make sure
to reset the prompt if the agent is being cleaned up in the middle of an
operation.
2020-08-20 09:52:46 -05:00
Denis Kenzior
9b459c1943 client: Set EXIT_FAILURE on SIGTERM/SIGINT 2020-08-18 21:09:30 -05:00
Tim Kourt
5d68fbd55f client: Automate display refresh enablement
The display refresh is automatically enabled or disabled depending on
the width of the window. This allows to avoid the incorrect display on
refresh for the small windows.
2020-04-08 21:01:27 -05:00
Tim Kourt
9eeaedf189 client: Rename window change signal for clarity 2020-04-08 21:01:18 -05:00
Rosen Penev
2acda158ef client: apply format attribute to two functions
Clang was able to find these extra ones.
2020-04-08 16:14:44 -05:00
Tim Kourt
36f962a4f0 client: Rephrase the wait messages 2020-04-08 16:14:29 -05:00
Tim Kourt
61e8a640b1 client: Rewrite workaround for readline
Instead of calling display(""), explicitly use the sequence of
commands to force readline to properly update its internal state
and re-display the prompt.
2020-04-08 16:13:45 -05:00
Diego Santa Cruz
0b65fe3a95 client: fix ad-hoc start_open DBus method name
Doing 'ad-hoc <wlan> start_open <"network name">' returned a
"No matching method found" error because start_open called
net.connman.iwd.AdHoc.Start instead of net.connman.iwd.AdHoc.StartOpen.
2020-04-06 17:17:19 -05:00
Tim Kourt
df64dd443e client: Rework agent registarion logic
Do agent registration as part of agent manager proxy creation.
This ensures that the registration call is made only after the agent
manager’s interface becomes available on the bus.
2020-02-27 16:30:11 -06:00
Tim Kourt
4fdb6bc9fa client: Reorder interface creation ops
Add the newly created proxy objects into the queue before the
interface specific initialization logic takes place. This way the new
proxy objects can be used within the initialization procedures.
2020-02-27 16:26:32 -06:00
Tim Kourt
c32495cf03 client: Fix proxy object's dependency resolution
Previously, the parsing of the OMs objects has been done in one pass,
therefore, the proxy object's dependencies may not have been parsed at the
time when they were looked up for the dependency assignments. Now, the
parsing of the OM objects is done in two passes: 1) Create proxy objects -
one per interface and path, 2) Populate the proxy objects with properties
and assign dependencies. Therefore, we are guaranteed to have the proxy
objects created by the time they are looked up for the dependency
assignments.
2020-02-07 15:24:47 -06:00
Denis Kenzior
f2af2d004d client: Make variables extern
These arrays should have been declared extern in the first place.
Newer versions of gcc now complain about this:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/dbus-proxy.o:(.bss+0x0): multiple definition of `properties_yes_no_opts'; client/adapter.o:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/dbus-proxy.o:(.bss+0x20): multiple definition of `properties_on_off_opts'; client/adapter.o:(.bss+0x20): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/device.o:(.bss+0x20): multiple definition of `properties_on_off_opts'; client/adapter.o:(.bss+0x20): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/device.o:(.bss+0x0): multiple definition of `properties_yes_no_opts'; client/adapter.o:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/known-networks.o:(.bss+0x0): multiple definition of `properties_yes_no_opts'; client/adapter.o:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/known-networks.o:(.bss+0x20): multiple definition of `properties_on_off_opts'; client/adapter.o:(.bss+0x20): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/properties.o:(.data.rel.local+0x0): multiple definition of `properties_yes_no_opts'; client/adapter.o:(.bss+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: client/properties.o:(.data.rel.local+0x20): multiple definition of `properties_on_off_opts'; client/adapter.o:
2020-01-27 09:47:40 -06:00
Marcel Holtmann
d3e00d7f0f client: Use XDG_DATA_HOME for history file if available 2019-12-13 09:33:19 +01:00
Marcel Holtmann
89e476d992 client: Use include path from top source directory 2019-12-13 09:02:42 +01:00
James Prestwood
e1ceafde3a client: fix use of non-ascii apostrophe 2019-11-21 14:00:35 -06:00
Tim Kourt
4f1c661273 client: Fail in non-interactive mode if iwd service isn’t running
In non-interactive mode request the managed object right away and do
not wait for the service to appear. This way client can fail right
away instead of endlessly waiting in non-interactive mode.
2019-11-08 21:22:37 -06:00
Tim Kourt
f20298dc4a client: Update rl_point to last known position
Keep cursor's position consistent when passphrase is reaching
its maximum by adding characters in the middle of the string

The use case is very rare as not many people will attempt to
modify the masked passphrase from the middle.
2019-10-29 18:17:33 -05:00
Tim Kourt
17ee4196f4 client: Increase passphrase buffer to accommodate for nil byte 2019-10-29 18:17:33 -05:00
Tim Kourt
d2bbdea24f manpage: Add command options and examples for iwctl 2019-10-29 15:07:09 -05:00
Tim Kourt
8d73480d99 client: Separate command option words by dash 2019-10-29 12:48:17 -05:00
Tim Kourt
37e6f6f08b client: Cancel agent prompt with CTRL+D
Previously, CTRL+D used to cause termination of the client. Now, the
command will cancel the agent’s prompts in agent mod. In regular mode
the behavior is unchanged.
2019-10-28 14:57:19 -05:00
Denis Kenzior
fea262c2aa client: Update agent manager path 2019-10-28 12:45:11 -05:00
Tim Kourt
00a427f430 client: Fail on requests with invalid arguments 2019-10-28 10:47:50 -05:00
Tim Kourt
b808816efe client: Respond to invalid agent requests
This allows to send an error back to iwd, instead of returning NULL
and waiting for iwd to timeout on agent request.
2019-10-28 10:47:29 -05:00
Tim Kourt
cfdb33f710 client: Modify error handler to return cancelation msg
This allows to send cancelation error back to iwd, instead of
returning NULL and waiting for iwd to timeout on agent request.
2019-10-28 10:47:01 -05:00
Tim Kourt
ceeab83fa8 client: Consolidate cancelation replies 2019-10-28 10:46:41 -05:00
Tim Kourt
75b7d18e0c client: Fix network name completion
Exclude the network names that are shorter then the query text
from the autocompletion network name list.
2019-10-25 13:20:07 -05:00
Marcel Holtmann
152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Tim Kourt
7e9df2cbd5 client: Don't check for errors on agent requests
method_call and method_reply of type error are mutually exclusive.  ell
will never forward method_reply messages to dbus services, so checking
for dbus_message_has_error is pointless.
2019-10-24 15:58:08 -05:00
Denis Kenzior
8dbbbaf631 client: Use AutoConnect as property name 2019-10-24 12:50:21 -05:00
Denis Kenzior
6ef5549faf client: Remove support for WDS property 2019-10-24 11:41:01 -05:00
Denis Kenzior
ad93ddd580 client: Update to the new wsc api naming 2019-10-24 10:49:13 -05:00
Tim Kourt
ea0fc68597 client: Check family name before comparison 2019-10-23 17:59:41 -05:00
Tim Kourt
13bb8c1afe client: Ignore invalid notifications 2019-10-23 17:44:51 -05:00
Tim Kourt
cfa652e9ba client: Treat invalid DBus reply same as an error 2019-10-23 17:44:16 -05:00
Tim Kourt
b35e3525be client: Init variable before usage
Uninitialized 'password' variable used to cause an error when --password
option wasn't avaiable
2019-10-21 10:51:52 -05:00
Tim Kourt
a5928f0e4c client: Simplify printing logic 2019-10-16 15:50:02 -05:00
Marcel Holtmann
765bb92084 build: Add skeleton manual pages for all installed binaries 2019-09-22 21:57:47 +02:00
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