| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
When reset, the timeserver list needs to be purged from whole
timesever history, in order to only contain the up-to-date values.
|
|
|
|
|
| |
Avoids wifi interface being removed and added again when tethering is
disabled.
|
|
|
|
|
| |
The value of the timeserver variable is incorrectly referred to
as timerserver. Change it to timeserver to be consistent.
|
| |
|
|
|
|
|
|
|
|
| |
The API has gone through a significant overhaul, and this change fixes any compile issues.
1) Fixes to configure.ac itself
2) Cleanup in pppd plugin itself
Adding a libppp-compat.h file to mask for any differences in the version.
|
|
|
|
|
|
|
|
| |
Two cases need to be fixed during the connection to a hidden service
with a wrong passphrase:
* the invalid key error shall be reported to the user,
* another attempt to connect to this hidden service shall be possible,
and succeed with the right passphrase
|
|
|
|
|
|
|
|
|
|
| |
set_disconnected() function shall not prevent the service to process errors
by replacing failure state by idle.
For example, when a connection fails with a wrong passphrase, the user still
needs to be informed, via the agent. However, in this case, the associated
service is automatically disconnected, canceling the pending agent requests.
The invalid key error shall be reported, instead of a cancel error.
|
|
|
|
|
| |
The --nodnsproxy option documentation left out that ConnMan will fall
back to creating a resolv.conf on startup. This gets fixed by this.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Avoid overwriting the read packet length after the initial test. Thus
move all the length checks which depends on the total length first
and do not use the total lenght from the IP packet afterwards.
Fixes CVE-2023-28488
Reported by Polina Smirnova <moe.hwr@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Error flow:
- __connman_service_create_from_network() creates network, but it is not
favorite since it is not yet saved
- trigger_autoconnect is skipped since !favorite
*** User calls Connect() ***
- iwd plugin gets connect() call
- iwd plugin finds out about new known network and copies the
autoconnect state of the iwd_network to the iwd_known_network, which
is false since it was zero initialized and nobody called
connman_network_set_autoconnect on it.
- iwd plugin tells iwd to set AutoConnect to false
- service_indicate_state() calls __connman_service_set_favorite(service,
true)
- nobody tells the iwd plugin about the change in favorite state
This patch calls trigger_autoconnect right at the end there, which will
then propagate the outcome of the favorite state to the iwd plugin. I
think this patch is the right design for the current architecture of the
autoconnect state management, but I think the autoconnect design
probably needs some changes outside the scope of this patch since it is
too easy to make these mistakes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to an extremely subtle bug in tracking the autoconnect state from
connman on through to iwd, iwd was incorrectly being sent zero-initialized
default data as the autoconnect value.
In particular, what happened is as follows:
- A new iwd_network is created for the iwd.Network that appears, which
also creates an associated connman_network. In the process of creating
the connman_network, the iwd plugin receives a callback that correctly
sets the cm_autoconnect state of the iwd_network.
- Connman's Service.Connect() function is called via D-Bus, which calls
into the iwd plugin, which in turn calls iwd.Network.Connect() over
D-Bus.
- The connection completes and the following fire:
- iwd.KnownNetwork created event, which is supposed to initialize the
cm_autoconnect state to that of the iwd_network, but this does not
occur since the iwd_network does not yet have a KnownNetwork
associated, so it remains uninitialized
- PropertyChanged event on the corresponding iwd.Network object,
with the new KnownNetwork property value, springing the trap set
earlier by synchronizing the zero-initialized
iwd_known_network.cm_autoconnect state to the iwd KnownNetwork
In practice, this looks like:
-> net.connman.iwd.Network.Connect() on /net/connman/iwd/0/3/0000000000000000000000_psk
<- RequestPassphrase()
-> (passphrase)
-> Set('AutoConnect', False) on /net/connman/iwd/0000000000000000000000_psk
This was found by investigating why my computer was not automatically
connecting to some networks after coming out of sleep, and finding that
the iwd AutoConnect setting was false on those networks while connman
thought it was true (in fact, this was the case! The connman iwd plugin
thought otherwise).
Reproduction:
connmanctl> agent on
Agent registered
connmanctl> config wifi_9cb6d0f7daaf_00000000_managed_psk --remove
connmanctl> connect wifi_9cb6d0f7daaf_00000000_managed_psk
Agent RequestInput wifi_9cb6d0f7daaf_00000000_managed_psk
Passphrase = [ Type=psk, Requirement=mandatory ]
Passphrase? 00000000
Connected wifi_9cb6d0f7daaf_00000000_managed_psk
$ busctl get-property net.connman.iwd /net/connman/iwd/00000000_psk net.connman.iwd.KnownNetwork AutoConnect
b false
Then sleep the machine and observe that the network is not automatically
reconnected.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The Hamachi VPN daemon setups a network interface calles 'ham0' which
is under control of this daemon. ConnMan should ignore it and not
starting to auto configure it.
Reported by: i.Dark_Templar <darktemplar@dark-templar-archives.net>
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit cb05780d86c3 ("ipconfig: Don't add invalid gateway
routes") as it introduced regressions for IPv4LL setups.
0.0.0.0 is a valid gateway address for IPv4LL setups (see forwarding
rules in RFC3927).
Reported by Geoffrey Van Landeghem <geoffrey.vl@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code path for TCP if the domain name is attached never worked. There
is a bug in the `hdr` pointer calculation in `ns_resolv`. Furthermore if
the first response from the server is negative or erroneous then the TCP
connection is terminated unconditionally, even if further responses are
pending.
This change splits off the initial part of forward_dns_reply() into a
new lookup_request() function. The information from the request_data
structure is used by the UDP and TCP processing code to determine
whether to keep the request (and TCP connection) around or not.
Furthermore errors in the `alt` message creation are fixed.
|
|
|
|
|
|
|
| |
- make variable declarations more local, if possible
- use more const variables where suitable
- more harmonized use of integer types (especially use size_t for buffer lengths)
- avoid duplicate or difficult to read code portions
|
|
|
|
| |
This should make the code logic a bit clearer and less convoluted.
|
| |
|
|
|
|
|
|
|
|
|
| |
- document function behaviour in comments
- use early exits where possible to reduce indentation levels
- move stack variables into more localized scopes
- reduce some duplicate code in uncompress() calls
- add TODO about likely logical error that could have ramifications
when fixing.
|
| |
|
|
|
|
|
|
|
|
| |
If the name is not found in an answer record then `ptr` is NULL and the
calculation at the end of the while loop `maxlen -= answers - ptr` will
underflow, resulting in a very large `maxlen` value and consequently in
out of bound read accesses parsing beyond the actual end of the answers
section.
|
|
|
|
|
|
|
|
| |
- move stack variables into more localized scopes
- use const parameters and variables where possible
- use named constants over literal numbers
- simplify some parsing details by using byte order macros or adding
some comments to make the intentions clearer
|
|
|
|
|
|
|
| |
- add a descriptive comment to make clear what the function does
- use const pointers and size_t where possible
- move stack variables into more localized scopes
- use named constants over literal numbers where applicable
|
|
|
|
|
|
|
|
| |
- use size_t for sizes and lengths where possible
- use named constants in favor of literal numbers
- more localized variable declarations
- prefer byte order macros over explicit byte operations
- add some comments and use early exits to simplify the code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
functions
- move all type declarations to the top of the unit to have them all in
one place, same for global variables
- introduce enums for having more descriptive identifiers for some of
the DNS header constants
- remove unnecessary zero initializations for global variables
- move variable declarations into more local scopes where possible (e.g.
in for loops). Shorter lifetimes of variables can make the code more
easy to follow.
- avoid some repetitive code sequences like `cache_free_ipv4()` by
moving them into separate functions
- use const variables in parameters where possible to make certain
guarantees of function calls more clear and avoid erroneous
assignments.
|
| |
|
|
|
|
|
| |
For refactoring the dnsproxy codebase using C99 language features will
come in handy (mostly for using more localized variable declarations).
|
|
|
|
|
|
|
|
|
| |
- enable debug() macro for test invocation which allows to get test logs
- actually trigger caching logic explicitly by querying the same
configurations twice in succession
- count the number of cache hits to catch regressions in the caching
functionality
- support custom domains for testing specified on the command line
|
|
|
|
|
| |
If there is no default DNS server when a fallback DNS server is created,
enable it.
|
| |
|
|
|
|
|
|
| |
Current compilers gcc-12 and clang-15 warn about an implicit function
declaration in gresolv.c, and this turns into a fatal error in clang-16
and eventually in future gcc.
|
|
|
|
|
|
|
|
|
|
| |
On WPA3-SAE authentication, wpa_supplicant goes directly from
authenticating to disconnected state if the key was invalid.
The above is currently not handled and the `connect-failed` error is
reported on such cases. In order to make the client agent prompt for a
new password, we need to handle this transition and report the
`invalid-key` error.
|
|
|
|
| |
No need to be clever. There is IPv4 and IPv6 nothing else.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The wispr_portal_request_portal() function is expected to read until
there is no data. Hence, the wp_context refcount is supposed to be
hold on while reading.
Furthermore, we should not return early when we read the
X-ConnMan-Status header. Instead we are supposed to go through the
normal return path so that we cleanup any added routing entries. Thus,
we also don't need to update the refcount in this code path as we
handle it at the main return path.
Fixes: 416bfaff9888 ("wispr: Update portal context references")
|
|
|
|
|
| |
The online check is not distinguishing between IPv4 and IPv6 but the
rest of the code assumes we handle them separately.
|
|
|
|
|
|
|
| |
When we assign an IPV4LL address we are calling
__connman_ipconfig_gateway_add() with an invalid GW set. It's propably
a safe bet to say NULL is never a valid GW, so let's filter it out for
all callers.
|
|
|
|
|
|
|
| |
__connman_wispr_start() should handle any errors reported by
wispr_portal_detect.
While at it also return early if the service type is not supported.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before (current state):
If the <STATEDIR> (/var/run/connman) directory exists, ConnMan writes
resolvfile into <STATEDIR>/resolv.conf. If it doesn't exist, it writes
into /etc/resolv.conf. If it fails, it does nothing.
Problem:
This is unclear and error prone. The user (or package maintainer) may
create the /var/run/connman directory for a pidfile or whatever and
surely doesn't expect ConnMan to suddenly stop updating
/etc/resolv.conf. Or the user doesn't want ConnMan to touch
/etc/resolv.conf (e.g. openresolv or similar tool is used),
ever. Configuring this use case by creating directory /run/connman (as
suggested e.g. on
https://wiki.archlinux.org/title/ConnMan#/etc/resolv.conf) is really
weird... and error prone.
After:
The user can explicitly set path for the resolvfile in connman.conf via
"ResolvConf" option. If this option is set, ConnMan writes
resolvfile to the specified file (and creates it if doesn't exist). If
it fails (e.g. directory doesn't exist or file is not writable) or the
path is /dev/null or an empty string, it does nothing.
If this option is not set, it behaves as before.
Signed-off-by: Daniel Wagner <wagi@monom.org>
Link: https://lore.kernel.org/r/20220615165350.11431-1-jakub@jirutka.cz
|
| |
|
|
|
|
|
|
|
|
|
|
| |
There is a mismatch of handling binary vs. C-string data with memchr
and strlen, resulting in pos, count, and bytes_read to become out of
sync and result in a heap overflow. Instead, do not treat the buffer
as an ASCII C-string. We calculate the count based on the return value
of memchr, instead of strlen.
Fixes: CVE-2022-32292
|
|
|
|
|
|
| |
Maintain proper portal context references to avoid UAF.
Fixes: CVE-2022-32293
|
|
|
|
|
|
|
|
| |
Track the connman_wispr_portal_context live time via a
refcounter. This only adds the infrastructure to do proper reference
counting.
Fixes: CVE-2022-32293
|
|
|
|
|
|
| |
connmand[16822]: Failed to find URL:http://ipv6.connman.net/online/status.html
connmand[16822]: src/wispr.c:proxy_callback() proxy (null)
(connmand:16449): GLib-CRITICAL **: 10:15:43.812: g_str_has_prefix: assertion 'str != NULL' failed
|
|
|
|
|
|
|
| |
This data structure is a hash table, so replace the '_list' with
'_hash' to reduce the possibility for confusion.
Signed-off-by: Daniel Wagner <wagi@monom.org>
|