Commit Graph

7740 Commits

Author SHA1 Message Date
Aleksander Morgado
fb8ebc2a97 modem-manager: workaround issue in 'GDBusObjectManagerClient'
The 'GDBusObjectManagerClient' won't signal added or removed objects when it
was created but no name owner was available in the bus. We can still use it for
name-owner changes, but in order to have added/removed object signals, we'll
need to re-create the whole 'MMManager' when we know the service came alive in
the bus.

See GLib/GIO/GDBus bug:
   https://bugzilla.gnome.org/show_bug.cgi?id=693285
2013-02-08 18:03:42 -06:00
Aleksander Morgado
03c1e40e66 modem-manager: keep track of the signals added to the 'GDBusObjectManagerClient'
Make sure we cleanup all the signals when we remove our internal reference to
the 'MMManager' object.
2013-02-08 18:03:39 -06:00
Dan Williams
d953aad17a build: remove unused line 2013-02-08 10:06:48 -06:00
Dan Williams
efe52765cc todo: secondary VPN connection support finished 2013-02-07 17:59:22 -06:00
Dan Williams
b59785751d todo: real AP mode support has been added 2013-02-07 17:58:20 -06:00
Dan Williams
778d1cf2e8 core: track which interface an IP config came from
Various bits of code want the network interface which an IP config
came from, for example when distinguishing which interface to
send DNS requests to when the DNS servers are link-local.  DNS
plugins may also want this data for various reasons.

So it makes sense to attach the interface name to the IP config
object when the DNS manager gets it, so that later DNS updates
that don't have any interface information (hostname changes, etc)
can still generate correct DNS information.

This also eliminates the "last_iface" hack, which was often
inaccurate.

It also now sends "NetworkManager" to SUSE netconfig as the
interface name, because the DNS information being sent is already
merged/prioritized and not specific to a network interface, so
it's time to stop lying about where it came from.
2013-02-07 15:31:00 -06:00
Dan Williams
f2b33e31da trivial: fix spacing in AP mode message 2013-02-07 15:25:13 -06:00
Dan Williams
140ebbbf89 dhcp: generate DUID-UUID from /etc/machine-id (bgo #691885)
DHCPv6 RFCs require the DUID to be constant over time and to
be used as a permanent identifiers of the machine.  This precludes
using a network interface MAC address since the MAC address may
change, and there may be more than one network interface installed.

Storing the DUID causes problems when an OS image is cloned between
virtual or physical machines because then the saved DUID is no longer
unique.

To fix all these issues, generate the DUID from the machine's hashed
machine-id, which is already a unique identifier of the machine and
will always be present because dbus requires it, and NM requires
dbus.  It is assumed administrators will change the machine-id when
cloning an OS image; thus they only have to update one file, not
two (machine-id and the stored DUID).

Administrators may still override the machine-id-derived DUID by
setting a DUID in the default dhclient config file or the
interface-specific dhclient config files.

dhclient no longer saves a generated DUID to the config files,
because the default DUID will always be regenerated from
the machine-id on startup and thus always stable.
2013-02-07 12:38:58 -06:00
Aleksander Morgado
3b2556ae38 modem-manager: properly follow name-owner changes
We avoid requesting to auto-start the service when the 'MMManager' is created,
so that we can use it to follow name-owner changes (when auto-starting
requested the 'MMManager' creation may fail).

We still handle the periodic poking to the service, but instead of re-creating
the 'MMManager', we just call org.freedesktop.DBus.Peer.Ping().
2013-02-07 12:17:32 -06:00
Dan Williams
240f47c892 rfkill: set kernel WiFi rfkill state to cached state on startup
Like we do when the user sets the Wireless Enabled property at
runtime, ensure the kernel's softblock state is synced with the
user's WiFi enable preference at startup.  This helps compensate
for BIOSes that don't save rfkill state over reboots and ensures
consistency of between startup and runtime Wireless Enabled
property behavior.

Suggested by John G.
2013-02-06 13:02:29 -06:00
Aleksander Morgado
1bbcd696a4 modem-manager: plug memleak 2013-02-06 12:06:10 -06:00
Jiří Klimeš
bf610255a1 libnm-util: move verify_wep_key() and verify_wpa_psk() to nm-utils.c
and rename them to nm_utils_wep_key_valid(), nm_utils_wpa_psk_valid().
They are general functions and can also be used elsewere usefully.
2013-02-06 13:29:58 +01:00
Dan Williams
a78d66bb38 build: fix distcheck when building settings specification XML
The generated settings-spec.xml should not be DIST-ed because it's
regenerated every time libnm-util changes.  That meants it gets
rebuilt during 'make' even from a dist tarball.  Thus, it shouldn't
be part of the dist tarball itself.

In addition, settings-spec.html shouldn't be included in
$(content_files) becuase this is added to EXTRA_DIST by gtk-doc.make.

Since generate-settings-spec.c the move from docs/api/ to tools/,
this started breaking distcheck even though the original Makefile
rules were wrong too.
2013-02-05 15:26:05 -06:00
Dan Williams
fbfb0fb947 build: manpages-docbook.xsl should be DIST-ed 2013-02-05 15:22:25 -06:00
Jiří Klimeš
231dd82124 man: add reference to nm-settings (5) to other man pages 2013-02-05 18:26:16 +01:00
Jiří Klimeš
ac19edd96e man: generate nm-settings.5 manual page (bgo #673520)
We only generate the page when configured "--with-docs", because we need xsl
stylesheets that are pulled in by gtk-doc.
2013-02-05 18:26:16 +01:00
Jiří Klimeš
2981953e47 tools: move generate-settings-spec to tools 2013-02-05 18:25:03 +01:00
Jiří Klimeš
029e613288 docs: generate refentry xml in addition to Docbook book xml for settings-spec
The refentry xml is used to generate manual page with settings description.

The invocation is:
generate-settings-spec <type> <output file> [<type> <output file>]
where <type> is  "book" or "refentry"
2013-02-05 18:22:33 +01:00
Dan Williams
9ee46b45f1 dhcp: fix infinite loop when escaping DUID
Oops; only enabled when debugging was turned on, but still sucks.
2013-02-05 09:23:08 -06:00
Jiří Klimeš
b3edc86e78 cli: prevent possible crash if removing devices while nmcli running (bgo #693158) 2013-02-05 10:00:58 +01:00
Dan Williams
62bae8acb7 core: ensure IP interface removal doesn't remove the NMDevice
Some devices (namely PPPoE (pppX), ADSL (nasX, pppX), and
mobile broadband (pppX, bnepX)) create a kernel netdevice for IP
communication (called the "IP interface" in NM) as part of the
connection process and thus the IP interface lifetime does not
correspond to the NMDevice lifetime.  For these devices we must
ignore removal events for the IP interface name otherwise the
NMDevice would be removed.

Caused by 8cce42f2.

For example, this bug caused the NMDeviceBt to be removed when
a PAN connection's bnepX interface went down in response to a
terminated Bluetooth connection, which of course means that
you can't restart the PAN connection as your phone is no longer
in the NM device list.
2013-02-04 14:44:32 -06:00
Dan Williams
17338069e3 core: only manage those bridges created by NetworkManager (rh #905035)
Until we handle bridges non-destructively, only manage bridges
created by NM.  When quitting write out a file listing all
bridges created by NM and a timestamp, and when starting read
that file and if the timestamp is within 30 minutes, manage
any bridge that was listed in that file.  This scheme, while
not foolproof (eg, if NM crashes), should ensure that NM can
recognize bridges it created if it's restarted.  The file
is stored in /run or /var/run, which is cleaned each restart,
ensuring that the state does not persist across reboots.

If an automatic or user-initiated activation request for
a bridge NM does not manage is received, that request is
denied.  Only if the bridge interface does not yet exist, or
was present in the managed bridges file, will an
NMDeviceBridge be created and activation be possible.
2013-02-04 11:59:15 -06:00
Dan Williams
6c3178c7e2 wired: wait for carrier on master devices before proceeding with IP config
If the IP configuration requires slaves/ports, starting IP configuration
before the master device has a carrier (which means at least one slave
or port has a carrier and the device is initialized) is pointless, and
will just take longer or fail.  Recent kernels have cleaned up carrier
handling on bridge/bond devices and the carrier is now a reliable
indication of whether or not the master device is ready to send/receive
traffic.  Thus, if we don't have a carrier, obviously no IP configuration
that depends on connectivity is going to work.
2013-02-04 10:37:47 -06:00
Dan Williams
2dac2cf56e core: don't allow auto-activation of a master that has been disconnected
The master-activation code was ignoring whether or not the master device
was inhibiting automatic connections.
2013-02-04 10:37:47 -06:00
Dan Williams
454490c6d5 core: let subclasses find slaves by ifindex 2013-02-04 10:37:47 -06:00
Dan Williams
37febd6228 core: expose IP4 wait state to subclasses
We'll need to this to determine whether or not to retry IP config
from device subclasses.
2013-02-04 10:37:47 -06:00
Dan Williams
06bac8fcda core: return success when port already attached to bridge
Instead of just not logging the error, don't return failure either.
2013-02-04 10:37:47 -06:00
Dan Williams
479163db59 core: generalize waiting for IP config until slaves are ready
Instead of duplicating the code in bridge and bond, move the
logic to the base class and key it off whether or not the device
is a master.
2013-02-04 10:37:47 -06:00
Dan Williams
8ed4b5109a bridge: device availability shouldn't depend on carrier state
The bridge master's carrier follows IFF_UP when no ports are added
and the ports' carrier when ports are added, so we shouldn't
depend on carrier when deciding whether to activate a bridge which
may not have any ports.  Also when the
2013-02-04 10:37:46 -06:00
Dan Williams
dfef198801 bond: device availability shouldn't depend on carrier state
Bond master carrier state follows slave carriers, so clearly we
can't depend on carrier when deciding whether we can activate a
bond connection which doesn't yet have any slaves.  Also, when
the bond's carrier goes down, we don't want to deactivate the
connection because this is normal in some failover modes and
could be the user reconfiguring slaves.
2013-02-04 10:37:46 -06:00
Dan Williams
8aee650cd1 core: allow Wired device subclasses to override carrier handling
Bond devices, for example, don't want carrier state to affect
connection state.  Allow subclasses to override the Wired class'
handling if they want.
2013-02-04 10:37:46 -06:00
Dan Williams
e64bcae092 core: add IS_MASTER property to NMDevice
We can't just check whether there are slaves or not, because the
master device may be started before any slaves exist, and the
slaves get added later.
2013-02-04 10:37:46 -06:00
Dan Williams
d4f5c40abe core: emit NMDeviceWired carrier change after logging it
Less confusing in the logs to see the change logged before listeners
have a chance to emit other log messages that may depend on the new
carrier state.
2013-02-04 10:37:46 -06:00
Dan Williams
aa8aeb197f bridge: update log domains for LOGD_BRIDGE 2013-02-04 10:37:46 -06:00
Dan Williams
fab66119dc logging: add BRIDGE log domain 2013-02-04 10:37:46 -06:00
Dan Williams
01acf46df8 trivial: quiet useless log message
Managed/unmanaged status is conveyed by the immediate state change,
so no need to redundantly log it.
2013-02-04 10:37:46 -06:00
Dan Williams
7837e62d16 bond: set slave IFF_UP after releasing it
The kernel bonding code calls "closes" (which clears IFF_UP) the slave
and restores some of its attributes (MAC address, MTU, etc), but doesn't
bring it back up.  This breaks things like carrier detection, and
indeed when the device is closed, its carrier is also cleared, which
leads us to think the device is not available for activation.

To ensure that further events are noticed by the device, and that its
carrier state is accurately represented, make sure the device is still
IFF_UP after it  has been released.
2013-02-04 10:37:46 -06:00
Dan Williams
7651c77b78 core: update hardware address when slaves change
The hardware address of a device often changes when slaves change,
for example with bond interfaces, which take the hardware address of
their first slave.  Make sure that's always up-to-date.
2013-02-04 10:37:46 -06:00
Dan Williams
a11771dfe6 core: preserve errno in nm_utils_do_sysctl()
Callers may need the error to determine their course of action
in response to a failure.
2013-02-04 10:37:46 -06:00
Dan Williams
763b6c31d4 core: ignore carrier changes on enslaved interfaces
It's not very helpful to deactivate a slave of a bond or a bridge
port because the carrier is lost.  Carrier failures are normal
operation when using various bonding failover modes.  For bridge
ports, it's probably not very helpful either.  Given that the
masters are all virtual interfaces and have been explicitly
configured and started by a user, the configuration should
generally be left alone unless explicitly deactivated or changed.
2013-02-04 10:37:46 -06:00
Dan Williams
39bd9f893a core: log when last slave is removed 2013-02-04 10:37:46 -06:00
Dan Williams
b6f8ecb330 core: handle slave deactivation more gracefully
Two things:

1) When the slave was deactivated, nm_device_deactivate() runs before
the master gets the slave's state-changed signal, and thus priv->master
is cleared long before nm_device_notify_enslaved() is called.  Which
would trigger the g_assert (priv->master).

2) If the slave is already deactivated, there's no point in re-queueing
a state change to deactivated.

So just assert that priv->master is valid if the slave is going to be
enslaved, but if the slave is being released, ignore NULL priv->master
which we don't use anyway.  Also ignore redundant state changes.
2013-02-04 10:37:46 -06:00
Dan Williams
7988914e29 core: don't fail if bond slave is already a slave of the requested master
Would otherwise file if NM was restarted when a bond was active.
2013-02-04 10:37:45 -06:00
Dan Williams
43952e28c2 core: fix writing blank sysctl values
Sometimes we need to write blank values.
2013-02-04 10:37:45 -06:00
Dan Williams
ce586cc679 core: fix setting port attributes
They need to be written to the "bridge_port" directory, not the
"bridge" directory.
2013-02-04 10:37:45 -06:00
Dan Winship
17123fcc61 introspection: belatedly add NM_DEVICE_CAP_AP 2013-01-31 10:47:41 -05:00
Milo Casagrande
db32c3ab29 po: updated Italian (it) translation (bgo #692742) 2013-01-31 11:03:11 +01:00
Dan Williams
7491198138 build: clean up dbus-glib checks
dbus_glib_global_set_disable_legacy_property_access() was added in dbus-glib
0.88, and since we require 0.94 we can remove this check.
2013-01-30 11:19:15 -06:00
Jiří Klimeš
609b2d1782 cli: add missing properties (mainly secrets flags, and some others) 2013-01-30 15:27:06 +01:00
Jiří Klimeš
7881cb3252 cli: add missing 'dhcp-hostname' property to 'ipv6' setting 2013-01-30 12:27:13 +01:00