Now that NMDevice reads the hwaddr directly from netlink, it's silly
to have every device subtype maintain its own hw-address property
(using data that it gets from the NMDevice base class).
Remove all the device-specific hw-address properties, and add one to
NMDevice instead. (Because of the way nm-properties-changed-signal
works, this has no effect on the D-Bus API.) Subclasses now call
nm_device_get_hw_address() in places where they used to just refer to
priv->hw_addr (and to simplify this, we now allow passing NULL for the
out length parameter, since the subclasses almost always know what the
length will be already).
Also reorganize/simplify a few other methods to take advantage of the
fact that NMDevice is now keeping track of the hw-address directly.
https://bugzilla.gnome.org/show_bug.cgi?id=699391
This is a simple testing tool. Even though it includes a basic help (just run
it without arguments), the command syntax often requires looking into the
code. Use it whenever you want to test specific behavior of nm-platform.
For regular tests, please amend the automatic testsuite instead.
On Linux, the gateway attribute is not a key attribute and therefore is
not necessary for functions that just need to identify a route. This may
be revisited when porting to other platforms but for now I want to keep
things simple.
"g_assert_cmpint (x, ==, y)" is nicer than "g_assert (x == y)",
because if it fails, it shows you the values of x and y in the assert
message. Likewise g_assert_cmpstr().
The "ifindex > 0" checks still just use g_assert(), since we don't
need to distinguish specific negative values there.
In some cases, callers don't need to distinguish, eg,
ip4-address-added from ip6-address-added, but just need to know what
device the event occurred on. Make this simpler by including the
ifindex as a separate explicit argument, allowing callers to just
ignore the struct part.
If a device becomes unmanaged or unavailable (eg, due to loss of carrier, becoming
unmanaged, rfkilled, supplicant crashing, etc), the ActiveConnection would simply
set state to UNKNOWN and the Manager wouldn't tear it down and remove it from the
ActiveConnections property list. Instead, these states should be treated the same
as if the device was deactivated cleanly so that the AC will accurately reflect
the device state and the Manager will clean the AC up.
Fixes comment #12 in:
https://bugzilla.gnome.org/show_bug.cgi?id=676285
Which it does whenever the 'bonding' module gets loaded no matter
what name the user wants to give the new bond interface.
Ported nm-system fix from commit 7cc95d8, using system() to avoid
dependency on NM libs.
Automatic test included. You have to run 'rmmod bonding' before testing
to ensure that the module is not already inserted. Second run without
rmmod always succeeds.
get_virtual_iface_name() returns an allocated interface name which
we must free; that wasn't being done when attempting to find the
interface for which a virtual interface needs to be created. Also
throw in a cleanup for the given-device-doesn't-exist case just to
make it clearer when the interface name is freed.
Settings with all-default values are not written to reduce
complexity of the keyfile (and be more human-readable friendly)
and that includes VLAN settings with a VLAN ID of zero. So
when reading this file back, if there is no 'base type' setting
(eg, the setting specified by the connection::type property)
then just add that setting. nm_connection_verify() will catch
cases where an empty 'base type' setting is invalid.
The code to check if an ethernet device had a matching connection was
not taking NMSettingConnection:interface-name into account, meaning it
might think a device had a matching connection when that connection
actually only matched a different device.
Fix this by calling nm_setting_connection_get_interface_name() rather
than nm_connection_get_virtual_iface_name() (which would always be
NULL for ethernet connections anyway).
Also, simplify the code a bit.
https://bugzilla.gnome.org/show_bug.cgi?id=696722
Add these aliases for the setting names '802-3-ethernet',
'802-11-wireless', and '802-11-wireless-security' and write them by
default. It's much friendlier for administrators to type, and a lot
less ugly.
Also works for:
[connection]
type=ethernet
The TRUE return got missed in the original commit of the AvailableConnections
code. _try_add_available_connection() returns TRUE if the connection was
added and FALSE if it wasn't, to allow the caller to optionally emit the
PropertiesChanged signal. Only TRUE was never returned...
The private reference to the NMDBusManager is created at
NMModemManager init time, and should only be cleared when the
NMModemManager is disposed. Instead it was getting cleared
whenever ModemManager1 was seen on the bus, and thus was unavailable
later when it was required to watch for the old ModemManager.
This caused NetworkManager to print warnings about NULL object
access to the console, and could prevent it from noticing when
ModemManager appeared on the system bus.
Extend nm-platform to support IPv4 and IPv6 route management.
Route features:
* Retrieve the list of IPv4 and IPv6 routes
* Add/delete/lookup IPv4 and IPv6 routes
* Flush all non-linklocal routes
Extend nm-platform to support IPv4 and IPv6 address management.
Address features:
* Retrieve the list of IPv4 and IPv6 addresses
* Add/delete/lookup IPv4 and IPv6 addresses
* Flush all non-linklocal addresses
Create the new nm-platform framework and implement link (or interface)
management. The nm-platform serves as the point of contact between
the rest of NetworkManager and the operating system.
There are two backends for nm-platform:
* NMFakePlatform: Fake kernel backend for testing purposes
* NMLinuxPlatform: Linux kernel backend for actual use
A comprehensive testsuite is included and will be extended with new
feature additions. To enable the Linux part of the testsuite, use
--enable-tests=root configure options and run 'make check' as root.
Use --enable-code-coverage for code coverage support.
./autogen.sh --enable-tests=root --enable-code-coverage
make
make -C src/platform check-code-coverage
Link features:
* Retrieve the list of links
* Translate between indexes and names
* Discover device type
* Add/remove dummy interfaces (for testing)
Thanks to Thomas Graf for helping with libnl3 synchronization issues.
We will very likely get the result of the connection attempt before the 2 mins,
either successful or error, but still we need to explicitly ask to keep the
DBus call open enough time.
This time should be enough to handle both the connection time (usually around
60s max), plus the time needed to register in the network and all the other
Simple.Connect() steps.
Allows DHCP to work when a bus daemon isn't running. This also
fixes a race condition where when multiple interfaces are attempting
to get a DHCP lease at the same time, if one DHCP client instance
triggers the callout, that instance gets the bus name, and any
other client triggering the callout at that time will fail because
the bus name is already taken. Since this commit allows using
a private socket, where no process has a bus name, this race is
avoided.
Also move the DHCP helper from callouts/ to src/dhcp-manager/ to
consolidate all the DHCP stuff and clean up some of the helper's
code.