Commit graph

4387 commits

Author SHA1 Message Date
Dan Winship
041f449a91 platform: fix linux nm_platform_link_get_physical_port_id() (rh #804527)
It was reading the wrong property name
2014-01-22 13:20:18 -05:00
Dan Winship
1d42962e7f logging: fix "nmcli gen log level FOO"
The change to per-domain log levels means that when setting just the
level, we need to re-set the log level for each domain (since it's the
"logging" bit array that actually determines what gets logged).
nm_logging_setup() was dealing correctly with domains=NULL, but not
domains="" (which is what happens when it is invoked with only a level
via D-Bus), so doing "nmcli gen log level DEBUG" would change the
"default" log level, but leave all of the domains still at their
previous level:

danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
INFO   PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6...

danw@laptop:NetworkManager> nmcli g log level DEBUG
danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
DEBUG  PLATFORM:INFO,RFKILL:INFO,ETHER:INFO,WIFI:INFO,BT:INFO...
2014-01-22 09:48:42 -05:00
Thomas Haller
2b87dbb2a9 core: cleanup data types for nm_platform_sysctl_get_int32()
The sysctl values in the kernel (for those values for which
nm_platform_sysctl_get_uint() is currently used) are defined as s32.
Change nm_platform_sysctl_get_uint() to nm_platform_sysctl_get_int32()
and ensure, that a matching integer type is used thoroughly.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-22 12:23:58 +01:00
Thomas Haller
63075d98a5 core: add nm_utils_ascii_str_to_int64() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-22 12:12:02 +01:00
Michael Schaller
6b5d31954f wired: only request new secrets during the inital connection
This ports commit 30fe3e1876
for wifi to ethernet.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Scott Shambarger
31fe84e467 core: Add host route for DHCP4 server if outside assigned subnet (bgo #721767)
Some ISP's provide leases from central servers that are on different
subnets that the address offered.  If the host does not configure the
interface as the default route, the dhcp server may not be reachable
via unicast, and a host specific route is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=721767
https://bugzilla.redhat.com/show_bug.cgi?id=983325

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Scott Shambarger
2b461bfa19 core: set classful prefix length for DHCP4 static routes (bgo #721771)
Follow RFC 3442 to set network prefix based on address class.
However, still uses host routing if the target address is not a
network address (ie host part not zero).

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Dan Williams
efd0e2a589 core: respect connection permissions for internal activation requests
Similar to "core: respect connection user permissions for activation/deactivation",
if a master connection is being activated because a slave connection requested
it, ensure that the user requesting the master connection is allowed to
activate it.
2014-01-21 13:41:18 -06:00
Dan Williams
eb8bc5396e core: respect connection user permissions for activation/deactivation
This appears to be a bug since the original 0.9.0 release when
connection permissions were implemented.

If all the following are true:
- the user is local (as determined by systemd or ConsoleKit)
- the user has been given the NETWORK_CONTROL PolicyKit permission
- the user is not listed in the connection's permissions
- the user knows the D-Bus object path of a connection which they
have no permissions for

then that user may activate/deactivate connections that are not
visible to that user as determined by the connection permissions.
Fix that by ensuring that these operations check whether the user
has permission.

These operations are *not* affected, and have always checked user
permissions before allowing the operation:
- modifying any connection details
- requesting any secrets or passwords for the connection
- deleting the connection
2014-01-21 12:18:49 -06:00
Thomas Haller
a16b7a8253 core: fix warning about pending action "autoactivate"
Fix the following warning:
  add_pending_action (2): 'autoactivate' already added

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-20 22:34:27 +01:00
Thomas Haller
40562b0aa5 trivial: rename field to give it a unique name
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-20 21:51:04 +01:00
Dan Williams
f36bfd2039 trivial: remove stray '\' 2014-01-17 10:55:46 -06:00
Thomas Haller
177c767320 core/platform: fix wrong calculation of address lifetime/preferred for kernel addresses
When receiving an IPv4/IPv6 address from the kernel, platform set the
timestamp to an invalid value before. The address timestamp must be set
to *now*, because the lifetime and preferred arguments are counting from
now.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-16 20:44:29 +01:00
Dan Winship
a7249cc619 core: fix a possible crash if given an empty IP4 config
update_system_hostname() was bailing out if (there is no IP4 config or
the IP4 config has no addresses) AND (there is no IP6 config or the
IP6 config has no addresses), but it would then hit an assertion and
crash if there was a valid IP6 config along with an IP4 config with no
addresses. Fix that and get rid of some redundancy.

Sort of pointed out by Coverity.
2014-01-16 14:23:45 -05:00
Thomas Haller
f027c4ad0e core: reset auto-retry counter when a connection gets updated
This restores the behaviour, that was removed in commit
e299d7b30f.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
0cdd4ada5b core: add signal CONNECTION_UPDATED_BY_USER to NMSettings
This forwards the signal UPDATED_BY_USER received from one of their
NMConnection.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
85f3da8351 core: emit UPDATED_BY_USER signal when reloading connection from file
Now UPDATED_BY_USER signal gets emitted immediately after the connection
is updated, rather then only after it is successfully saved.

This means, that the signal will be emitted earlier then before (right
after changing the connection, but before it gets commited).
Furthermore, the signal will also be emitted for connections that
get changed but are not to be saved.

Currently, the only subscriber to this signal is NMSettings
(default_wired_connection_updated_by_user_cb), which should be fine with
this change of semantics (even better).

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
22cbc77bae core: trivial rename NMSettings signal dbus-updated to updated-by-user
https://bugzilla.redhat.com/show_bug.cgi?id=1040528

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
4dd6ab8f4b libnl-util: refactor nm_utils_ip4_prefix_to_netmask/netmask_to_prefix
- use a more efficient implementation for prefix_to_netmask
- fix netmask_to_prefix to behave consistently in case of
  invalid netmask
- remove unused duplicated functions from NetworkManagerUtils.c
- add test functions

Based-on-patch-by: Pavel Šimerda <psimerda@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Related: https://bugzilla.gnome.org/show_bug.cgi?id=721771
2014-01-10 13:34:57 -06:00
Dan Williams
90782cf023 platform: ignore errors adding IPv6 point-to-point address
For now, ignore them, as libnl does not support IPv6 PtP addresses
and returns an error.  In the future perhaps we'll want to add a host
route for the peer instead of using the point-to-point address.
2014-01-06 17:25:02 -06:00
Dan Williams
0b3fdd073e ifcfg-rh: fix handling of DHCP_SEND_HOSTNAME when no hostname is given
Move DHCP_SEND_HOSTNAME parsing out of the check for DHCP_HOSTNAME so that
users can disable NM sending the system hostname to the DHCP server when
DHCP_HOSTNAME is not defined.
2014-01-06 16:20:48 -06:00
Dan Williams
91eafe95a3 core: fix stale DHCPv6 information for dispatcher lease-change events (bgo #721002)
dhcp6_lease_change() needs to be called *after* updating the DHCP config
object to ensure that the dispatcher gets the new values.
2014-01-06 16:08:06 -06:00
Scott Shambarger
a30030b82b core: fix stale DHCPv4 information for dispatcher lease-change events (bgo #721002)
dhcp4_lease_change() needs to be called *after* updating the DHCP config
object to ensure that the dispatcher gets the new values.
2014-01-06 16:07:57 -06:00
Jan Alexander Steffens
691422a460 build: add --with-dnsmasq, to specify dnsmasq path
https://bugzilla.gnome.org/show_bug.cgi?id=700219
2014-01-03 14:51:16 -05:00
Dan Winship
c4edeb6da4 settings: fix secret-agent fallback
NMAgentManager was supposed to be trying multiple secret agents on any
error except UserCanceled, but due to a botched last-minute rewrite,
it was actually doing the reverse.
2013-12-20 14:58:04 -05:00
Dan Williams
9f00e0598a build: remove left-over BLUEZ makefile bits 2013-12-20 12:12:42 -06:00
Dan Winship
32a12ad9a4 core: fix leak in impl_manager_get_logging
nm_logging_level_to_string() returned a const string, but
nm_logging_domains_to_string() returned a malloced one, which was
getting leaked in impl_manager_get_logging(). Fix this by making them
both malloced, and freeing as needed.
2013-12-20 10:04:11 -05:00
Thomas Haller
224e698904 logging: Use locale independent strcasecmp 2013-12-20 10:04:10 -05:00
Dan Winship
111603212c logging: ignore unrecognized domains on startup
If the command line or NetworkManager.conf mentions a non-existent
domain, just print a warning and ignore it. That way if you switch to
using an older NM that doesn't have that domain, it will still work.
2013-12-20 10:04:10 -05:00
Dan Winship
fc2a14d0f9 logging: allow per-domain log level overrides
Allow specifying log domains like "DEFAULT,WIFI:DEBUG" to override the
log level on a per-domain basis.
2013-12-20 10:04:10 -05:00
Dan Winship
0e3432fbea logging: tweak logging-enabled functions
Rather than having separate nm_logging_level_enabled() and
nm_logging_domain_enabled(), have just nm_logging_enabled() that
checks both.
2013-12-20 09:57:13 -05:00
Dan Winship
bfcf402525 dns-manager: fix build without libsoup 2013-12-20 09:56:19 -05:00
Dan Winship
dfe194eea6 dns-manager: don't add "public suffix" domains to search (rh #851521)
If the hostname is "foo.example.com" then we want to add
"search example.com" to resolv.conf, but if it's just "example.com",
we don't want to add "search com" (rh #812394).

So if NetworkManager is being built with recent libsoup, use
soup_tld_domain_is_public_suffix() to double-check the domain before
adding it. (If it is not being built with libsoup, or is being built
with too old a version, we just skip that test, keeping the old
behavior.)
2013-12-20 09:31:04 -05:00
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
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š
44bd2275e7 device: add 'mtu' property 2013-12-20 11:37:54 +01: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
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
Jiří Klimeš
3cebf963da vpn: add code2string translation for NMVPNConnectionState and fix its logging 2013-12-19 13:17:44 +01:00