3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00
Commit Graph

334 Commits

Author SHA1 Message Date
James Prestwood
0b68601c10 client: make COLOR_* macros take a string input
The existing color code escape sequences required the user to set the
color, write the string, then unset with COLOR_OFF. Instead the macros
can be made to take the string itself and automatically terminate the
color with COLOR_OFF. This makes for much more concise strings.
2022-07-07 14:09:03 -05:00
James Prestwood
e4c3cfd229 client: update CLEAR_SCREEN to be consistent with others
Clear screen used a \033 escape sequence while others used a \x
2022-07-07 14:09:03 -05:00
James Prestwood
da8a87fcf5 client: check NULL return for DPP cmd_show
If the DPP interface goes away this could return NULL which was
unchecked. Caught by static analysis.
2022-07-07 14:09:03 -05:00
James Prestwood
3ccaf7beed client: dpp: display table footer and set to auto update
The table footer never got added when the properties did. In addition
set the 'show' command to update since these properties could change.
2022-07-07 14:09:03 -05:00
James Prestwood
35dd2c0821 client: update station to use display_table_row
This includes updating diagnostics too, otherwise the output becomes
really nasty.
2022-07-07 14:09:03 -05:00
James Prestwood
e1d485029b client: update dbus-proxy to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
c7b0c57010 client: remove newline/tab encoding from help description
ad-hoc, ap, and wsc all had descriptions longer than the max width but
this is now taken care of automatically. Remove the tab and newline's
from the description.

The WSC pin command description was also changed to be more accurate
since the pin does not need to be 8 digits.
2022-07-07 14:09:03 -05:00
James Prestwood
80051f0124 client: add generic display function for table rows
There was no easy to use API for printing the contents of a table, and
was left up to the caller to handle manually. This adds display_table_row
which makes displaying tables much easier, including automatic support
for line truncation and continuation on the next line.

Lines which are too long will be truncated and displayed on the next
line while also taking into account any colored output. This works with any
number of columns.

This removes the need for the module to play games with encoding newlines
and tabs to make the output look nice.

As a start, this functionality was added to the command display.
2022-07-07 14:08:56 -05:00
James Prestwood
030251e78d client: add "dpp <wlan> show" command
This will show the newly added DPP properties
2022-06-29 14:47:51 -05:00
James Prestwood
2c92a5e137 client: support multi-line print for long values
The generic proxy property display was limited to a width for names/value
which makes the output look nice and uniform, but will cut off any values
which are longer than this limit.

This patch adds some logic to detect this, and continue displaying the
value on the next line.

The width arguments were also updated to be unsigned, which allows checking
the length without a cast.
2022-06-29 14:47:22 -05:00
James Prestwood
e0613311c2 client: fix crash from unknown properties
The dbus proxy code assumes that every interface has a set of
properties registered in a 'proxy_interface_property' structure,
assuming the interface has any properties at all. If the interface
is assumed to have no properties (and no property table) but
actually does, the property table lookup fails but is assumed to
have succeeded and causes a crash.

This caused iwctl to crash after some properties were added to DPP
since the DPP interface previously had no properties.

Now, check that the property table was valid before accessing it. This
should allow properties to be added to new interfaces without crashing
older versions of iwctl.
2022-06-28 17:49:16 -05:00
James Prestwood
d39389afdd client: add a few return checks
These were caught by static analysis
2022-03-18 11:31:48 -05:00
Vladimír Dudr
1d348b131d client: fix colors to make grey really grey
\e[1;30m is bold black, often, but not always displayed bright black or
bold bright black. In case it is displayed as real black it is
invisible. \e[1;90m is explicit bold bright black.

\e[37m is white, therefore it is not suitable to be labeled as GREY,
which is \e[90m
2022-03-16 09:56:08 -05:00
James Prestwood
2552ec26b7 client: add AP scanning support to iwctl 2022-02-28 13:32:24 -06:00
James Prestwood
ba040219ce client: add DPP client commands
Two commands were added:

dpp <iface> start-enrollee
dpp <iface> start-configurator
dpp <iface> stop

In addition there is support for using the qrencode utility for displaying
the QR code after DPP is started (enrollee or configurator. If qrencode is
found on the system the QR code will be displayed. Otherwise only the URI
will be printed to the console.
2021-12-20 18:13:44 -06:00
James Prestwood
c631dc88a0 client: add DPP interface 2021-12-20 18:13:44 -06:00
Fangrui Song
fa1c12453b build: treewide: Set retain attribute
LLD 13 and GNU ld 2.37 support -z start-stop-gc which allows garbage
collection of C identifier name sections despite the __start_/__stop_
references. GNU ld before 2015-10 had the behavior as well. Simply set
the retain attribute so that GCC 11 (if configure-time binutils is 2.36
or newer)/Clang 13 will set the SHF_GNU_RETAIN section attribute to
prevent garbage collection.

Without the patch, there are linker errors with -z start-stop-gc
(LLD default) when -Wl,--gc-sections is used:

```
ld.lld: error: undefined symbol: __start___eap
>>> referenced by eap.c
>>>               src/eap.o:(eap_init)
```

The remain attribute will not be needed if the metadata sections are
referenced by code directly.
2021-11-11 14:27:33 -06:00
James Prestwood
4e61d04e0d client: special case daemon interface for non-interactive
In non-interactive mode, when a dbus method call returns the process
exits. This is true for all methods except agent requests since e.g.
Connect() call automatically requests credentials and the client must
wait for that to return before exiting. The new daemon interface must
also be treated in the same way and not exit.
2021-11-02 16:14:21 -05:00
Denis Kenzior
4b1ce76549 client: Don't try to print addresses if not connected 2021-10-26 14:34:00 -05:00
Denis Kenzior
062fc7852a client: Only print daemon info in interactive mode 2021-10-26 07:48:33 -05:00
Denis Kenzior
93a06769c4 client: Print IP Addresses / hint about netconfig
When station 'show' is invoked, parse and print any IP addresses
associated with the interface.

If iwd network configuration is disabled and no IP addresses were
configured, print a hint to the user that a DHCP client might need to be
configured.
2021-10-25 17:25:18 -05:00
Denis Kenzior
48b0a95528 client: Print daemon information at startup 2021-10-25 17:24:51 -05:00
Sean Anderson
1134e55150 client: Show WEP networks as unsupported
WEP networks are not supported by iwd. However, the only indication is the
message "Operation not supported" while trying to connect. It is not clear
enough that this is due to intentional lack of support (as opposed to some
kind of misconfiguration). This patch explicitly lists WEP networks shown
with get-networks as unsupported. Hopefully this will make it clearer for
those of us not as familiar with iwd.
2021-04-30 13:10:43 -05:00
James Prestwood
874b17ca56 client: add Security key to diagnostics 2021-03-29 13:18:17 -05:00
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