- we commonly use "int addr_family" as parameters to functions.
But then inside the function, we often need to do something for
IPv4 or IPv6 specifically. Instead of having lots of redundant
"if (addr_family == AF_INET)" checks, prefer to have a variable
IS_IPv4 and/or use NM_IS_IPv4() macro.
- don't make the "IS_IPv4" variable a gboolean but an int. gboolean
is a typedef for int, so it's in practice exactly the same. However,
we use "IS_IPv4" as index to arrays of length 2, where at position
"1" we have the value related to IPv4. Using a gboolean to index
an array is a bit odd. Maybe a "int" is preferable here.
This is more about doing consistently one or the other. There are
no strong reasons to prefer gboolean or int.
Apparently it is not actually used, but the function implements
a return value for AF_UNSPEC, while also asserting that the addr_family
is AF_INET/AF_INET6. Drop the assertions.
If there are multiple NM_CON_DEFAULT() mentionings on the same line,
previously the script would not parse them all. Adjust, by first wrapping
the line.
These macros are consistent with NMP_OBJECT_TYPE_IP_ADDRESS()
and NMP_OBJECT_TYPE_IP_ROUTE(), in name and usage.
Replace the previous functions that had inconsistent and a verbose
naming.
Like what was done for activating an active connection, so
some state change are simulated and a dbus test method is added
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
Add reason for device state change.
Add dbus test method to force failure of activation, set the
device state and the active connection state.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
The modem device will have hardcoded capability which make it
compatible with GSM connection settings.
It will be seen with hardcoded ModemManager manager dbus object path
for the UDI property.
Add also a dbus test method to add the modem device.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
To be consistent with dbus.DbusException classes which do the
following in __init__:
def __init__(self, *args, **kwargs):
name = kwargs.pop('name', None)
if name is not None or getattr(self, '_dbus_error_name', None) is None:
self._dbus_error_name = name
if kwargs:
raise TypeError('DBusException does not take keyword arguments: %s'
% ', '.join(kwargs.keys()))
Exception.__init__(self, *args)
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
It's a bit ugly that NMActRequest also tracks the shared rules.
Why? It's just some additional state (the rules) and some additional
actions that should be done when activating/deactivating the profile.
NMActRequest also doesn't track the NMDhcpClient, so why these shared
rules?
Also, removing the rules from an object destructor is ugly. NMActRequest
is a GObject and ref-counted. We should not make assumptions when the
last reference gets releases, at least not in cases like this, where
we hand out the reference and the object is passed around through large
parts of the source code.
For now, still let NMActRequest keep track of NMUtilsShareRules.
Later this will be refactored too.
A static const array is marked as immutable by the linker.
This is what we want, because there is no need to change this
array.
Also, the tailing %NULL entry is not necessary, we can just
iterate over the fixed number of elements.
NML3Cfg is the manager instance for one interface (ifindex). For one
interface, it is not supported (nor useful) to run IPv4LL multiple
times. Hence, let NML3Cfg manage and return a single instance.
We may want to handle cases where we cannot assign a IPv4LL address
even after multiple attempts.
Add a new property nm_l3_ipv4ll_is_timed_out() to get into a failed
state. The user may choose to fail the activation or ignore it.
Also, remove some unused code and fix minor issues in NML3IPv4LL.
For hidden networks, we usually don't have an SSID. We try to match
and fill the SSID based on the profiles that we have:
<debug> [1603798852.9918] device[6b383dca267b6878] (wlp2s0): matched hidden AP AA:BB:CC:DD:EE:FF => "SSID"
However, we should not clear that value again on the next update:
<trace> [1603798856.5724] sup-iface[66c1a0883a262394,0,wlp2s0]: BSS /fi/w1/wpa_supplicant1/Interfaces/0/BSSs/3 updated
<debug> [1603798856.5726] device[6b383dca267b6878] (wlp2s0): wifi-ap: updated AA:BB:CC:DD:EE:FF (none)
Once we have a SSID, we can only update it to a better value,
but not clear it.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/438
Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
On Fedora 33 when compiling NetworkManager it is failing with the
following error:
```
ERROR: files left in build directory after distclean:
./docs/libnm/libnm.actions
make[1]: *** [Makefile:18427: distcleancheck] Error 1
make[1]: Leaving directory '/builddir/nm-build/NetworkManager/NetworkManager-1.27.90/_build/sub'
make: *** [Makefile:18356: distcheck] Error 1
Error make distcheck
```
Adding the file to the DISTCLEANFILES will enforce the removal of this
file.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/659
NML3Cfg already handles IPv4 ACD. IPv4LL is just a small additional
layer on top of that, so it makes sense that it also is handled by
NML3Cfg.
Also, the overall goal is that multiple NMDevice and NMVpnConnection
instances can cooperate independently. So if multiple "users" enable
IPv4LL on an interface, then we should only run it once. This is
achieved by NML3IPv4LL's API where users register what they want,
and NML3IPv4LL figures out what that means as a whole.
Also, we thus will no longer need to use sd_ipv4ll/n-ipv4ll, because
we implement it ourself.
On the one hand, we want to keep the private fields internal. On the
other hand, we want to directly expose the NML3AcdAddrTrackInfo, so
that the user can access them without copying or calling a function.
Previously, there was some union ugliness and some padding involved.
That was probably correct, but lets solve this somewhat nicer by
having the private fields in a "_priv" struct and use NML3AcdAddrTrackInfo
throughout.