Commit Graph

9413 Commits

Author SHA1 Message Date
Dan Winship
b4216ccb2d tui: allow Esc to cancel "nmtui connect" 2014-03-24 13:19:13 -04:00
Dan Winship
1bdc4ba948 tui: add nmt_newt_widget_get_realized(), realize forms properly
NmtNewtForm is an NmtNewtWidget, but previously it was only realizing
its child, not itself, which is technically wrong (though it had no
noticeable effect until get_realized() was added).
2014-03-24 13:16:12 -04:00
Dan Williams
d0c380ea68 wwan: disconnect modem signals when disposing NMDeviceModem 2014-03-21 17:54:10 -05:00
Dan Winship
f8b4ee04ba tui: add some comments to nmt-newt-form.c 2014-03-21 13:32:50 -04:00
Dan Winship
96a5ad51c2 tui: fix using Escape from main menu
We weren't checking whether the form closed because the menu was
activated or because the user hit Escape
2014-03-21 13:32:50 -04:00
Jiří Klimeš
a3de4283ea tui: fix crashes in nmtui-connect (rh #1078281)
https://bugzilla.redhat.com/show_bug.cgi?id=1078281
2014-03-21 13:32:50 -04:00
Dan Winship
f6e2b6528f tui: fix binding of some int/uint properties (rh #1078281)
GLib registers number->string value transforms (meaning that
number-valued properties like NMSettingVlan:id or NMSettingWired:mtu
get loaded into their NmtNewtEntries correctly), but not the
corresponding string->number transforms (meaning changes made in the
entries don't get propagated back to the settings, and due to
http://bugzilla.gnome.org/show_bug.cgi?id=726574, there's no warning
about this). Fix this by registering our own transforms.
2014-03-21 13:32:50 -04:00
Dan Winship
941ce35238 tui: fix quitting from "nmtui edit CONN-ID"
If you launched nmtui directly into the editor for a specific
connection, it would hang with a blank screen when you quit.

Fix this by changing the way startup works a bit, and have the created
toplevel NmtNewtForm get returned all the way to nmtui.c, which can
then connect to the "quit" signal on it and quit (rather than having
the different subprograms trying to guess whether they're supposed to
quit-on-exit or not).
2014-03-21 13:32:50 -04:00
Dan Winship
bbc6434e96 tui: fix selection bugs after deleting a connection
nmt_newt_listbox_clear() did not reset active and active_key, which in
the case of NmtEditConnectionList meant that after the connection list
was rebuilt, the selection would appear to be in the same place, but
active_key would still point to the connection that used to be in that
row, rather than the one currently in that row, so if you immediately
hit Edit or Delete, you'd get unexpected results. (It also meant that
it was possible for the selection to land on a header row instead of a
connection row.)

This was particularly bad in the case of the Delete button, since
active_key would be left pointing to a freed NMConnection in that
case.

Fix NmtNewtListbox, and then add code to NmtEditConnectionList to
preserve the selection itself when rebuilding the list.
2014-03-21 13:32:24 -04:00
Dan Winship
01f41506fb devices: send ARPs when configuring static IPv4 addresses (rh #1073447)
After applying a configuration with static IPv4 addresses, call
/sbin/arping to announce the new addresses to the host's neighbors.
(Basic idea copied from Fedora ifup-eth.)
2014-03-21 09:26:19 -04:00
Jiří Klimeš
7ff7df7640 core: improve ifname matching of existing x generated connections (rh #1077743)
DEVICE="ens3"
ONBOOT=yes
NETBOOT=yes
UUID="23466771-f5fa-4ca9-856f-eaf4a8e20c3f"
BOOTPROTO=none
IPADDR="10.0.0.2"
PREFIX="24"
GATEWAY="10.0.0.1"
HWADDR="52:54:00:12:34:56"
TYPE=Ethernet
NAME="ens3"

This ifcfg file results in connection.interface-name=ens3.
However, device-generated connection didn't set interface-name property.

Fix that by setting interface-name property when generating a connection. Also
allow matching connections if interface-name is not set in a connection.

https://bugzilla.redhat.com/show_bug.cgi?id=1077743
2014-03-21 09:24:13 +01:00
Dan Williams
e4bcfc20ca core: export ActiveConnection before handing it to the device (bgo #723783)
The AC doesn't get a D-Bus path until it's exported, but that happens after
it's handed to the Device it will be activated on.  The Device emits a
PropertyChanged event when it's handed the AC, but it ignores ACs that
aren't exported yet.  Thus when activating, the Device doesn't emit the
AC's path at all in the ActiveConnection property because it's NULL.

Fix that by exporting the AC immediately before starting activation
with it.

Second, move the notification of the Device.ActiveConnection property
to be emitted along with the state change to PREPARE instead of long
before it.  While we don't guarantee signal ordering in general, this
seems like a more correct ordering.

https://bugzilla.gnome.org/show_bug.cgi?id=723783
2014-03-20 19:26:40 -05:00
Dan Winship
398080640e core: warn if multiple plugins for the same type are installed
If we find multiple plugins for the same type (eg, because the user
previously installed the "atm" and "bt" plugins, and didn't delete
them), log a warning.
2014-03-19 14:56:47 -04:00
Dan Winship
a18248dd1b devices: rename "atm" plugin to "adsl", and "bt" to "bluetooth"
The atm/adsl plugin really is a generic ATM plugin but (a) it needs a
bit of work to do IPoATM rather than just PPPoATM and PPPoEoATM, and
(b) most people currently using NM's ATM support are using DSL devices
not actual ATM cards anyway, and have no idea what "ATM" even means.
If we add the necessary IPoATM support later we can rename the plugin
back to -atm
2014-03-19 14:56:47 -04:00
Dan Williams
73d128bbd1 core: emit PropertyChanged signal for ActiveConnection when disconnecting 2014-03-18 15:37:37 -05:00
Dan Winship
c3aa2890f5 devices: change log message when "deactivating" device on startup
nm_device_deactivate() is used when deactivating a device, but also
when initializing it when it is first managed. Rename it to
nm_device_cleanup(), and use a different log message ("preparing
device") in the NM_DEVICE_STATE_REASON_NOW_MANAGED case.
2014-03-18 16:29:04 -04:00
Piotr Drąg
efeca14293 po: fix syntax errors in Hindi (hi) and Tamil (ta) translations (bgo #726554)
https://bugzilla.gnome.org/show_bug.cgi?id=726554

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-17 21:28:41 +01:00
Thomas Haller
3232361f1b core: add debug logging when setting IP[46]Config instance of a NMDevice
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-17 20:38:23 +01:00
Dan Williams
3302fba21c core: fix auto-activation of ignore-carrier devices when carrier appears (rh #1076592)
If a device had its carrier ignored, and did not have a carrier on startup,
then NetworkManager would not re-check autoconnect connections when the
device's carrier appeared.  Because ignore-carrier devices are always
in DISCONNECTED state when they are managed, the nm-device.c::carrier_changed()
code essentially did nothing when the carrier appeared.  It needs to
also trigger an auto-activation recheck signal when the carrier appears
to ensure that now-valid connections (like those that require DHCP or
IPv6) can be auto-activated.
2014-03-17 10:34:53 -05:00
Jiří Klimeš
a1e89b4d29 cli: fix bridge priority default value (rh #1073664)
It is 32768 (0x8000) instead of 128 (0x80). 13c348d fixes that in the setting.

https://bugzilla.redhat.com/show_bug.cgi?id=1073664
2014-03-17 09:08:23 +01:00
Jiří Klimeš
a8f94e9ae0 trivial: fix a typo in a comment 2014-03-17 09:01:50 +01:00
Dan Williams
893735c814 platform: fix crash if link has no name after 5e935dfd
When a VPN goes down, like at suspend, and the link has already
disappeared, the new platform logging code tries to print the
link information using a link object with only the ifindex filled
in.  When adding/removing/changing links, internal code often fills
in just the ifindex (becuase that's all you need).  Thus
to_string_link() will always fail if that operation fails.

    at platform/nm-linux-platform.c:688
    at platform/nm-linux-platform.c:1835
    at vpn-manager/nm-vpn-connection.c:274

Work around that for now and live with the warnings until
we decide what to actually do about to_string_link().
2014-03-14 15:58:41 -05:00
Dan Williams
13c348dcd9 libnm-util: fix Bridge priority default (rh #1073664)
Due to a misread of the kernel code, the bridge priority default
when STP was enabled was 0x80 instead of 0x8000.
2014-03-14 15:29:11 -05:00
Thomas Haller
b73783b4a4 trivial: fix invalid code comment
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 17:06:19 +01:00
Thomas Haller
2f67105a91 libnm-util: remove assert to nm_utils_ip4_netmask_to_prefix
Commit 240c92ddb5 added an assert
to check that the input netmask is valid. Revert that commit for
the most part, some changes to the test function are not reverted.

We don't want to assert for a valid netmask, because it's
common to read the netmask from (untrusted) user input, so we
don't want to assert against it.

The caller *could* validate the netmask from untrusted sources, but
with the assert in place it cannot validate it in the most obvious way:

    prefix = nm_utils_ip4_netmask_to_prefix (netmask);
    if (netmask != nm_utils_ip4_prefix_to_netmask (prefix))
        goto fail;

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 16:55:51 +01:00
Thomas Haller
45a326d9c7 platform: merge branch 'th/platform_link_logging'
Add to_string() functions and some refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=725612

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:44:20 +01:00
Thomas Haller
0553e1b36c core: add debug logging for link disconnect action
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:40:42 +01:00
Thomas Haller
e7daeeecb4 platform: add logging for adding/changing links
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:40:42 +01:00
Thomas Haller
2331f9b00d platform: extract function nm_platform_addr_flags2str() to wrap rtnl_addr_flags2str()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-13 21:40:42 +01:00
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