Commit Graph

7740 Commits

Author SHA1 Message Date
Dan Williams
7a6baa8ab4 vpn: ensure secrets requests fail when exhausted
If the plugin says the user-provided secrets are insufficient,
make sure we fail instead of potentially overrunning the secrets
counter (which triggered an assert).
2012-06-22 15:03:05 -05:00
Jiří Klimeš
4938996973 ifcfg-rh: fix unescaping single quotes in WPA passphrases (WPA_PSK) (rh #833616)
When the last character of the PSK was a backslash and the whole PSK was
enclosed in single quotes, the unquoting/unescaping code mistakenly took
trailing \' as an escaped quote and thus changed \ to '.

See also 79757f10f3 (that introduced the code).
2012-06-22 13:04:18 +02:00
Pavel Šimerda
c0048e7b40 ip6: implement router solicitation and use it to for RDNSS/DNSSL (bgo #753482)
This commit includes Dan Winship's implementation of IPv6
router solicitation. It also uses it as a last resort
for RDNSS and DNSSL lifetime expiry. While using RS to prevent
lifetime expiry may be deprecated and removed in the future,
the RS implementation is useful in other places too.

It can be also viewed as a last resort if commit e1cfdd5 gets
reverted/modified or if it does not work under some weird
circumstances.

It also includes improvements by cyphermox and me.
2012-06-15 10:43:01 -05:00
Pavel Šimerda
c0d2ad5807 ip6: pad RDNSS and DNSSL lifetimes to a minimum lifetime value (rh #753482)
RFC 6106 says, section 5.1 says:

  In order to provide fixed hosts
  with stable DNS service and allow mobile hosts to
  prefer local RDNSSes to remote RDNSSes, the value of
  Lifetime SHOULD be bounded as
  MaxRtrAdvInterval <= Lifetime <= 2*MaxRtrAdvInterval

I have reported and repeatedly confirmed that values in this interval
trigger frequent RDNSS expiration on unreliable links such as 802.11
wifi. Wireless links *do* have packet loss and actually have a *much*
worse multicast packet loss than unicast. And regular router
advertisements are sent as multicast packets (in multicast frames).

In case of RDNSS expiration, NetworkManager tears down the whole
connection. That of course affects IPv4 networking as well as IPv6.
In a typical wireless network with radvd serving RDNSS it leads to
dropping network connection every ~10 minutes.

This commit improves the previous hack in 0b8ee13 by enforcing a minimum
lifetime of two hours (7200 seconds), which is four times the maximum
allowed value for MaxRtrAdvInterval (see below). We could use
AdvDefaultLifetime instead (as suggested by tore_ on IRC) but it doesn't
seem to be accessible through netlink.

RFC 4861 Neighbor Discovery for IP version 6 (IPv6):

  MaxRtrAdvInterval

  The maximum time allowed between sending
  unsolicited multicast Router Advertisements from
  the interface, in seconds.  MUST be no less than 4
  seconds and no greater than 1800 seconds.

This solution is not recommended by any RFC (and is in fact against
RFC 6106) but it's the easiest hack to fix the problem until IETF
takes action.

My original posting to IETF can be found here:

http://www.ietf.org/mail-archive/web/ipv6/current/msg15816.html
2012-06-15 10:35:04 -05:00
Dan Williams
2a5fb5b868 vpn: fix resetting parent device routing on disconnect
1fd11bd8d1 consolidated VPN connection
state handling, but that had the effect of making vpn_cleanup() be
called after all other handlers had processed the VPN connection
state change.  This meant that the code in vpn_cleanup() that
reapplies the parent device's IP configs ran last, and that code
flushes routes on the device before reapplying them.  Since the
policy is a listener on the VPN state change signals, it was
running the default routing updates before vpn_cleanup() got run,
resulting in vpn_cleanup()'s calls to nm_system_apply_ip4_config()
and nm_system_apply_ip6_config() blowing the default route away
which the policy had just set.

Fix that by moving the VPN routing cleanups into the policy, where
most of the routing decisions currently live, causing them to be
run before the default route is fixed up.
2012-06-15 10:14:11 -05:00
Dan Williams
202b693bd8 libnm-glib: don't try to free unset GValues when disconnecting VPNs
IPv6-capable plugins will fill these in, but old IPv4-only won't,
so don't try to free the GValues when they aren't set.
2012-06-14 18:05:16 -05:00
Dan Williams
26b833cd53 core: more VPN activated/deactivated fixups
More fallout from 330247399c.
2012-06-14 18:01:58 -05:00
Dan Williams
bb75026004 core: ensure VPN DNS information is used
The patches that reduced the frequency of changes to /etc/resolv.conf
failed to prefer the VPN DNS information.  Even though a VPN may not
be allowed to receive the default route, its DNS information still
needs to be higher priority than interface DNS info, otherwise no
sites on the VPN will be accessible due to glibc's in-order querying
of entries in /etc/resolv.conf.
2012-06-14 17:41:52 -05:00
Colin Walters
c9aa5f76cf Fix various bits of broken gtk-doc
There was some duplication, syntax errors, etc.
2012-06-14 13:56:48 -04:00
Dan Winship
83760a7ffb libnm-glib: add NM_VPN_PLUGIN_UI_CAPABILITY_IPV6 2012-06-14 11:36:55 -04:00
Alberto Ruiz
d2ae2dedef libnm-glib: add missing nm-connection.h header for NMConnection (bgo #678093) 2012-06-14 15:50:24 +02:00
Dan Williams
526de78113 vpn: update VPN service object for VPN connection state change signal changes
This bit was forgotten in 330247399c.
2012-06-13 16:05:58 -05:00
Dan Williams
4004b828c2 trivial: use constant for a signal name 2012-06-13 16:05:47 -05:00
Alberto Ruiz
330998a837 vala: bumped the VAPIGEN version to 0.17.1.24 to make sure it includes the dbus-glib-1.vapi fixes 2012-06-13 13:07:56 -05:00
Alberto Ruiz
9f9d439faf vala: include local copy of Makefile.vapigen instead of the global one 2012-06-13 13:07:33 -05:00
Jiří Klimeš
495fae7a7b examples: add a python GObject Introspection example
It demonstrates getting NMIP4Config object after activating a device.
2012-06-13 13:28:43 +02:00
Alberto Ruiz
b1e1ee79bd vala: add vala bindings for libnm-util and libnm-glib
This patch adds the autotools facilities to generate vapi files so that
libnm-util and libnm-glib can be consumed from Vala.

It depends on vapigen and it is a soft dependency.
2012-06-12 16:31:20 -05:00
Dan Williams
4366fd2f84 docs: fix some annotations and documentation 2012-06-12 12:12:35 -05:00
Dan Williams
dcceaf40c0 release: update NEWS 2012-06-12 11:50:20 -05:00
Dan Williams
5003153297 core: move DNS change handling to the policy and optimize DNS updates (bgo #676778)
Consolidate all the DNS handling in the policy instead of sprinkling
it around in the device and vpn code.  This allows us to batch the
updates and thus reduce the number of times resolv.conf needs to
be written.  It's also easier to follow when and why the changes
occur.
2012-06-12 10:00:03 -05:00
Dan Williams
330247399c vpn: emit both new and old states in state-changed signal
Various listeners (well, really only the policy) will want the old
state too.
2012-06-12 10:00:03 -05:00
Dan Williams
cb0c2b4e82 trivial: use the constant for NM_IP*_COMPARE_FLAG_ALL 2012-06-12 10:00:03 -05:00
Dan Williams
2384dea3b7 policy: split routing and DNS updates
They won't always be updated together; if the hostname changes we
don't need to update routing, and if new routes show up we don't
need to update DNS.  This also makes it a lot clearer what's
going on in the routing and DNS update functions.
2012-06-12 10:00:03 -05:00
Dan Williams
e48c681bb0 core: add device IPv4 and IPv6 config change signals
We'll use these later to pull the DNS manager code out of the device
class and into the policy.
2012-06-12 10:00:03 -05:00
Dan Williams
220d96ce72 trivial: whitespace fixups and signal name definition 2012-06-12 10:00:03 -05:00
Dan Williams
1fd11bd8d1 vpn: consolidate VPN connection state handling
There used to be two places state was handled: the function that was
called to change the state, and the object method handler for the
VPN connection class.  Since the object method handler was marked
RUN_FIRST in it's g_signal_new() definition, we were destroying
internal class data (like the IPv4 config and IP iface) before other
listeners were able to deal with the state change.

That's all kinda pointless.  Just consolidate the state change
handling and make all the cleanup for the DISCONNECTED/FAILED
states happen after other listeners have had a chance to process
the signal.  It also makes the state change handling a lot clearer.
2012-06-12 10:00:03 -05:00
Dan Williams
f76aa4f77c dns: fix change hashing and add batch update functions
The previous code did a cheap hash based on pointers, under the
assumption that the IP configs don't get recreated.  But with IPv6
the IP6 config that's eventually applied is a composite of the
DHCPv6 and the RA information, and is thus recreated each time
something in the DHCPv6 or RA changes. Switch to actually hashing
the IP config data and its order to prevent this problem.

Next, add functions to signal that a batch of updates will be
started, and to only commit those updates when all of them
have landed, and if they have actually changed anything.  We'll
use these functions later to reduce the number of changes
that get made to /etc/resolv.conf.
2012-06-12 09:58:05 -05:00
Dan Williams
90fb53de4c core: add hashing to IP config objects
We'll use this later to determine whether sets of IPxConfig
objects have actually changed without comparing them all
at once.
2012-06-12 09:37:26 -05:00
Alberto Ruiz
9966ac45fa introspection: fix wrong symbol prefix in the Makefile (bgo #677498)
While the python and JS bindings don't have an issue with "nm_",
the Vala ones apparently do.
2012-06-11 15:03:01 -05:00
Dan Williams
53f6539f54 examples: add simply python GObject Introspection example
Unfortunately since libnm-glib/libnm-util make heavy use of
GHashTable and GValue, functions that deal with these types
can't be used from Python when using GObject Introspection,
since pygobject can't handle conversion between python types
and GValue/GHashTable very well.  You'll likely encounter
assertions like:

ERROR:pygi-argument.c:1755:_pygi_argument_to_object: assertion failed: (g_type_info_get_tag (key_type_info) != GI_TYPE_TAG_VOID)
Aborted
2012-06-11 14:46:33 -05:00
Dan Williams
c114344977 docs: document some libnm-glib NMRemoteConnection callback function types 2012-06-11 14:18:24 -05:00
Dan Williams
11b8574f07 vpn: fix connect timeout issue with old IPv4-only plugins
Old plugins (ie, that aren't IPv6 capable) don't send the 'config'
signal, and thus have no way of signalling which IP methods they
have support for.  Which means they won't set priv->has_ip4 and
thus the connect timer will kill the connection after a minute.
So track whether we got a 'config' signal, and if we didn't, but
we did get an 'ip4-config' signal (which means this is an old
plugin) then we just assume that the plugin supports IPv4.  This
allows the connect timer to be canceled and the plugin to advance
to the STARTED state.
2012-06-11 10:17:12 -05:00
Matej Urbančič
cd4edef5d3 po: updated Slovenian translation (bgo #677723) 2012-06-11 12:29:33 +02:00
Jiří Klimeš
af0eb9e7ad core: don't default to IPv6 temp addr while completing connection (bgo #633233)
Enabling NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR in
nm_device_complete_connection() made IPv6 temp address enabled for connections
created via AddAndActivateConnection() D-Bus call. But it is disabled for other
connections. That is not much consistent. So, do not enable IPv6 privacy when
completing connections and leave it up to users, who would like to use IPv6
Privacy Extensions, to enable it manually.
2012-06-11 09:32:49 +02:00
Jiří Klimeš
2efeac8c5f cli: add DRIVER-VERSION and FIRMWARE-VERSION fields to driver properties listing 2012-06-08 13:44:43 +02:00
Jiří Klimeš
434a4f39b5 libnm-glib: add 'driver-version' and 'firmware-version' properties to NMDevice 2012-06-08 08:55:22 +02:00
Jiří Klimeš
25592950e9 core: add driver-version, firmware-version properties to NMDevice (bgo #636124)
The info is extracted via SIOCETHTOOL ioctl() syscall using ETHTOOL_GDRVINFO.
This works for most drivers but not all, e.g. for modems. We may figure out how
to get the info for specific devices, and enhance the solution by implementing
specific functions for particular device types later.
2012-06-08 08:55:15 +02:00
Dan Williams
d3655d9ebb trivial: simplify AP mode setting function 2012-06-07 16:31:02 -05:00
Dan Williams
e9457176f5 wifi: use supplicant's last_scan time for on-demand scan checking
And return errors when we refuse an on-demand scan.
2012-06-07 15:06:48 -05:00
Dan Williams
c0131f767f wifi: kill usage of deprecated GTimeVal
We don't care about microsecond precision, so we don't need
GTimeVal anyway.  Just use time(2).
2012-06-07 15:06:48 -05:00
Gary Ching-Pang Lin
5e3e19d02b wifi: add on-demand WiFi scan support
A new D-Bus method was added to invoke the on-demand WiFi scan.
2012-06-07 15:06:48 -05:00
Jiří Klimeš
5903392887 cli: free strings when printing adsl setting 2012-06-07 12:28:06 +02:00
Jiří Klimeš
56d5a57728 cli: add NM_DEVICE_STATE_REASON_BR2684_FAILED reason-to-string mapping 2012-06-07 12:08:22 +02:00
Jiří Klimeš
0fb4f259e6 libnm-util: fix return values in g_return_val_if_fail() 2012-06-07 11:32:33 +02:00
Dan Williams
17c1f1e953 dispatcher: normalize return codes 2012-06-06 10:26:26 -05:00
Dan Williams
0e801e5ca3 modem: ensure radio disable cleans up during activation too
Instead of just when activated.
2012-06-06 10:25:47 -05:00
Dan Williams
92de1202a0 core: use correct device state for supplicant link timeouts
When something fails while activated, the device should move to
the FAILED state, not directly to DISCONNECTED.
2012-06-06 10:25:17 -05:00
Dan Williams
cfae0b79ba core: use nm_device_get_connection() in a few more places 2012-06-06 10:24:48 -05:00
Dan Williams
ad72966169 tests: fix libnm-util testcase on 32-bit platforms
On 32-bit, gulong is 32-bits, so we need to use guint64 here,
which we should have been using anyway.
2012-06-03 15:48:35 -05:00
Dan Williams
7be7095f6b bluetooth: ensure the device is deactivated if the modem disappears
Usually if the BT link goes down we'll get some other signal of
failure, like PPP disconnect, or a Bluetooth disconnect.  But if
the modem disappears from ModemManager for some reason while its
connected, make sure we clean up everything correctly.
2012-06-04 15:55:18 -05:00