Commit Graph

9141 Commits

Author SHA1 Message Date
Dan Winship
7d126290c4 dns-manager: initialize hostname
NMPolicy only updates the NMDnsManager's hostname when it changes,
which previously did not include at startup. Meaning if your hostname
never changed, NMDnsManager would never learn it (and so would never
add an appropriate "search" line to resolv.conf). Fix that.
2013-12-20 09:31:04 -05:00
Dan Winship
ea7eb5ab5e dns-manager: make non-refcounted.
All the cool singletons are doing it.

Also, get rid of excess nm_dns_manager_get() calls in nm-policy.c; it
already has priv->dns_manager.
2013-12-20 09:31:04 -05:00
Dan Winship
a201b608dd devices: don't try to capture resolv.conf if not managing it (rh #1035861) 2013-12-20 09:29:34 -05:00
Dan Winship
f2413ae498 devices: don't try to capture resolv.conf if not managing it (rh #1035861)
If NM is not explicitly managing resolv.conf (either due to the "dns"
NetworkManager.conf setting, or because resolv.conf is immutable),
then don't try to parse nameservers out of it when capturing a
connection, since there's no reason to believe that the name servers
there are related to any particular connection.
2013-12-20 09:28:01 -05:00
Dan Winship
20b43802e8 dns-manager: Don't try to manage immutable /etc/resolv.conf
If /etc/resolv.conf has the immutable flag set, then behave as though
"dns=none" was specified (rather than repeatedly trying and failing to
update it).
2013-12-20 09:28:01 -05:00
Dan Winship
3205661096 dns-manager: add nm_dns_manager_get_resolv_conf_mode()
Add a property indicating whether NMDnsManager is ignoring
resolv.conf, managing it by explicitly putting nameservers into it, or
managing it by proxying to another service (eg, dnsmasq) with
"nameserver 127.0.0.1".
2013-12-20 09:28:01 -05:00
Dan Winship
69f92cfa2c core: when suspending, don't take down virtual devices (rh #1038158)
NM bounces devices on suspend/resume, since some buggy drivers require
it. However, there's no need to take down virtual devices. (In
particular, we don't want to take down libvirt's virbr0, since it
won't get automatically brought back up afterward.)
2013-12-20 09:16:43 -05:00
Jiří Klimeš
6b3c209d9a Merge: add MTU property, change 'nmcli dev show' default format (rh #998003) 2013-12-20 11:54:24 +01:00
Jiří Klimeš
3668fd7cbc cli: display MTU for devices 2013-12-20 11:37:54 +01:00
Jiří Klimeš
17a7763d81 libnm-glib: add 'mtu' property to NMDevice 2013-12-20 11:37:54 +01:00
Jiří Klimeš
44bd2275e7 device: add 'mtu' property 2013-12-20 11:37:54 +01:00
Jiří Klimeš
e3bd575758 cli: simplify getting device hardware addresses 2013-12-20 11:37:54 +01:00
Jiří Klimeš
567cfa41f4 libnm-glib: add nm_device_get_hw_address() to NMDevice
It simplifies code getting MAC addresses for clients.
2013-12-20 11:37:54 +01:00
Jiří Klimeš
f889440b96 cli: more compact format for device info (nmcli device show) (rh #998003)
https://bugzilla.redhat.com/show_bug.cgi?id=998003
2013-12-20 11:37:54 +01:00
Dan Williams
f4f20ca0bc rdisc: ensure RDNSS and DNSSL lifetimes are updated (rh #1044757) (bgo #720760)
NetworkManager was not correctly updating the DNSSL/RDNSS option timestamps
when new Router Advertisements were received, leading to a router solicitation
loop after 1/2 the lifetime of the DNSSL/RDNSS option.
2013-12-19 18:03:28 -06:00
Dan Williams
b705d7f50e rdisc: don't add new RDNSS and DNSSL options with zero lifetime
A lifetime of 0 means that the domain or server should no longer
be used, so if we get an RA with a zero-lifetime DNS server or
domain that we haven't seen before, don't bother adding it to the
list.

DNS servers and domains that are already known and become zero
lifetime in the next RA are already correctly handled by
clean_dns_servers() and clean_domains().
2013-12-19 14:39:36 -06:00
Dan Williams
3f654dc6e6 rdisc: ensure RDNSS and DNSSL lifetimes are updated (rh #1044757) (bgo #720760)
The DNS server and domain timestamps and lifetimes weren't updated
when a new RA was received. When half the lifetime for either of
them had passed, clean_dns_servers() and clean_domains() request a
Router Solicitation to ensure the DNS information does not expire.

This obviously results in a new Router Advertisement, but since the
timestamps don't get updated, clean_dns_servers() and clean_domains()
simply request another solicitation because 'now' is still greater
than half the old lifetime.  This casues another solicit request,
which causes another RA, which... etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1044757
https://bugzilla.gnome.org/show_bug.cgi?id=720760
2013-12-19 14:39:36 -06:00
Dan Williams
773d4e4dc8 rdisc: don't leak DNSSL domains if they aren't added
If the new DNSSL domain was not used, becuase it was already in the
list, the domain string would be leaked.
2013-12-19 14:39:36 -06:00
Dan Williams
190fa11843 rdisc: fix possible overflow in large RA option lifetimes
If the address lifetime was near infinity (UINT_MAX) it could
overflow a u32 and wrap back to small values.
2013-12-19 14:39:36 -06:00
Dan Williams
d4684a7dc1 rdisc: fix copy & paste error in detecting RA changes 2013-12-19 12:06:54 -06:00
Dan Williams
3e60ff8953 rdisc: log interface name in some messages 2013-12-19 12:06:54 -06:00
Dan Williams
5ef3d9027d trivial: show interface name in IPv6 rdisc log message 2013-12-19 12:06:54 -06:00
Dan Williams
5f1a62877c rdisc: clear domain list when updating from RA
Appears to be a simple oversight.  If the IPv6 router changes the
domain list, old domains could stick around.
2013-12-19 12:06:54 -06:00
Dan Winship
5e3c55eb28 core: Expose IP and DHCP config information for VPN connections (rh #1036132) 2013-12-19 11:50:39 -05:00
Dan Winship
f1f4f32c02 cli: get IP/DHCP config directly from the NMActiveConnection (rh #1036132)
Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
2013-12-19 11:49:50 -05:00
Dan Winship
4783f43c53 libnm-glib: expose new NMActiveConnection IP/DHCP config properties 2013-12-19 11:49:50 -05:00
Dan Winship
f642e88afd core: add IP/DHCP config properties to o.fd.NM.Connection.Active
Add IP and DHCP config properties to the D-Bus ActiveConnection
objects.

For device connections, this is redundant with the properties already
on the Device object, but for VPN connections, this information was
not previously available.
2013-12-19 11:49:50 -05:00
Dan Winship
fe2fb7137c introspection: wrap long lines in nm-active-connection.xml 2013-12-19 11:43:38 -05:00
Jiří Klimeš
3cebf963da vpn: add code2string translation for NMVPNConnectionState and fix its logging 2013-12-19 13:17:44 +01:00
Jiří Klimeš
c72d2eb02f vpn: print VPN plugin failures and VPN connection reason changes as strings 2013-12-19 12:53:25 +01:00
Jiří Klimeš
1e3edc176b device: add missing state-change reasons to reason_to_string() 2013-12-19 10:00:00 +01:00
Jiří Klimeš
7e95d03f44 device: fix compilation in nm_device_add_pending_action()
The function doesn't return any value.
2013-12-19 10:00:00 +01:00
Thomas Haller
b6ef165cfe core: fix NMActiveConnection to properly add/remove pending action "activation"
When a new activation request is received, NetworkManager creates a new
NMActiveConnection to track that request.  The device may already be activated,
in which case NetworkManager stops the old activation and starts the new one,
but both exist in parallel for a short period of time.  If the old
NMActiveConnection is activating and already has a pending 'activation'
action, when the new NMActiveConnection adds its own 'activating' action,
they will clash.  This is fixed by making each NMActiveConnection's activation
pending action uniquely named.

This fixes a g_warning with the following back trace:

  #0  0x000000328224edfd in g_logv () from /lib64/libglib-2.0.so.0
  #1  0x000000328224efe2 in g_log () from /lib64/libglib-2.0.so.0
  #2  0x000000328224f2e6 in g_warn_message () from /lib64/libglib-2.0.so.0
  #3  0x0000000000440aee in nm_device_add_pending_action (device=0x14002e0, action=0x50704a "activation") at devices/nm-device.c:7172
  #4  0x000000000047525c in nm_active_connection_set_device (self=0x141b3c0, device=0x14002e0) at nm-active-connection.c:364
  #5  0x0000000000475ec1 in set_property (object=0x141b3c0, prop_id=11, value=0x7fff7ff36c20, pspec=0x1405f70) at nm-active-connection.c:647
  #6  0x0000003282615d3e in g_object_newv () from /lib64/libgobject-2.0.so.0
  #7  0x00000032826162e6 in g_object_new_valist () from /lib64/libgobject-2.0.so.0
  #8  0x0000003282616654 in g_object_new () from /lib64/libgobject-2.0.so.0
  #9  0x0000000000474193 in nm_act_request_new (connection=0x13bb0e0, specific_object=0x0, subject=0x1447740, device=0x14002e0) at nm-activation-request.c:376
  #10 0x000000000048e477 in _new_active_connection (self=0x13e8060, connection=0x13bb0e0, specific_object=0x0, device=0x14002e0, subject=0x1447740, error=0x7fff7ff36f90) at nm-manager.c:2947
  #11 0x000000000048ed77 in impl_manager_activate_connection (self=0x13e8060, connection_path=0x134d590 "/org/freedesktop/NetworkManager/Settings/9", device_path=0x134d550 "/org/freedesktop/NetworkManager/Devices/1",
      specific_object_path=0x0, context=0x143a9b0) at nm-manager.c:3206
  #12 0x00000000004876c8 in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7fff7ff37220, return_value=0x0, n_param_values=5, param_values=0x1448830, invocation_hint=0x0,
      marshal_data=0x48e9dd <impl_manager_activate_connection>) at nm-manager-glue.h:189
  #13 0x0000003284a0d6a9 in object_registration_message () from /lib64/libdbus-glib-1.so.2
  #14 0x000000348ea1ce66 in _dbus_object_tree_dispatch_and_unlock () from /lib64/libdbus-1.so.3
  #15 0x000000348ea0fa31 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
  #16 0x0000003284a0acc5 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
  #17 0x0000003282247df6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
  #18 0x0000003282248148 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0
  #19 0x000000328224854a in g_main_loop_run () from /lib64/libglib-2.0.so.0
  #20 0x000000000042c6c0 in main (argc=1, argv=0x7fff7ff379b8) at main.c:629

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 12:36:04 -06:00
Thomas Haller
813ea5995b core: allow dynamic strings for pending action names
Use a GSList of the string values, instead of an array of GQuarks.
Using GQuarks does not allow to add arbitrary strings, because they
would leak the internalized strings.  The next patch will begin
using unique, non-const action strings.

Given the rather small number of expected pending states, a singly
linked list seems appropriate.

Signed-off-by: Thomas Haller <thaller@redhat.com>

(some fixes and simplifications by dcbw based on patch reviews)
2013-12-18 12:35:44 -06:00
Thomas Haller
600763e773 man/cli: add NOTES section with disclaimer for name abbreviations
Make clear, that only full names are guaranteed to work in future
versions. The use of some abbreviations might break as new options
get added.

It would be rather complicated, to ensure, that abbreviations always
continue to work, at the additional disadvantage, that they no longer
uniquely identify an option. Instead, clearly state that using
them is not guaranteed to work in the future. Users that care about
long term compatibility should instead spell out the full names.
Abbreviations are mainly here for interactive use.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Thomas Haller
7fa79fcc5e cli: add pppoe type to nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Jiří Klimeš
107fdd6b01 cli: support PPPoE connection types in 'nmcli con add' 2013-12-18 16:45:59 +01:00
Jiří Klimeš
80851c3550 cli: consider empty value as "*" for "Interface name [*]: " prompt (rh #953397)
And, do it right this time.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 16:10:48 +01:00
Jiří Klimeš
340542a2f2 Revert "cli: consider empty value as "*" for "Interface name: " prompt"
This reverts commit 3cb0bf6bc0.
It broke 'ifname' being required as a mandatory parameter as decided in
https://bugzilla.gnome.org/show_bug.cgi?id=698113
2013-12-18 16:05:37 +01:00
Jiří Klimeš
d79b56a7e9 cli: 'id' option for 'nmcli con add type vlan' is mandatory (rh #953397)
So update documentation accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 15:49:10 +01:00
Jiří Klimeš
eac3c36bbf trivial: fix erroneous copy&paste value in libnm-glib 2013-12-18 10:06:06 +01:00
Jiří Klimeš
2131b57fbd trivial: fix erroneous copy&paste comment 2013-12-18 09:54:09 +01:00
Thomas Haller
b7f6169dbd libnm-util: minor refactoring in nm_connection_compare()
Evaluate a cheaper comparison first, to fail early

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-17 17:18:14 -06:00
Dan Winship
d988a52967 trivial: fix erroneous comment 2013-12-17 16:41:38 -05:00
William Jon McCann
74372f9f11 docs: update documentation links
Various GNOME services moved around so links need updating.
2013-12-17 12:07:51 -06:00
Dan Winship
2940ef7a63 tui: fix the "Device" entry on currently-active virtual devices
Virtual device types can only have an ifname in the "Device" entry,
but the code was accidentally filling in the MAC address too if the
device currently existed (which then made the entry value invalid).
2013-12-17 12:51:18 -05:00
Dan Winship
41ada32127 tui: hide the debugging-related command line options 2013-12-17 12:51:18 -05:00
Dan Winship
250ed1a7dd tui: fix the build so we don't install libtool wrapper scripts
The nmtui development tree didn't use libtool, and the rules that
worked to install links in those Makefiles ended up causing the
libtool wrapper scripts to get installed here. Fix.
2013-12-17 12:51:18 -05:00
Dan Williams
14227fda8b po: fix handling of not-yet-used tui/vpn-helpers.c
tui/vpn-helpers.c is not yet used, so it shouldn't be translated yet.
Having it in po/POTFILES fails distcheck because, since it is not
yet used, it's not distributed, and thus can't be found in the
distcheck build.
2013-12-17 11:50:58 -06:00
Dan Winship
7481c64ad5 systemd: add "Before=network.service" on Fedora/RHEL (rh #1034983)
On Fedora/RHEL, NetworkManager.service needs to be started before
network.service, or else network.service may try to bring up NM's
devices itself.
2013-12-17 09:45:18 -05:00