Commit graph

9838 commits

Author SHA1 Message Date
Dan Williams
db2995c162 keyfile: fix use-after-free and refcounting of invalid changed connections
If a valid connection was updated and still valid, and then was
updated and become invalid, the connection would not be properly
removed from the keyfile plugin's priv->connections hash, and thus
would never be disposed.

This was due to using the direct pointer to the connection's UUID
as the key for the hash table.  When a connection is updated and
its settings are replaced, the old UUID is freed and replaced with
a new pointer.  But the keyfile plugin hash table still uses the
old (now freed) UUID pointer as the key.  Thus when the connection
is updated and becomes invalid, looking up the UUID in the hash
table fails to find the connection, and the connection is not
removed from the hash.

This bug could cause a crash in some cases, if two keys of the
GHashTable hashed to the same value, in which case GLib would
call g_str_equal() on the freed pointer.

Since code other than in the keyfile plugin replaces settings,
we cannot be guaranteed that the pointer won't change.  Avoid all
that and just strdup() the UUID when using it as a key.

(also collapses _internal_new_connection() into its only caller)
2014-06-13 15:33:08 -05:00
Thomas Haller
2f1873c119 build: remove libndp location in summary of ./configure
This is a left-over from the early days of libndp when
the libarary was optionally a git-submodule of NetworkManager.

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 9f114f661a)
2014-06-12 15:04:55 +02:00
Swapnil Nagarkar
5f6e53c3a6 nmcli autocomplete tab display : rename ERROR to ERR
The nmcli auto completation shows log levels as ERROR.
But giving ERROR it does not work. This should renamed
from ERROR to ERR

https://mail.gnome.org/archives/networkmanager-list/2014-June/msg00019.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 2e3523bb43)
2014-06-12 14:29:45 +02:00
Jiří Klimeš
063b2e7618 bluetooth: don't crash when switching off bluetooth (rh #1059494)
When connected to a phone via bluetooth and turning bluetooth off on the
computer NetworkManegr crashed due to accessing invalid device.

Reproducer:
- activate bluetooth on a computer and a phone
- pair the devices
- $ nmcli con add type blue con-name phone bt-type panu addr 00:17:EA:84:E7:41
- turn off bluetooth on computer (either with a hardware or software switch)

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

(cherry picked from commit 948a27257a)
2014-06-12 14:03:31 +02:00
Jiří Klimeš
aa1aa581e2 ifcfg-rh: accept IPv6 routes without "via" in route6 file (bgo #697525)
Routes without nexthop are legal and should be treated as a device route
(direct route).

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

(cherry picked from commit 9ee3ac20b0)
2014-06-12 14:03:02 +02:00
Yegor Yefremov
e29937456a nm-dispatcher: explicitly include gio/gio.h
Without this header Buildroot's build complains about unknown
types like GFile etc.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit c62639d572)
2014-06-11 18:54:36 +02:00
Jiří Klimeš
a60956f29d cli: don't accept prefix 0 for routes
(cherry picked from commit e70d5579af)
2014-06-11 10:25:01 +02:00
Jiří Klimeš
0b0f2fe826 cli: don't accept default route entries, NM handles the default route itself
(cherry picked from commit 4e9fc8ad61)
2014-06-11 10:25:01 +02:00
Jiří Klimeš
31b94b838f cli: allow missing next hop for routes (bgo #727615)
https://bugzilla.gnome.org/show_bug.cgi?id=727615
(cherry picked from commit 700f5ec0ef)
2014-06-11 10:25:00 +02:00
Dan Williams
18a0d9485b examples: add Python D-Bus and GI examples for updating IPv4 setting method
(cherry picked from commit e8fb3864d1)
2014-06-11 10:25:00 +02:00
Dan Winship
223a0dde1a core: fix metrics of user-added routes
Adding a route with a metric of 0 to an IP4 or IP6 setting used to
implicitly mean "use the default metric for the device", but this got
broken by 722c9034. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=731402
(cherry picked from commit cdd09286d7)
2014-06-10 09:15:44 -04:00
Dan Williams
1963addac6 contrib/rpm: misc specfile updates
Unify the obsoletes so they don't have to be changed every time.

Clarify the WWAN package description, since it really applies to
2G/3G/4G devices, not just 3G.

Also sync the glib and dbus-glib required versions with actual
NetworkManager requirements from configure.ac.
2014-06-09 10:47:50 -05:00
Jiří Klimeš
59c1a58fcf Revert "release: bump version to 0.9.11.0 (development)"
This reverts commit 9e8c8de70c.

Pushed by mistake originally (it only belong to master).
2014-06-09 11:13:13 +02:00
Jiří Klimeš
5974c2e76d contrib/rpm: update NetworkManager description in spec file
Text by dcbw.
2014-06-09 11:11:32 +02:00
Jiří Klimeš
b8097afa6f libnm-util: don't append NULL in g_string_append() 2014-06-09 11:11:32 +02:00
Jiří Klimeš
8a4f713726 examples: fix get-active-connections-dbus-glib.c example 2014-06-09 11:11:32 +02:00
Jiří Klimeš
c36bd25b51 trivial: typo in the NEWS 2014-06-09 11:11:32 +02:00
Thomas Haller
9e8c8de70c release: bump version to 0.9.11.0 (development) 2014-06-09 11:11:32 +02:00
Thomas Haller
d5b793bbd4 platform: pass optional padding to _rebase_relative_time_on_now()
_rebase_relative_time_on_now() is used both by _address_get_lifetime()/nm_platform_ip[46]_address_sync()
and the to_string() functions.

In the latter case, we want to print the original value, without padding. Otherwise in
the addresses are printed in the logs with an additional 5 seconds
padding, which is confusing.

For adding addresses in platform however, we still want to keep the
padding. So pass it on as additional parameter.

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

(cherry picked from commit 63ef089f69)
2014-06-07 11:39:57 +02:00
Thomas Haller
cb38830e26 libnm-glib: don't use deprecated nm_access_point_get_hw_address()
nm_access_point_get_hw_address() is already deprecated since
pre-0.9.0-beta3 (f30e15a04d). However,
it also is defined as NM_DEPRECATED_IN_0_9_10, because there
are no deprecated macros for previous version.

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

(cherry picked from commit b633711572)
2014-06-07 11:20:11 +02:00
Thomas Haller
379951d39f platform: fix setting preferred time off-by-one in _init_ip_address_lifetime()
This error was introduced only recently with commit
8310a039d8.

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

(cherry picked from commit 8366d7cd1b)
2014-06-07 11:20:06 +02:00
Dan Williams
c817409fc0 release: bump version to 0.9.9.95 (0.9.10-beta1) 2014-06-06 18:28:21 -05:00
Dan Williams
3470b3aafd release: update NEWS 2014-06-06 18:28:21 -05:00
Dan Williams
351ab1d76f libnm-glib-vpn: bump soname (1.1.0 -> 1.2.0) for API additions 2014-06-06 18:28:20 -05:00
Dan Williams
08faaf1170 libnm-glib: bump soname (4.7.0 -> 4.8.0) for API additions 2014-06-06 18:28:20 -05:00
Dan Williams
5e9904f451 libnm-util: bump soname (2.5.0 -> 2.6.0) for added API 2014-06-06 18:28:20 -05:00
Dan Williams
33e5e1c500 dispatcher: don't warn on non-critical missing directory error 2014-06-06 18:28:03 -05:00
Thomas Haller
fb88ec99f1 build: create dispatcher directories pre-down.d and pre-up.d
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-07 01:17:16 +02:00
Dan Williams
9433a0bfe0 libnm-util: fix an error noticed by coverity 2014-06-06 17:25:36 -05:00
Dan Williams
dacee1485a cli: fix a couple errors noticed by coverity 2014-06-06 17:25:36 -05:00
Dan Williams
e5ccc30e3c core: suppress missing MAC address warning during connection matching
One of the connetions may not have a MAC address, so don't expect one.
2014-06-06 16:37:03 -05:00
Thomas Haller
bcb9f6c910 cli: fix error parsing input arguments in non-interactive mode
Causes the following failure:

   $ /bin/nmcli connection add type ethernet con-name connie ifname '*'

   (process:13883): GLib-CRITICAL **: g_strchug: assertion `string != NULL' failed
   (process:13883): GLib-CRITICAL **: g_strchomp: assertion `string != NULL' failed
   Error: invalid connection type; '' not among [generic, ...].

Regression introduced by commit bfb1200b4f.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-06 23:19:49 +02:00
Thomas Haller
5fa1248a2f build: update gitignore file after renaming nm-dispatcher.action executable to nm-dispatcher
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-06 23:09:16 +02:00
Dan Winship
c4ca23137e core: fix lag in NMManager:state moving to CONNECTED_GLOBAL
Something changed at some point so that NMManager was now recomputing
its state after a connection was activated, but before NMPolicy had
decided whether to give that connection the default route, meaning
NMManager would set the state to CONNECTED_LOCAL rather than
CONNECTED_GLOBAL.

Fix this by watching the active connection :default and :default6
properties too, so we do the right thing regardless of what order the
AC properties change in.
2014-06-06 15:33:03 -04:00
Dan Williams
67b228d16b merge: add blocking dispatcher pre-up and pre-down events (bgo #387832)
https://bugzilla.gnome.org/show_bug.cgi?id=387832
https://bugzilla.redhat.com/show_bug.cgi?id=1048345
https://bugzilla.redhat.com/show_bug.cgi?id=982734
2014-06-06 14:15:21 -05:00
Dan Williams
02252224e2 dispatcher: bump overall timeout to 10 minutes (rh #982734) (rh #1048345)
Since NM now handles long-running dispatcher scripts better, allow them
to run for really long times.
2014-06-06 13:43:47 -05:00
Dan Williams
fd5761ecb2 dispatcher: don't use NULL error domains
glib doesn't like it, plus we don't use the error anyway, so just
return the constant error string.
2014-06-06 13:43:47 -05:00
Dan Williams
df601ad68c dispatcher: enhance debug logging
Attach a request ID to every request, and print that out in the debug
messages so you can see which results match up with which dispatcher
requests.
2014-06-06 13:43:47 -05:00
Dan Williams
1383f4bc14 dispatcher: use separate directories for pre-up/pre-down events
To ensure that NetworkManager does not block needlessly for events
which have no scripts, require scripts that respond to blocking
events to opt into the action.
2014-06-06 13:43:46 -05:00
Dan Williams
7eaaa6a475 core: block on dispatcher scripts when quitting
Like VPN connections, block on dispatcher scripts when quitting.  Since
the event loop is no longer running we can't schedule callbacks.
2014-06-06 13:43:46 -05:00
Dan Williams
38e6b7387f core: implement PRE_UP dispatcher actions 2014-06-06 13:43:46 -05:00
Dan Williams
d00e2147de core: implement PRE_DOWN dispatcher actions (bgo #387832)
https://bugzilla.gnome.org/show_bug.cgi?id=387832
2014-06-06 13:43:46 -05:00
Dan Williams
ce3d2cf0e6 vpn: implement PRE_UP dispatcher actions 2014-06-06 13:43:46 -05:00
Dan Williams
beb5529c42 vpn: make DOWN dispatcher action block on quit
Since the event loop isn't running on quit, but we want to ensure that
scripts can fully process the DOWN event, block on scripts completing
when disconnecting the VPN when quitting.
2014-06-06 13:43:46 -05:00
Dan Williams
e1ec6a5173 vpn: implement PRE_DOWN dispatcher actions (bgo #387832)
https://bugzilla.gnome.org/show_bug.cgi?id=387832
2014-06-06 13:43:46 -05:00
Dan Williams
27cb927d8f dispatcher: convert action_to_string to a table
Oddly, this increases the compiled+stripped size of the object file
by 24 bytes (8296 -> 8320), but I think it produces more readable code.
2014-06-06 13:43:46 -05:00
Dan Williams
19d7386b2f dispatcher: add PRE_UP states
This event runs before a connection/device is announced as
"activated" or "connected", to enable scripts to do things
before applications begin using connectivity.  For example,
this could be used to manage /etc/resolv.conf outside of
NetworkManager and ensure that resolv.conf had correct
information before DNS is used.

Note that this is different than the Debian or Gentoo "pre-up"
event used in /etc/network/interfaces, as that event runs before
any L2 configuration has started.  If we really need an event
like that, we'll add it later as "lower-up".
2014-06-06 13:43:46 -05:00
Dan Williams
286e926ee8 dispatcher: robustify canceling dispatcher calls
Thomas pointed out that using the address of the DispatcherInfo
structure as the dispatcher call ID could cause a mis-cancelation
if malloc re-used the same block in the future.  While the code
should be correctly clearing call IDs after the callback runs
or is canceled, just use numeric IDs to avoid potential crashses.
2014-06-06 13:43:46 -05:00
Dan Williams
90b747fa11 dispatcher: add synchronous dispatcher calls
On shutdown we can't defer the response to a callback, so we need to
use synchronous D-Bus calls.  Second, sometimes we want to block on
the dispatcher response, like for pre-down.
2014-06-06 13:43:46 -05:00
Dan Williams
5150cb88c2 dispatcher: only dispatch if scripts exist
If there are no dispatcher scripts, don't bother dispatching any
events.  This saves some time configuring networking if the event
would have no effect anyway.
2014-06-06 13:43:45 -05:00