Commit Graph

9334 Commits

Author SHA1 Message Date
Thomas Haller
c6374debe8 platform: log more details about link signal
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:12:49 +01:00
Thomas Haller
5e935dfd15 platform: add to_string functions for libnl objects
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:12:49 +01:00
Thomas Haller
6a97ca06ff platform: add function nm_platform_link_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:12:49 +01:00
Thomas Haller
59394aef74 platform: be more resilient to unexpected libnl objects
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:12:49 +01:00
Dan Williams
11d8f21b68 wifi: fix some warnings caused by hidden SSID patches (23a5ae2f) (rh #1069844)
It could also cause nm_device_connection_is_available() to return TRUE
for wifi devices, for connections that were not wifi.
2014-03-13 11:04:56 -05:00
Jiří Klimeš
b02353e954 core: fix a regression in manual device disconnection (bgo #726239)
Devices disconnected explicitly by user should stay disconnected, preventing
auto-connecting until manual request.

Introduction of NM_DEVICE_STATE_DEACTIVATING state broke this feature.

disconnect_cb() correctly set autoconnect device property to FALSE, however
nm_device_state_changed() put it to TRUE again. Thus only the active connection
was blocked instead of the whole device.

https://bugzilla.gnome.org/show_bug.cgi?id=726239
2014-03-13 16:06:35 +01:00
Thomas Haller
a0fc5098b3 core: Merge branch 'th/rh907836_rename_iface'
First set of patches to support renaming of interfaces.
This is not yet fully complete, because we need to restart
Rdisc too and DHCP6 will disconnect the current active connection.

But this already improves the handling a lot, because the device
is usable afterwards if re-activating the connection.

https://bugzilla.gnome.org/show_bug.cgi?id=726177
https://bugzilla.redhat.com/show_bug.cgi?id=907836

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-12 17:13:40 +01:00
Thomas Haller
1f383bc53f core: support renaming of NMDevice (changes of ifname)
https://bugzilla.gnome.org/show_bug.cgi?id=726177
https://bugzilla.redhat.com/show_bug.cgi?id=907836

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-12 17:13:02 +01:00
Thomas Haller
b8654a1b35 dhcp: downgrade warning about unhandled DHCP event in case of terminated client
When we kill a client, we usually get a DHCP event afterwards that cannot
be associated with the client anymore (because we forgot about its PID).
Do not log a warning in that case, but only a debug message.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-12 16:58:19 +01:00
Thomas Haller
3d396d6f72 platform: react on udev signal "move"
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-12 16:58:19 +01:00
Thomas Haller
b9d85bb783 platform: fix link_type_from_udev() to use ifname from libnl
When an interface gets renamed, we first receive a libnl update with
the changed interface name.

This results in the following chain of calls:
  - event_notification()
  - announce_object()
  - link_init()
  - link_extract_type()
  - link_type_from_udev()
Then link_type_from_udev() looks up the name in the udev data (getting
the previous name, because we did not yet recieve the udev notification)
and passes the name to wifi_utils_is_wifi(), which eventually calls
nm_platform_link_get_ifindex() -- doing a lookup by the old name.

Fix this, by passing the ifname from libnl to link_type_from_udev().

Also, change hack_empty_master_iff_lower_up() because it is called
from event_notification(), at a moment when the link cache possibly
does not yet know the ifindex -- so that the call chain to
link_extract_type(), link_type_from_udev(), wifi_utils_is_wifi()
again might lead to lookup for something that does not yet exist.
Note, that in this case the name would not yet exist, because we
did not yet put the libnl object into the link cache.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-12 16:58:19 +01:00
Dan Williams
da0ccf892b wifi: fix connection to hidden SSID networks (rh #1069844)
When the PendingActivation removal changes landed, it required all
connections to be in a device's AvailableConnections property.  Of
course since hidden networks don't broadcast the SSID, there's no
way to match them up with connections and put them into the
AvailableConnections property, so this was just plain broken.
2014-03-12 09:23:33 -05:00
Dan Williams
23a5ae2f44 wifi: bypass available check for hidden APs during activation (rh #1069844)
Because not all clients set the 'hidden' property in a connection for
hidden/non-SSID-broadcasting networks, they may not show up in
the device's available-connections property.  After the
PendingActivation object removal, all activations require the
connection to be in available-connections, and thus hidden SSID
networks could not be activated.

Unfortunately check_connection_available() is used both during
activation and to populate the available-connections array, but we
only want to special-case activation paths, and still ensure that
SSIDs not found in the scan list are not in available-connections.

To make it clear this is a WiFi only hack, and that we should
remove it at some point in the future, create another class method
specifically for hidden WiFi and use that in activation paths to
special-case hidden WiFi connection activation.
2014-03-12 08:42:55 -05:00
Dan Williams
787455bae1 wifi: add HIDDEN flag for completed connections without an AP (rh #1069844)
If an AP object is not given, and no compatible AP can be found
in the scan list, the AP is most likely not broadcasting its SSID
and should be marked as 'hidden'.
2014-03-12 08:22:40 -05:00
Dan Williams
85905a1ecf ifcfg-rh: add support for SSID_HIDDEN (rh #1069844)
Read and write the hidden SSID flag, which helps NM figure out
when to probe-scan for hidden networks.
2014-03-12 08:22:40 -05:00
Jiří Klimeš
7a4ecc27b4 Merge code sanitizing team config being passed to libteamdctl (rh #1051517)
libteamdctl has fixed the problem with multi-line configuration:
7262e2ce0c
But we still want to remove new-lines in order not to depend on the newest
libteamdctl.

https://bugzilla.redhat.com/show_bug.cgi?id=1051517
2014-03-12 10:52:15 +01:00
Jiří Klimeš
a224f26e73 Merge fixes for handling team config team (rh #1035859)
https://bugzilla.redhat.com/show_bug.cgi?id=1035859
2014-03-12 10:50:28 +01:00
Jiří Klimeš
08ed6c5be2 cli: sanitize team config before setting it into property
Replace '\r' and '\n' chareacter with a space in the configuration.
libteamdctl sends the config to team daemon using its usock interface that
separates parameters with '\n'.

Related: rh #1051517
2014-03-12 10:44:29 +01:00
Jiří Klimeš
2b2f8e907e team: log error codes from teamd functions on failure 2014-03-12 10:44:29 +01:00
Jiří Klimeš
cf5e759978 team: replace NL chars in team config when passing to libteamdctl (rh #1051517)
usock interface in libteamdctl uses \n as a parameter separator and thus would
cut the config. So we replace '\r' and '\n' with ' '.

https://bugzilla.redhat.com/show_bug.cgi?id=1051517
2014-03-12 10:44:29 +01:00
Jiří Klimeš
94d0d30e95 team: read team port config in nm_team_update_slave_connection() (rh #1035859)
Without reading team port config we would fail to assume team slaves.

libteam provides teamdctl_port_config_get_raw_direct() from 1.9 up
See https://bugzilla.redhat.com/show_bug.cgi?id=1028138

https://bugzilla.redhat.com/show_bug.cgi?id=1035859
2014-03-12 10:44:29 +01:00
Jiří Klimeš
bbc172a919 team: do not free config got from teamd
The config is owned by teamd and will be freed by teamdctl_free(). Also use
teamdctl_config_get_raw_direct() instead of teamdctl_config_get_raw() to be
sure we have current data.
2014-03-12 10:44:29 +01:00
Jiří Klimeš
5bfaf00781 Merge nmcli code accepting 'master' for slaves as connection ID (rh #1057494)
https://bugzilla.redhat.com/show_bug.cgi?id=1057494
2014-03-12 10:34:46 +01:00
Jiří Klimeš
d7e1ec9183 cli: accept prefix "ifname/", "uuid/" or "id/" for 'master' argument
nmcli con add type team-slave ifname em2 master team-master0
nmcli con add type team-slave ifname em2 master id/team-master0

It helps to disambiguate values for cases where they may overlap,
e.g. "team0" -> "ifname/team0" or "id/team0"
2014-03-12 10:32:37 +01:00
Jiří Klimeš
90c02cafdc cli: allow specifying 'master' for slaves as connection ID (rh #1057494)
nmcli con add type *-slave ifname em1 master <ifname|UUID|name>

'master' property of 'connection' setting has to be either interface name or
connection UUID of master connection. However, to make nmcli more convenient
for users, we also allow specifying connection name and translating it to UUID
automatically.

https://bugzilla.redhat.com/show_bug.cgi?id=1057494
2014-03-12 10:32:11 +01:00
Jiri Pirko
8bed556019 ifcfg-rh writer: do not set TYPE for team ports (rh #1074160)
Notes and changes by jklimes:
- fix reading TeamPort without TYPE=Ethernet
- fix tests
Ideally this should be solved on initscripts side. But teamd doesn't want to do
any changes to initscripts, so we make a workaround here.

https://bugzilla.redhat.com/show_bug.cgi?id=1074160
2014-03-12 09:59:57 +01:00
Jiří Klimeš
4112bda940 core: allow matching IPv6 'link-local' method to 'ignore' (rh #1073824)
When an existing connection profile has IPv6 method 'ignore', NM doesn't simply
care about IPv6. Thus we should allow matching such a profile to devices with
just a link-local address.

The example can be a simple configuration like this:
/etc/sysconfig/network-scripts/ifcfg-ens3:
DEVICE="ens3"
ONBOOT=yes
NETBOOT=yes
UUID="aa17d688-a38d-481d-888d-6d69cca781b8"
BOOTPROTO=dhcp
HWADDR="52:54:00:32:77:59"
TYPE=Ethernet
NAME="ens3"

https://bugzilla.redhat.com/show_bug.cgi?id=1073824
2014-03-12 09:41:27 +01:00
Thomas Haller
066ce42ce1 core: refactor delete_on_deactivate in nm-device
Instead of only passing the ifindex to the callback, pack
additional data. This allows for better logging by also
writing the g_idle_add id which allows to associate the scheduling
with cancel calls.

Also, this fixes that the callback could not clear the
@delete_on_deactivate_id of the device, so that a following
delete_on_deactivate_unschedule() would think that there is
still something to cancel.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-11 21:27:22 +01:00
Milo Casagrande
350b6d612c po: updated Italian (it) translation (bgo #725988)
https://bugzilla.gnome.org/show_bug.cgi?id=725988

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-10 09:58:36 +01:00
Jiří Klimeš
a2ac5bb382 device: fix uninitialized ifa_flags
Pointed by Coverity.
2014-03-07 23:51:13 +01:00
Jiří Klimeš
524658f8a3 examples: fix Makefile.am to include all Python examples for distribution 2014-03-07 19:54:49 +01:00
Thomas Haller
bdb44ba39a rdisc: avoid integer overflow when calculating timeouts
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 16:03:27 -05:00
Dan Winship
5ec9b9e97c rdisc: set the expiration timer correctly (rh #1073560)
check_timestamps() was mixing up absolute and relative timestamps,
which meant that IPv6 expiration checks more-or-less stopped happening
after a while, allowing expired IPv6 routes, etc, to remain applied.
2014-03-06 16:03:27 -05:00
Thomas Haller
269ab02081 test: fix failure in make check due to invalid sorting of libnm-util/libnm-util.ver
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 20:09:45 +01:00
Dan Williams
5ed2a9430a core: unschedule deletion of software device when starting an activation request
This fixes queued activation request to be aborted because the software
device gets removed before the device reaches the PREPARED state.
This happens, because when the previous connection disconnects, the
device will schedule its removal.

https://bugzilla.redhat.com/show_bug.cgi?id=1073015

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 19:17:50 +01:00
Thomas Haller
f56c82d861 core/dhcp: reduce the wait time when killing dhcp client process
We kill the dhcp process synchronously, so waiting for up to 3 seconds
is really painful. Instead, give the client only 0.5 to terminate before
sending SIGKILL.

The proper solution would be to kill it asynchronously and dhcp manager
making sure that it does not start a new instance before the old process
was killed.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 19:03:27 +01:00
Dan Winship
4bfb430db7 platform, devices: add support for vxlan (rh #1066705) 2014-03-06 09:50:18 -05:00
Dan Winship
42df06e575 platform, devices: add support for vxlan devices
Since vxlan is new-ish, and vxlan IPv6 support in particular has only
been in the kernel since 3.11, we include our own copy of the vxlan
netlink constants rather than depending on the installed headers.
2014-03-06 09:48:15 -05:00
Dan Winship
b1adf22ebb platform: fix some tabs-vs-spaces
The nla_policy struct declarations for GRE, etc, were originally
copied from the kernel sources, where they used tabs to align the "="
columns. Fix them to use spaces instead.
2014-03-06 09:47:09 -05:00
Dan Winship
2bc903aaf1 devices: fix up parent/peer tracking in some virtual devices
NMDeviceGre and NMDeviceMacvlan didn't deal with the possibility that
the virtual device might be created before its parent's NMDevice is
created. Mostly fix this by having them put off the call to
nm_manager_get_device_by_ifindex() until someone actually requests the
device.

This is not perfect; if someone listening to notify::parent checks
right away, they may find that the parent property is still NULL, and
notify::parent will not be emitted again when it gets filled in. But
it's better than what's there now, when parent would remain NULL
forever in this case.

NMDeviceVeth did not have this problem, but it did have another
possible problem because it wasn't cleaning up its weak references
properly.
2014-03-06 09:47:09 -05:00
Dan Winship
18f35ec1d8 libnm-util, libnm-glib: Add master/slave-matching utils (rh #1045203)
Add functions for figuring out what device/connection types can be
slaves of other device/connection types.
2014-03-06 09:41:59 -05:00
Dan Winship
5cd37d250a libnm-glib: add nm_device_get_setting_type()
Add a function mapping NMDevices to their corresponding base NMSetting
types.
2014-03-06 09:38:36 -05:00
Dan Winship
4a5e2ced08 libnm-util: add nm_utils_check_virtual_device_compatibility()
Add a function encoding the logic of what virtual types support what
slave/parent types, so clients don't need to encode it themselves.
2014-03-06 09:37:20 -05:00
Dan Williams
a9c8addc91 core: reenable auto activation for slave connections with a matching UUID master
When activating a master, it reenables the auto activation of slave
connections for this master. Do not only match the device name, but also
check the connection UUID.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Thomas Haller
b69f624c98 core: implement function nm_active_connection_get_uuid()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Thomas Haller
950cb2c44f core: rename function nm_active_connection_get_name() to nm_active_connection_get_id()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Dan Winship
4753dff29e core: add some assertions to avoid clang analyzer false positives 2014-03-05 11:20:54 -05:00
Dan Winship
d86a61225d vpn-manager: remove some dead code
f3c2851c (port NMAgentManager, etc, to use NMAuthSubject) made it
unnecessary for callers to nm_settings_connection_get_secrets() to
decide whether to filter agents by UID or not, but NMVPNConnection was
still doing it itself anyway.
2014-03-05 11:20:54 -05:00
Dan Winship
6300ea57ab libnm-glib: fix a double free in NMDeviceVlan 2014-03-05 11:20:54 -05:00
Dan Winship
50dea202a8 libnm-util: fix minor bugs in nm_setting_vlan_remove_priority_str_by_value()
Plug a leak, remove some dead code.
2014-03-05 11:20:54 -05:00