Commit Graph

7207 Commits

Author SHA1 Message Date
Pavel Šimerda
2c656e37dd platform: add mss attribute to NMPlatformIP*Route 2013-05-03 19:50:17 +02:00
Dan Winship
9ce458256d core: reorganize hw-address properties
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
2013-05-03 13:19:16 -04:00
Martin Pitt
fa9b295c0e core: close private D-BUS connections on disconnect (bgo #698640)
Private connections need to be closed in addition to being unrefed.

https://bugzilla.gnome.org/show_bug.cgi?id=698640
2013-05-03 10:50:33 -05:00
Jiří Klimeš
dd80e247a9 ifcfg-rh: fix tests after nm_utils_wep_key_valid() fix
bfc20af513
2013-05-03 17:05:39 +02:00
Pavel Šimerda
acb1fd75bc platform: manual testing tool
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.
2013-05-03 15:38:57 +02:00
Pavel Šimerda
e2009e3fe3 platform: don't use gateway as key attribute for routes
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.
2013-05-03 15:38:57 +02:00
Dan Winship
b041877dc1 build: fix srcdir!=builddir 2013-05-03 09:33:57 -04:00
Dan Winship
2a617267d1 build: fix srcdir!=builddir 2013-05-03 09:22:58 -04:00
Dan Winship
bb9b276278 platform: use g_assert_cmpint() and g_assert_cmpstr() in tests
"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.
2013-05-03 08:39:19 -04:00
Dan Winship
283b8fb7d0 platform: add ifindex arg to NMPlatform signals
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.
2013-05-03 08:39:00 -04:00
Dan Winship
f92ce56739 core: add "assumed" arg to nm_device_set_ip6_config()
Although the code still does not support assuming IP6 configurations,
add an "assumed" flag to this function, to match
nm_device_set_ip4_config().
2013-05-03 08:38:51 -04:00
Dan Williams
22d2f571ce core: ensure ActiveConnections are torn down when device is unavailable (bgo #676285)
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
2013-05-02 14:44:01 -05:00
Pavel Šimerda
3545a89a99 platform: update gitignore for tests 2013-04-29 14:13:50 +02:00
Pavel Šimerda
a313da882a platform: suppress kernel's automatic creation of bond0 (rh #953466)
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.
2013-04-29 14:05:01 +02:00
Pavel Šimerda
1929471d5f platform: use NMPlatformError type instead of int 2013-04-29 14:00:26 +02:00
Dan Williams
7cc95d89a6 core: suppress kernel's automatic creation of bond0 (rh #953466)
Which it does whenever the 'bonding' module gets loaded no matter
what name the user wants to give the new bond interface.
2013-04-26 17:30:19 -05:00
Dan Williams
ef151c3f04 core: fix memory leak
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.
2013-04-23 14:01:24 -05:00
Jiří Klimeš
ac6543305e config: fix a crash in nm_config_device_get_hwaddr()
get_hw_address (nm_device_get_hw_address()) asserts and then SIGSEGV
happens in nm_utils_hwaddr_ntoa().

Found by pavlix in NM live VM.
2013-04-23 18:47:30 +02:00
Pavel Šimerda
f5507633f8 platform: bridging and bonding options 2013-04-20 03:43:25 +02:00
Pavel Šimerda
359dc35aa3 platform: setter/getter of /proc/sys and /sys options 2013-04-20 03:43:25 +02:00
Pavel Šimerda
81bf475b78 platform: master and slave devices 2013-04-20 03:43:25 +02:00
Martin Pitt
57a9fb3c89 Use %NULL macro in doc strings
Mass-converted "NULL" to "%NULL" in docstrings with

  find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
2013-04-19 10:08:17 -04:00
Jiří Klimeš
4950abfb87 trivial: update comments for 'new' --> 'new_connection' renaming 2013-04-18 11:38:08 +02:00
Dan Williams
83baf86a27 core: use nm_connection_replace_settings_from_connection()
And consolidate some of the code; we never need to replace the
connection's settings if nothing has changed.
2013-04-17 12:23:34 -05:00
Dan Winship
cb3a5998b3 trivial: .gitignore updates 2013-04-17 11:08:45 -04:00
Dan Winship
1fcb9d6de4 libnm-glib: fix nm_device_check_connection_compatible()
Set the GError when nm_device_check_connection_compatible() fails
because of interface_name mismatch.
2013-04-17 11:00:06 -04:00
Dan Winship
6fac44b872 core: set correct NMDeviceStateReason when IP config fails 2013-04-17 11:00:01 -04:00
Pavel Šimerda
6ede6ed17f trivial: fix typo in comment 2013-04-17 12:30:09 +02:00
Pavel Šimerda
0361b1ca8f trivial: ETHTOOL_GLINK usage explanation 2013-04-17 12:27:29 +02:00
Pavel Šimerda
5cc26c60ef trivial: use nl_cache_free instead of nl_cache_put
nl_cache_put is not present in older but still supported libnl releases.
2013-04-15 13:46:50 +02:00
Dan Williams
9f8b7ff51d keyfile: ensure all-default VLAN setting is read correctly
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.
2013-04-11 14:55:37 -05:00
Dan Winship
f1d31e36da settings: consider :interface-name in default wired connection matching
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
2013-04-11 14:54:40 -04:00
Dan Williams
c36200a225 keyfile: use 'ethernet', 'wifi' and 'wifi-security' group names (bgo #696940)
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
2013-04-11 10:52:39 -05:00
Jiří Klimeš
fa20c80819 wifi: fix NM crash on mode == NULL
caused by 53d8f49bcd
2013-04-11 15:29:12 +02:00
Dan Williams
302e8ccab0 core: ensure new available connections generate a ProperiesChanged signal (bgo #697743)
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...
2013-04-10 16:03:00 -05:00
Dan Williams
53d8f49bcd wifi: AP mode connections are always available
Just like adhoc, they don't need to be found in the scan list.
2013-04-10 16:02:35 -05:00
Dan Williams
6701181c35 ethernet: don't crash for PPPoE connections with no wired setting
PPPoE connections don't necessarily have a wired setting, so don't
require one here.
2013-04-10 13:37:22 -05:00
Jiří Klimeš
ac697a912e core: fix an assertion in nm_default_wired_connection_new()
nm_device_get_hw_address() has to be called with out_len
initialized to 0.
2013-04-10 18:58:21 +02:00
Dan Williams
caed13b3ef mobile: only clear dbus manager on quit
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.
2013-04-10 10:06:38 -05:00
Pavel Šimerda
b636ea86b1 platform: link features (carrier-detect and vlans)
Thanks to Jiří Pírko for help with ethtool features.
2013-04-10 16:40:58 +02:00
Pavel Šimerda
3071cc6511 platform: route management
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
2013-04-10 16:40:58 +02:00
Pavel Šimerda
0209db4111 platform: address management
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
2013-04-10 16:40:58 +02:00
Pavel Šimerda
c1e53dbf7c platform: link state, carrier and arp 2013-04-10 16:40:58 +02:00
Pavel Šimerda
15fd7cd75e platform: link management
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.
2013-04-10 16:40:58 +02:00
Aleksander Morgado
82f8451c10 modem-manager: wait up to 120s for the connection result
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.
2013-04-09 15:48:16 -05:00
Jiří Klimeš
f1ec2aa320 dbus: fix compilation with dbus-glib < 100
private_server_get_connection_owner() is also used in
nm_dbus_manager_new_proxy(), thus it must be available.
2013-04-09 10:35:01 +02:00
Dan Williams
b69171061c dhcp: use private socket to return status if available
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.
2013-04-08 11:30:31 -05:00
Dan Williams
8e0b75eb0c settings: remove NM_SETTINGS_ERROR_NOT_PRIVILEGED
Pretty much the same thing as PERMISSION_DENIED.
2013-04-08 10:55:38 -05:00
Dan Williams
6326aea61b agents: create correct proxy for agents connecting via a private connection
We need to use dbus_g_proxy_new_for_peer() when talking to agents on a
private connection.
2013-04-08 10:55:38 -05:00
Dan Williams
b6b09a5f11 core: add DBus Proxy creation helper
We need to use dbus_g_proxy_new_for_peer() when creating a proxy
for private service connections.
2013-04-08 10:55:38 -05:00