Commit Graph

4279 Commits

Author SHA1 Message Date
Pavel Šimerda
0ba6f32bce platform: add NMFakePlatformLink
This will help to store more link attributes in NMFakePlatform link
array than in public NMPlatformLink array. Some of the future
attributes will not be part of the NMPlatform API.
2013-05-10 21:41:27 +02:00
Pavel Šimerda
342134179c platform: return NULL type_name on failure 2013-05-10 21:41:27 +02:00
Dan Williams
6850dccd39 build: silence compiler warning about unused return value 2013-05-09 10:51:27 -05:00
Mantas Mikulėnas
bdf2bfbc3c sleep-monitor: use more informative who/why text 2013-05-09 12:47:54 +02:00
Dan Winship
4e009ecaeb build: fix srcdir != builddir 2013-05-08 17:17:54 -04:00
Dan Winship
2a8023ef3d devices: fix the dbus glue naming inconsistency for NMDevice 2013-05-08 17:15:47 -04:00
Dan Winship
3ab82ea20e core: move devices into a subdirectory
We have lots of device types and will soon have lots more, so let's
put them in their own directory.
2013-05-08 15:07:22 -04:00
Dan Winship
c4417c71b6 core: use non-recursive build
Although having different parts of NM in different subdirectories
keeps the source tree neat, it has made the build messy, particularly
because of cross-dependencies between the subdirs.

Reorganize to build all of the pieces of the NetworkManager binary
from src/Makefile, and only use recursive make for test programs,
helper binaries, and plugins.

As part of this, get rid of all the per-directory convenience
libraries, and switch to building a single top-level
libNetworkManager.la, containing everything except main.c, which all
of the test programs can then link against.
2013-05-08 15:07:18 -04:00
Dan Williams
6c2a35a090 build: clean up old ModemManager defines
Make sure they don't conflict with ModemManager 0.7/0.8 defines from
libmm-glib.
2013-05-08 15:04:02 -04:00
Dan Winship
227b466178 build: stop using client-side generated dbus bindings
We removed these from libnm-glib last year, but there was still one
place where we were using them in the core.
2013-05-08 15:00:12 -04:00
Dan Winship
d529580cbb libnm-glib, core: use g_cclosure_marshal_generic
Since we depend on new glib now, we can just use the generic
marshaller rather than generating our own.
2013-05-08 14:59:29 -04:00
Dan Winship
ec0a66861e build: automate the -glue.h building rules 2013-05-08 14:59:29 -04:00
Dan Winship
6dc7f85ed9 platform: fix ethtool code
Need to initialize auto_g_free variables to NULL, in case we error out
before setting them to real values.
2013-05-08 11:24:50 -04:00
Dan Williams
c2d81b9ea8 core: ensure missing IP config settings are treated as "auto" (bgo #699755)
Due to recent changes not all settings plugins send an IP config setting
when the method is 'auto'.  Some old code in the NMDevice IP config paths
mishandled this.  Fix that up; the expected behavior should be:

1) if the device is a slave, IP configuration is DISABLE/IGNORED
2) if the connection has an IP4 or IP6 setting, use the setting's method
3) default to AUTO
2013-05-07 15:58:11 -05:00
Dan Winship
7aefd5b5f4 platform: fix use of ethtool
The bits in the result of ETHTOOL_GFEATURES are not in any defined
order; you need to use ETHTOOL_GSTRINGS to get the names associated
with each bit to find what each one does. Fix
NMPlatformLinux:link_supports_vlans() to do this.

https://bugzilla.gnome.org/show_bug.cgi?id=699649
2013-05-07 16:47:34 -04:00
Dan Winship
ae9a389f83 libnm-glib, cli: add nm_device_get_type_description
Add a new libnm-glib method to get the type description for a device,
and use it in nmcli. For most types, the type description is based on
the class name, but for NMDeviceGeneric, it comes from the
:type-description property.
2013-05-07 12:46:56 -04:00
Dan Winship
4819df28b4 core: add NMDeviceGeneric:type-description
Use nm_platform_link_get_type_name() to get information about the
generic device, and export that via D-Bus
2013-05-07 12:46:56 -04:00
Dan Winship
be5ef71ab0 platform: add nm_platform_link_get_type_name()
Add a platform method to return the name of the link type. (Eg,
"ethernet", "loopback", "tun")
2013-05-07 12:46:56 -04:00
Dan Winship
ce4f2a4bd6 core, libnm-glib: add NMDeviceGeneric
Add NMDeviceGeneric, to provide generic support for unknown device
types, and create NMDeviceGenerics for those devices that NM
previously was ignoring. Allow NMSettingGeneric connections to be
activated on (managed) NMDeviceGenerics.
2013-05-07 12:46:56 -04:00
Dan Winship
2226a00cc2 core: add a "default-unmanaged" setting for devices
Allow devices to declare themselves unmanaged-by-default, but tweak
nm-manager and nm-policy to allow activating matching connections on
those devices anyway.

(This ensures that NM keeps its hands completely off the device unless
the user explicitly asks it to do something with it.)
2013-05-07 12:46:56 -04:00
Dan Winship
ab7ebead2c core: add IP configuration for unmanaged devices
Use NMPlatform to read the IP address/route configuration of unmanaged
devices, and export that via D-Bus like we do with NM-generated IP
configs.
2013-05-07 12:46:55 -04:00
Dan Williams
6fee19b17b bluetooth: fix device creation after 9ce458256d
The initialization of priv->bdaddr (the string representation of the device
hardware address) got removed in the named commit.
2013-05-06 11:17:37 -05:00
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