3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 03:32:42 +01:00
Commit Graph

372 Commits

Author SHA1 Message Date
James Prestwood
0868418ad1 treewide: fix spelling mistakes 2024-11-07 19:11:59 +01:00
James Prestwood
d2f14b2951 client: add station command "get-bsses"
This command will get the BasicServiceSet list for a given network.
If no network is supplied, its assumed to be the current network.
2024-08-12 12:10:58 -05:00
James Prestwood
73c79dbd41 client: refactor cmd_connect() and add find_network()
This will do all the lookup/searching needed to find a network
proxy object.
2024-08-12 12:10:58 -05:00
James Prestwood
0d7ff8ebd9 client: add BasicServiceSet interface 2024-08-12 12:10:58 -05:00
James Prestwood
05166d0999 client: Add BasicServiceSets property to network
The property itself is an array of paths, but this is difficult
to fit nicely within a terminal. Instead just display the count
of BSS's. Displaying a detailed list of BSS's will be done via
a separate command.
2024-08-12 12:10:58 -05:00
James Prestwood
0e3322b5da client: add net.connman.iwd.BasicServiceSet definition 2024-08-12 12:10:55 -05:00
James Prestwood
a7d8b9a068 client: separate property header and values into two functions
There are certain cases where we may not want to display the entire
header for a given set of properties. For example displaying a list
of proxy interfaces. Add finer control by separating out the header
and the prop/value display into two functions.
2024-08-12 12:10:50 -05:00
Yuki Sireneva
91f7253ae1 client: use display_table_row for IPv6 in station
IPv6 address entry was not updated to use display_table_row which led to
a shifted line in table, as shown below:

    $ iwctl station wlan0 show | head | sed 's| |.|g'
    .................................Station:.wlan0................................
    --------------------------------------------------------------------------------
    ..Settable..Property..............Value..........................................
    --------------------------------------------------------------------------------
    ............Scanning..............no...............................................
    ............State.................connected........................................
    ............Connected.network.....Clannad.Legacy...................................
    ............IPv4.address..........192.168.1.12.....................................
    ............IPv6.address........fdc3:541d:864f:0:96db:c9ff:fe36:b15............
    ............ConnectedBss..........cc:d8:43:77:91:0e................................

This patch aligns IPv6 address line with other lines in the table.

Fixes: 35dd2c0821 (client: update station to use display_table_row, 2022-07-07)
2024-07-23 18:52:51 -05:00
James Prestwood
6bedcb4622 client: fix two issues caught by static analysis
- va_end was not being called on an error condition
 - An uninitialized struct was being accessed if ioctl failed
2024-03-11 22:08:26 -05:00
James Prestwood
b7559d68c7 client: remove unneeded initialization 2024-03-04 13:48:08 -06:00
Ram Subramanian
9f31663e21 client: report channel if present in diag message 2024-02-26 09:44:25 -06:00
James Prestwood
407a8a4441 client: fix AP PairwiseCiphers parsing
This property was being parsed as "s" when it should be "as". This
results in "ap <wlan> show" having an empty entry for the
PairwiseCiphers list.
2024-01-04 12:18:40 -06:00
James Prestwood
3b6d279184 client: add client commands for shared code configuration
The StartConfigurator() call was left out since there would be no
functional difference to the user in iwctl. Its expected that
human users of the shared code API provide the code/id ahead of
time, i.e. use ConfigureEnrollee/StartEnrollee.
2023-11-11 10:27:27 -06:00
James Prestwood
6e2dacb0ec client: Add shared code DBus interface 2023-11-11 10:27:10 -06:00
Finn Behrens
8d2e35b2d4 client: display_completion_matches add 0-byte check
Check that enough space for newline and 0-byte is left in line.
This fixes a buffer overflow on specific completion results.

Reported-By: Leona Maroni <dev@leona.is>
2023-11-11 10:24:01 -06:00
Ronan Pigott
3687f7947b client: avoid segfault in iwctl quit
iwctl quit (running quit non-interactively) isn't a useful command,
but it shouldn't segfault. Let's avoid calling readline functions if
we haven't initialized readline in this run.
2023-05-07 18:03:11 -05:00
Marcel Holtmann
8f668cc3a8 client: Use _XOPEN_SOURCE define from strptime manual page 2023-04-21 06:32:11 +02:00
Neehar Vijay
78efd60297 client: fix non-interactive mode in some cases
Before this change, I noticed that some non-interactive commands
don't work,

  $ iwctl version

  $ iwctl help

while other ones do.

  $ iwctl station wlan0 show

This seems to be a typo bug in the if clause checking for additional
arguments.
2022-11-22 11:19:12 -06:00
James Prestwood
c53280062c client: add ap support for PairwiseCiphers/GroupCipher 2022-11-03 09:23:35 -05:00
Neehar Vijay
c63783ee89 client: fix extra newlines in station show
This change removes duplicate calls to display_table_footer(), in
station show.

Before this change, the bug caused an extra newline to be output every
time the table updated. This only occurred when the network was
disconnected.

    $ iwctl
    [iwd]# station wlan0 show
2022-11-02 16:39:59 -05:00
James Prestwood
47b6da81b4 client: show frequency with ap show 2022-11-01 15:49:12 -05:00
James Prestwood
dc6575130e client: fix missing character for line breaks without spaces
In nearly all cases the auto-line breaks can be on spaces in the
string. The only exception (so far) is DPP which displays a very
long URI without any spaces. When this is displayed a single
character was lost on each break. This was due to the current line
being NULL terminated prior to the next line string being returned.

To handle both cases the next line is copied prior to terminating
the current line. The offsets were modified slightly so the line
will be broken *after* the space, not on the space. This leaves
the space at the end of the current line which is invisible to the
user but allows the no-space case to also work without loss of
the last character (since that last character is where the space
normally would be).
2022-10-12 13:55:57 -05:00
James Prestwood
9d042ca321 client: fix not accounting for color escapes after line break
Each color escape is tracked and the new_width is adjusted
accordingly. But if the color escape comes after a space which breaks
the line, the adjusted width ends up being too long since that escape
sequence isn't appearing on the current line. This causes the next
column to be shifted over.
2022-10-12 13:55:47 -05:00
James Prestwood
ea82616b6b client: add extra parameter for new width when printing rows
The old 'max' parameter was being used both as an input and output
parameter which was confusing. Instead have next_line take the
column width as input, and output a new width which includes any
color escapes and wide characters.
2022-10-12 13:52:40 -05:00
James Prestwood
5010ca2c99 client: validate utf-8 before displaying row
In theory any input to this function should have valid utf-8 but
just in case the strings should be validated. This removes the
need to check the return of l_utf8_get_codepoint which is useful
since there is no graceful failure path at this point.
2022-10-12 13:52:10 -05:00
Pinghao Wu
d82869c346 client: handle wide chars for table rows
Find out printing width of wide chars via wcwidth().
2022-10-12 11:26:01 -05:00
James Prestwood
f9b7e32c2d client: better support utf-8 for table rows
The utf-8 bytes were being counted as normal ascii so the
width maximum was not being increased to include
non-printable bytes like it is for color escape sequences.
This lead to the row not printing enough characters which
effected the text further down the line.

Fix this by increasing 'max' when non-codepoint utf-8
characters are found.
2022-10-07 22:24:03 -05:00
James Prestwood
69e9945ef7 device: command: remove default device concept
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
2022-08-11 15:47:20 -05:00
James Prestwood
fce1bb60a8 client: fix station autocomplete with multiple phys
The limitations of readline required that the autocompletion choose
a 'default' device. With multiple phys this doesn't work. Now the
readline limitation has been worked around and station can look up
the device for the command completion.
2022-08-11 15:47:15 -05:00
James Prestwood
be02c3fa3d client: add station-debug command interface
This lets iwctl call methods on .StationDebug. The command
name is called 'debug'. This can only be used when IWD is
in developer mode
2022-08-11 15:47:08 -05:00
James Prestwood
9aefec6124 client: allow entity name to be passed to completion
There is a limitation of libreadline where no context/userdata
can be passed to completion functions. Thi affects iwctl since
the entity value isn't known to completion functions.

Workarounds such as getting the default device are employed but
its not a great solution.

Instead hack around this limitation by parsing the prompt to
extract the entity (second arg). Then use a generic match function
given to readline which can call the actual match function and
include the entity.
2022-08-11 15:47:02 -05:00
James Prestwood
fa56dcfe91 client: add STATION_DEBUG_INTERFACE definition 2022-08-11 09:45:48 -05:00
James Prestwood
b7664c7970 client: update ad-hoc table header
The table header needs to be adjusted to include spaces between
columns.
2022-07-07 14:09:03 -05:00
James Prestwood
951781686b client: update adapter table header
The table header needs to be adjusted to include spaces between
columns.

The 'adapter list' command was also updated to shorted a few
columns which were quite long for the data that is actually displayed.
2022-07-07 14:09:03 -05:00
James Prestwood
6ce16686df client: update device to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
82cc80e54e client: update command table header
The table header needs to be adjusted to include spaces between
columns.
2022-07-07 14:09:03 -05:00
James Prestwood
5bf1410ac4 client: update known-networks to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
89a86d0975 client: update ap to use display_table_row 2022-07-07 14:09:03 -05:00
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