Commit Graph

7207 Commits

Author SHA1 Message Date
Dan Winship
7ff3d1500e main: make handling of --no-daemon saner by using G_OPTION_FLAG_REVERSED
https://bugzilla.gnome.org/show_bug.cgi?id=700550
2013-05-21 09:30:09 -03:00
Dan Winship
fd2a3a7561 devices: fix recursive-state-change check
nm_device_state_changed() had a check to make sure it wasn't entered
recursively (which had been a source of bugs in the past), but it was
global rather than per-device, so it caused errors when VLANs changed
state in response to their parent device changing state. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=698619
2013-05-20 16:38:34 -03:00
Dan Winship
2bb5178897 devices, platform: fix up carrier-detection detection
Some devices aren't expected to support carrier detection, so there's
no reason to have NMDevice log about it. Move that message into
NMDeviceEthernet, where failure to support carrier-detect really is
worth mentioning.

Also, make NMDeviceEthernet use NMPlatform for carrier-detection
detection (and move the MII carrier-detect-support check from
NMDeviceEthernet into NMLinuxPlatform).

Finally, have NMDeviceGeneric actually check whether the device
supports carrier detect, rather than just always assuming it doesn't.
2013-05-20 16:38:34 -03:00
Dan Williams
be807819b0 core: clean up and simplify device capabilities handling
This is really, really old 2007-era code.  Any NMDevice that gets
created is already supported, so there's no reason to have every
device set NM_DEVICE_CAP_NM_SUPPORTED.  For those subclasses that
only set that capability, we can remove the subclass method
entirely.  Next, it turns out that the "type capabilities" code
wasn't used anywhere, so remove that too.  Lastly, "cipsec"
interfaces haven't been used on linux in about 5 years (they
were created by the Cisco binary-only IPSec kernel module for
Cisco VPNs long before vpnc and openswan came around) so we can
remove that code too.
2013-05-20 16:38:34 -03:00
Dan Winship
38459f5a00 core: remove NMDeviceWired
With carrier handling moved to NMDevice, the only thing left in
NMDeviceWired was speed, which was actually ethernet-specific anyway.
So move that to NMDeviceEthernet, and then kill NMDeviceWired.
2013-05-20 16:38:34 -03:00
Dan Winship
82222d3898 core: move carrier handling to NMDevice
Move carrier handling for most device types into NMDevice.

Based on an earlier patch by Pavel Šimerda.
2013-05-20 16:38:33 -03:00
Dan Winship
5a223b9089 core: make nm-properties-changed-signal always export the right properties
Change the way that nm-properties-changed-signal works, and parse the
dbus-binding-tool-generated info to get the exact list of properties
that it's expected to export.

This makes NM_PROPERTY_PARAM_NO_EXPORT unnecessary, and also fixes the
problem of properties like NMDevice:hw-address being exported on
classes where it shouldn't be.
2013-05-20 16:38:33 -03:00
Dan Williams
04cb58eacd core: convert the DBus manager to a single-ref object
It's created very, very early and never needs to be unrefed
by anything except the main() function.
2013-05-20 16:38:33 -03:00
Dan Winship
e3bd3278e9 core: belatedly remove "hw-address" property #defines 2013-05-20 16:38:33 -03:00
Pavel Šimerda
0f91894132 ifnet: replace SIOCGIFHWADDR ioctl 2013-05-18 23:14:19 +02:00
Pavel Šimerda
f63c7f8ee6 platform: link mtu setting 2013-05-18 04:38:17 +02:00
Pavel Šimerda
6c55e5a1c6 platform: link address setting 2013-05-18 04:38:17 +02:00
Pavel Šimerda
a28a880214 platform: vlan support 2013-05-18 04:38:17 +02:00
Pavel Šimerda
aa943f3115 platform: cleanup: use link_get, not rtnl_link_get
It sets up the correct error value for free and is more consistent.
2013-05-18 04:38:17 +02:00
Pavel Šimerda
b0c88d7b59 platform: don't clear the whole NMFakePlatformLink
This is necessary for freeing data structures at finalize time.
2013-05-18 04:38:17 +02:00
Colin Walters
468c08511c core: add libgsystem as a git submodule
And change src/main.c to use the local allocation macros.  This
results in much cleaner code, as one can see from the diff.

Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first.  This will be a lot
nicer when we switch NM to a nonrecursive setup.
2013-05-16 14:08:09 -05:00
Pavel Šimerda
cd09159201 trivial: typedesc to typename 2013-05-16 14:58:44 +02:00
Pavel Šimerda
f714c1033f platform: fix NMPlatformLink/NMFakePlatformLink type mismatch 2013-05-16 14:58:44 +02:00
Dan Williams
8bab0c8203 core: ensure newly-created master interfaces are ready for activation
Reverts part of

2226a00cc2
core: add a "default-unmanaged" setting for devices

Newly-created master interfaces are in the UNAVAILABLE state, but if
they were created in response to a slave connection being activated,
the master must be activated immediately too.  But a device cannot
be activated unless it's in the DISCONNECTED state, so restore that
state change.
2013-05-15 14:56:36 -05:00
Dan Williams
4ca885f5e3 core: fix list manipulation when removing multiple slaves
nm_device_release_one_slave() may change the list head, but the
for loop in nm_device_master_release_slaves() can't handle that.
Use a while loop instead.
2013-05-15 14:39:16 -05:00
Pavel Šimerda
c43b7703cb netlink: fix rtnl_route_alloc_cache() call
Same fix as in commit 195a09d7c0.

NL_AUTO_PROVIDE is not a valid flag for this call and it's coincidental
with ROUTE_CACHE_CONTENT, which is not what we want.

One result arising from this fix is that per-device routes are now
assigned priorities correctly. This means, for instance, you can have a
wired and wireless connection on the same network, and have the wired
connection always take precedence whilst it's available.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2013-05-15 16:40:07 +02:00
Dan Williams
b9ea3ed1b1 build: don't install nm-dhcp-helper dbus permissions if we don't need to
The DHCP helper uses a private socket when building with dbus-glib >= 0.100,
which means we don't need to install a D-Bus permissions file.
2013-05-14 15:37:41 -05:00
Dan Williams
f762fa58d6 ifupdown: recalculate unmanaged specs on interface change (debian #707070)
If a kernel interface changes its MAC address, and NM is not
supposed to manage that interface, ifupdown needs to notice
that MAC address change and tell NM that the unmanaged devices
have changed, so that NM continues to not touch the device
after the MAC has changed.
2013-05-14 10:45:48 -05:00
Dan Williams
a37051127e ifupdown: fix naming confusion in plugin hash tables
well_known_interfaces -> eni_ifaces, since it's a hash of any
interfaces read from /etc/network/interfaces.

well_known_ifaces -> kernel_ifaces, since it's a hash of any
network subsystem interface the kernel knows about
2013-05-14 10:45:46 -05:00
Dan Williams
b2c6709690 ifupdown: clarify name of connections hash
'iface_connections' is really the list of all NMIfupdownConnections
known to the plugin, read from /e/n/i and hashed by block name.  Since
ifupdown doesn't store anything *except* connections from /e/n/i,
just rename it to 'connections' to reduce confusion with the
well_known_interfaces and well_known_ifaces hashes.
2013-05-14 10:41:39 -05:00
Dan Winship
43c4a45c4d devices: fix a bug in activation logic
It *is* legitimate to (re-)activate a connection on an already-active
device, so remove the newly-added "sanity check" preventing that.
Pointed out by jklimes.
2013-05-13 10:57:38 -04:00
Dan Williams
448fd7c2aa wifi: only remove AP on link timeout if not found by supplicant
If for some reason the connection is disrupted and the AP rejects
reconnection attempts (perhaps the driver has a bug, you get
disconnected, and the AP rejects association because it thinks
you're already associated), the AP object was being removed from
the scan list by code meant to handle out-of-range or turned-off
APs.  Thus even though the AP was in-range, it wouldn't be
found and the connection retried until the next scan.

Instead, only remove the AP object from the scan list if the
supplicant hasn't been able to exchange any frames with the
AP.  This preserves the out-of-range handling, becuase the
supplicant wouldn't be able to talk to the AP and thus
'ssid_found' will be FALSE, and also ensures that an in-range
but confused AP says in the scan list and will be retried
immediately.
2013-05-11 08:09:28 -05:00
Pavel Šimerda
406a1912ca platform: fix NMFakePlatformLink handling 2013-05-10 22:31:06 +02:00
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