Commit Graph

8762 Commits

Author SHA1 Message Date
Dan Winship
44ac1020da nm-online: wait for all startup-time connections, not just one
Rewrite nm-online to use libnm-glib, and change it so that it waits
until NM has finished all of its startup-time connection activation
attempts, rather than only waiting until at least one has succeeded.

In particular, this means that on multi-homed servers, the
NetworkManager-wait-online systemd service (and by extension,
network.service) will now block until *all* of the server's IP
addresses are up, which is needed for some old daemons that assume
that no network interfaces will be added after they start.
2013-08-16 17:27:34 -04:00
Dan Winship
4d8063cd78 libnm-glib: add NMClient:startup, nm_client_get_startup()
Expose the new NMManager:startup property on NMClient.
2013-08-16 17:27:34 -04:00
Dan Winship
bc091f2f3e core: add NMManager:startup property
Add a property on NMManager indicating that it is currently starting
up and activating startup-time/boot-time network connections.

"startup" is initially TRUE, and becomes FALSE once all NMDevices
report that they have no pending activity (eg, trying to activate,
waiting for a wifi scan to complete, etc). This is tracked via a new
NMDevice:has-pending-activity property, which is maintained partially
by the device itself, and partially by other parts of the code.
2013-08-16 17:27:34 -04:00
Dan Winship
cee676e704 core: simplify signal disconnection in nm-device-wifi 2013-08-16 17:27:34 -04:00
Dan Winship
32aeed7e2d core: minor device removal simplification/fix
nm-manager.c:remove_one_device() took a GSList as an argument and
returned that GSList with the device removed; but every caller passed
in priv->devices and assigned the result to priv->devices, so just
make it always do that.

Also, rename it to remove_device() to match add_device().

Also, when removing a device, NMManager was only disconnecting one of
the several signal handlers it connected in add_device(). This
generally wasn't a problem since the device would normally be
destroyed immediately after this, but it's good to be correct.
2013-08-16 17:27:34 -04:00
Dan Winship
75ea0b0593 core: remove some dead code in NMDevice 2013-08-16 17:27:34 -04:00
Enrico Nicoletto
1940794107 po: updated pt_BR translation (bgo #705995)
https://bugzilla.gnome.org/show_bug.cgi?id=705995
2013-08-16 16:20:31 -05:00
Jiri Pirko
f81e2cbe68 core: spawn teamd for team device connection
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
a523a431d3 cli: add team driver support
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
dcf5355810 ifcfg-rh: add write support for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
db65980328 ifcfg-rh: add read support for team devices
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
c4eade715f libnm-glib: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
23836e8146 core: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Jiri Pirko
64cdb1a7f0 libnm-util: add setting for team port
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:14 -05:00
Jiri Pirko
3dcb7935a5 libnm-util: add team device setting
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:53:03 -05:00
Martin Pitt
5dc4be54e6 keyfile: Drop owner check
In nm_keyfile_plugin_connection_from_file(), disable the "bad owner"
check.
As root you can read all files anyway, or if necessary even chown them,
and for
other users the standard file permissions will do a fine job.

This fixes running "make check" as root.

https://bugzilla.gnome.org/show_bug.cgi?id=701112
2013-08-13 23:28:54 +02:00
Pavel Šimerda
80c48a62be dhcp: kill dhclient on fatal errors
This helps to avoid dhclient DOSing the network.

https://bugzilla.gnome.org/show_bug.cgi?id=705137
2013-08-13 22:35:00 +02:00
Dan Williams
ff40555e84 man: clarify connections and devices in nmcli 2013-08-13 15:31:06 -05:00
Dan Williams
55c00a299c man: minor cleanups
Move object descriptions onto the same line as the object name.
2013-08-13 15:31:06 -05:00
Thomas Haller
e2f77d30b1 cli: make bash-completion for nmcli support more abbreviations.
Also sub commands can be abbreviated. Add some more aliases to the bash
completion.

Also fix the option 'nmcli radio mobile' which is called 'wwan'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-13 14:17:44 +02:00
Thomas Haller
faa6a12ba3 cli: make bash-completion support abbreviated object names.
nmcli accepts abbreviated versions of object names, e.g. 'con'
instead of 'connection'. Adjust bash completion to also support
this.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:33:13 -05:00
Thomas Haller
6e6b573383 core: minor code cleanup to use preprocessor constants
Use preprocessor constants for signal names NM_PLATFORM_LINK_*
instead of hard coded values.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:31:33 -05:00
Thomas Haller
e26642c26c trivial: fix spelling errors in code comments
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-12 13:31:07 -05:00
Pavel Šimerda
8d10e8bbe6 platform: ignore multi-hop routes
https://bugzilla.gnome.org/show_bug.cgi?id=705606
2013-08-12 17:35:22 +02:00
Thomas Haller
244548b790 man: reword description for man nmcli (connection down)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-09 09:06:54 +02:00
Dan Williams
e16e8ab7fb policy: prevent double-deactivation of an NMActiveConnection after it's removed
When a connection is removed from NMSettings, it gets deactivated.  That was
happening once in response to the now-removed connection's visibility changing
to invisible to everyone, and a second time in response to the actual removal
signal.  Unfortunately the second time the NMActiveConnection is already
cleaned up and in the DEACTIVATED state, and has no priv->device, which
causes great hilarity when nm_device_set_state() is called with NULL.

_deactivate_if_active() should only try to deactivate NMActiveConnections
that actually are active.
2013-08-09 00:54:58 -05:00
Dan Williams
b5170903c0 settings: correctly handle connection deletion after unsaved and monitor-connection-files
Plugins that could save connections to disk previously depended on inotify
events from the kernel to know when to signal connection removal; that is
in response to a 'delete' request they would unlink the backing filesystem
resources, get the inotify signal, and cause NM_SETTINGS_CONNECTION_REMOVED
to be emitted.

Unsaved connections don't have any backing resources, so they would never
get the signal emitted, and NMSettings would never forget about them.

Also, when monitor-connection-files=false in the configuration, obviously
the inotify signals will never come in because they aren't set up.

Given that we can no longer rely on inotify, it's best to just explicitly
send out the NM_SETTINGS_CONNECTION_REMOVED signal whenever a connection
is deleted via the D-Bus interface or internally.
2013-08-09 00:54:58 -05:00
Stanislaw Gruszka
dd9cf657ef wifi: change bgscan threshold parameter
We do not need to increase periodical scanning frequency when AP signal
strength is good enough. Signal level of -45dBm is considered as good,
change the threshold to -65dBm.
2013-08-08 10:52:39 -05:00
Dan Williams
119345d90a core: fix double-free C&P error 2013-08-08 10:14:38 -05:00
Dan Williams
37efd55699 platform: fix some bogus compiler warnings
platform/nm-linux-platform.c: In function 'delete_object':
platform/nm-linux-platform.c:102:13: error: 'cached_object' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (object && *object) {
             ^
platform/nm-linux-platform.c:1019:35: note: 'cached_object' was declared here

Except that it won't be, but I guess the gsystem auto* stuff is
confusing the compiler.
2013-08-07 15:47:47 -05:00
Dan Williams
b637c6a101 platform: don't assert on multi-hop routes (rh #989022)
It only matters that there's at least one next hop, not that there
is only one.
2013-08-07 14:47:22 -05:00
Dan Williams
ead39cb421 core,platform: don't completely ignore WWAN pseudo-ethernet interfaces
The platform still needs to know about them, becuase the ethernet interface
is what gets configured and used for IP.  But the Manager doens't want to
create a full new NMDevice for them, because there's already a Modem
device that "owns" that WWAN interface.  So keep WWAN devices visible
to the platform, but just make the manager ignore them when creating
NMDevices.

Also, many WWAN pseduo-ethernet drivers set NOARP becuase they really
are point-to-point and thus ARP is pointless, and in this case, they
won't have any arptype of ARPHRD_ETHER.  So determining the NMLinkType
from udev must take that into account.
2013-08-07 14:39:00 -05:00
Thomas Haller
ac24000650 core: takeover existing virtual devices in system_create_virtual_device
If a virtual device is about to be added and it already exists, it gets
reused.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-07 12:53:24 -05:00
Dan Williams
1f084567f0 ifcfg-rh: don't require an error for read_mac_address()
No reason to; the caller knows success/failure from the return value
and might want to ignore the error.
2013-08-07 12:53:24 -05:00
Dan Williams
0c8d8b4da3 core: update UDI when it's available
Software devices don't have a UDI until udev finds them, and since we need
to know about the software devices before udev finds them the UDI will be
missing.  Instead of requiring a UDI on NMDevice creation, update the
property from the NMPlatform link change signal when udev does find the
device.

Now that a UDI is no longer required for device creation, software devices
added by NM would be created in the platform_link_added_cb() signal
handler triggered by the various software device creation methods in
system_create_virtual_device() (eg nm_platform_bridge_add() etc).  Then
the NMDevice created in system_create_virtual_device() would be a duplicate
and cause problems when it was added.  Since system_create_virtual_device()
needs to do setup on some devices, suppress the device creation from the
platform link added handler in this function.

Much of this is a hack which should be cleaned up later.
2013-08-07 12:53:24 -05:00
Thomas Haller
81ed5307d3 fixup! core: fix cleanup of NMDevices that fail construction
The unref in finalize is not needed, because the hash table gets already freed
in dispose.

Note that setting available_connections to NULL in dispose is not really
needed, because (altough dispose might be called more than once) there
is a guarded by "priv->disposed = TRUE;". But leave it for clearity in
case somebody tries to access the pointer (which shouldn't happen).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-07 12:53:24 -05:00
Dan Winship
588547b343 core: fix cleanup of NMDevices that fail construction
We were leaving signal handlers attached to devices that failed in
constructor() (and also leaking the available_connections hash). Fix
that.
2013-08-06 16:36:51 -05:00
Dan Winship
1d3ae22905 platform: fix initial link-added emission
nm_platform_query_devices() wasn't including the new "reason" argument
in its link-added emissions. (This didn't cause any problems since
NMManager doesn't look at that argument anyway, but it's still
obviously wrong.)
2013-08-06 16:36:51 -05:00
Dan Williams
e9e84c19c9 ifcfg-rh: fix handling of VLAN parent PHYSDEV key
The initscripts do this:

    MATCH='^.+\.[0-9]{1,4}$'
    if [[ "${DEVICE}" =~ $MATCH ]]; then
	VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/')
	PHYSDEV=${DEVICE%.*}
    fi
    MATCH='^vlan[0-9]{1,4}?'
    if [[ "${DEVICE}" =~ $MATCH ]]; then
	VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
	# PHYSDEV should be set in ifcfg-vlan* file
	if test -z "$PHYSDEV"; then
		net_log $"PHYSDEV should be set for device ${DEVICE}"
		exit 1
	fi
    fi

which means that if the VLAN name starts with "vlan" then
PHYSDEV must be set, otherwise the parent interface cannot
be determined.

Since PHYSDEV, if set, reflects the explicit intentions of the
user instead of assuming the name from DEVICE, make PHYSDEV
take precedence over determining the parent interface from
heuristics.
2013-08-06 16:36:51 -05:00
Dan Williams
eba7484367 core: don't wait for udev to find created software devices
NM knows software devices it creates exist immediately, and it knows
it can use them immediately instead of waiting for udev to find them.
Ideally we'd wait for udev to find all devices, to allow tags and
other rules to run, but when creating software devices they must
currently be available for use immediately.

Bridges and bonds are required to be IFF_UP before they can be
activated (see their is_available() implementation).  But during
activation code paths, specifically in nm_manager_activate_connection(),
the interface is created and immediately checked for availability
to activate (since the creation was a result of the user requesting
device activation).  That availability check fails, because the
device is not visible outside NMPlatform (because it hasn't been
found by udev yet, because we haven't gotten back to the event
loop) and thus nm_platform_link_is_up() fails, failing the
availability check.  Thus the device activation ends in error.

What should really happen is that device activation shouldn't
be synchronous; a new NMActiveConnection should be created for
any activation request, which can then wait until all the
resources it needs for activation are available (device found,
master devices created, etc).  That's going to take more work
though.
2013-08-06 16:36:51 -05:00
Dan Williams
3c6d789c62 logging: add log domain for D-Bus PropertiesChanged signal stuff
Otherwise it really clutters up the CORE logging when debugging is
enabled.
2013-08-06 16:29:09 -05:00
Dan Williams
75c64763f6 systemd: fix up dispatcher unit install (rh #948433)
Lennart sez:

"Oh, I wasn't aware it is short-lived only. In that case, drop the
multi-user.target bit, and just make it create the dbus alias.

[Install]
Alias=dbus-org.freedesktop.nm-dispatcher.service

And yeah, adding Also=NetworkManager-dispatcher.service to
NetworkManager.service certainly would be a good idea."
2013-08-06 15:58:55 -05:00
Thomas Haller
8919d7ab49 trivial: add src/tests/test-ip4-config to .gitignore file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Thomas Haller
471fed3859 trivial: minor code cleanup in examples/python
There where cases, where TAB was mixed with SPACES. Replace TAB with SPACES.
Additionally, make the script nm-state.py executable

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Thomas Haller
a853b3bd23 core: minor code cleanup to use preprocessor constants
Use preprocessor constants in nm_logging_all_domains_to_string instead
of hard coded values for the special logging domain names.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Thomas Haller
4861161bd4 trivial: fix spelling errors in code comments and README file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Dan Winship
04bd4a9ea5 core: don't log warnings when devices are removed
If a device is removed, then trying to reset its IPv6 state will cause
nm_utils_do_sysctl() to log a warning since the path no longer exists.
So don't try to do it in that case.
2013-08-06 11:49:06 -04:00
Pavel Šimerda
320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Pavel Šimerda
6762b2f792 core: use NMIP[46]Route in nm-ip[46]-config 2013-08-03 00:15:07 -05:00
Dan Williams
7570832b20 platform: simplify getting routes and ignoring the default route
Most places except the tests don't want the default route when asking
the platform for all routes, so make that simpler by just adding a
parameter for including the default route or not.
2013-08-03 00:14:19 -05:00