Commit graph

9864 commits

Author SHA1 Message Date
Jiří Klimeš
183e1e8aad cli: editor - enhance TAB completion for 'print' command
(cherry picked from commit 9ab59bdfac)
2014-06-20 17:20:09 -05:00
Jiří Klimeš
4bccec249c cli: editor - enhance 'print' command
- allow printing single properties:
nmcli> print con.id
connection.id: my-main-ethernet

- allow printing other settings in second (settings) menu level:
nmcli connection> print ipv4.method
ipv4.method: auto
nmcli connection> print eth
...

(cherry picked from commit e7830c7925)
2014-06-20 17:20:03 -05:00
Thomas Haller
3c166ae93a contrib/rpm: improve usage output of build_clean.sh script
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit bf0b08ad55)
2014-06-20 17:19:52 -05:00
Thomas Haller
0ed0fe5c4c dispatcher: silence warning about sub-directories in dispatcher directory
Especially now that we have the 'pre-up.d/' and 'pre-down.d/' directories,
silently skip over any sub directories inside the dispatcher directory.

Fixes warning:
  nm-dispatcher: Cannot execute '/etc/NetworkManager/dispatcher.d/pre-up.d': not a regular file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 02747203c6)
2014-06-20 17:19:46 -05:00
Thomas Haller
57d04625d8 dispatcher: fix leak in callouts/nm-dispatcher
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 589272facf)
2014-06-20 17:19:38 -05:00
Dan Williams
8b2de26936 core: merge branch 'th/bgo731570_master_slave'
https://bugzilla.gnome.org/show_bug.cgi?id=731570

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:48 -05:00
Thomas Haller
d63aceddf6 dispatcher: better detection for dispatcher scripts
Previously, we would not check the content of the script directory.
This meant, that "/etc/NetworkManager/dispatcher.d" almost always
contained something, namely the "pre-up.d" and "pre-down.d" directories.

Improve that by searching the directories for at least one
executable file.

Also, debug log the detected state of the dispatcher directories.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:30 -05:00
Thomas Haller
a5ab186707 dispatcher: for debug logging, truncate the (expected) script name when showing dispatcher results
Only truncate the script name to "basename" if the directory is the expected
one. Otherwise we print the raw value as returned by the dispatcher service.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:30 -05:00
Thomas Haller
157d339a06 dispatcher: skip callouts for empty script directory based on dispatcher action type
Before, there was only one combined variable checking whether any dispatcher scripts
are present at all. This meant for example, that a call to PRE_UP was still sent out
even if no scripts were in pre-up.d/ directory.

Optimize this, by distinguishing between the dispatcher type and the script directories.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:30 -05:00
Thomas Haller
4830cd6115 dispatcher/trivial: move code
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:30 -05:00
Thomas Haller
141ff20fe8 dispatcher: improve debug logging for dispatcher callouts
- ensure, that dispatcher_results_process() logs a line even if no scripts
were run. This way we alyways know when the callout returns.

- log a line when cancelling a dispatcher call

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:29 -05:00
Thomas Haller
c320732a1f dispatcher/trivial: rename variables for script directory to NMD_SCRIPT_DIR_* 2014-06-20 17:14:29 -05:00
Thomas Haller
502318b3a4 device: refactor by combining dispatcher callback functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:29 -05:00
Thomas Haller
11408d34cb core/trivial: move code
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:29 -05:00
Thomas Haller
44a5b1f155 core: preserve reason on device deactivation while pre-down (fix tearing down slave when deactivating master)
When delaying the deactivation of a device during dispatcher-pre-down,
we must preseve the reason to pass it on.

This is especially important, because nm_device_slave_notify_release()
checks for the reason, and does not deactivate the slave if no reason is
given. This error caused slaves the be left up when deactivating the master.

Also update the call to nm_device_slave_notify_release() to ensure we
have a valid state reason when configuring the slave. This would have
pointed out the issue and would even work around it.

Regression introduced by commit d00e2147de.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:29 -05:00
Thomas Haller
0e266e7c16 core: fix activation of slave when master is not active, but device exists
NM fails to activate a slave if the master device already exists
but has not active connection.

One way to reproduce, create a bond master/slave configuration and
ensure that the master device exists (e.g. by activating the bond, and
killing NM without taking down the device, or externally via `ip link add`).

If you try to activate the slave it will fail with the following message
(in nmcli):
  "Error: Connection activation failed: The active connection on MASTER is not a valid master for 'SLAVE'"
although MASTER is not active.

This also triggers the following assertion:

    #0  0x0000003370c504e9 in g_logv () from /lib64/libglib-2.0.so.0
    #1  0x0000003370c5063f in g_log () from /lib64/libglib-2.0.so.0
    #2  0x000000000047646a in is_compatible_with_slave (master=0x0, slave=slave@entry=0xc4aa60) at nm-manager.c:2193
    #3  0x000000000047e289 in ensure_master_active_connection (self=self@entry=0xc8d150, subject=0x7f23b80059e0, connection=connection@entry=0xc4aa60, device=device@entry=0xcac380, master_connection=master_connection@entry=0x0,
        master_device=master_device@entry=0xc9e800, error=error@entry=0x7fffa5cc4958) at nm-manager.c:2395
    #4  0x000000000047eb4a in _internal_activate_device (self=self@entry=0xc8d150, active=active@entry=0xcc33b0, error=error@entry=0x7fffa5cc4958) at nm-manager.c:2665
    #5  0x000000000047ecf2 in _internal_activate_generic (self=self@entry=0xc8d150, active=active@entry=0xcc33b0, error=error@entry=0x7fffa5cc4958) at nm-manager.c:2712
    #6  0x000000000047ef2b in _internal_activation_auth_done (active=0xcc33b0, success=<optimized out>, error_desc=0x0, user_data1=0xc8d150, user_data2=<optimized out>) at nm-manager.c:2848
    #7  0x0000000000466fa1 in auth_done (chain=0xcef020, error=0x0, unused=<optimized out>, user_data=<optimized out>) at nm-active-connection.c:603
    #8  0x00000000004753da in auth_chain_finish (user_data=0xcef020) at nm-manager-auth.c:88
    #9  0x0000003370c492a6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
    #10 0x0000003370c49628 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
    #11 0x0000003370c49a3a in g_main_loop_run () from /lib64/libglib-2.0.so.0
    #12 0x0000000000429e65 in main (argc=1, argv=0x7fffa5cc4e48) at main.c:678

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:14:29 -05:00
Thomas Haller
931d793430 vpn: fix printf format string for PID by casting to (long)
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit f0cd5bb866)
2014-06-20 17:13:05 -05:00
Dan Winship
a429276035 settings: remove an unnecessary check
Coverity gets confused and thinks we are potentially leaking bssid_str
here. Given that nm_utils_hwaddr_ntoa() never returns NULL anyway,
just drop the check.

(cherry picked from commit f4f4ecf159)
2014-06-20 17:12:56 -05:00
Dan Winship
45851e0309 misc: remove some dead code
The G_DISABLE_CHECKS version of g_return_if_reached() still returns,
it just doesn't log. So don't include a manual return after a
return-if-reached.

(cherry picked from commit 3c13d9e3fd)
2014-06-20 17:11:28 -05:00
Thomas Haller
533f3e8448 keyfile: assert that the connection to be written verifies
Related: https://bugzilla.redhat.com/show_bug.cgi?id=979425

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit d041775501)
2014-06-20 17:06:28 -05:00
Michael Biebl
e1adaeb402 build: fix bashisms in configure.ac
[[ && ]] is a bashism, so use [ ] && [ ] instead.
Also use readlink -f instead of realpath, since the latter is not
guaranteed to be installed.

(cherry picked from commit ec1034a03a)
2014-06-17 11:38:07 -05:00
Jiří Klimeš
bc4bc62fa6 man: clarify an nmcli example for adding static addresses in nmcli-examples
(cherry picked from commit 1553607223)
2014-06-16 13:34:06 +02:00
Dan Williams
a83db628b9 merge: some settings plugin refcounting and use-after-free fixes (bgo #731534) 2014-06-13 15:33:23 -05:00
Dan Williams
a52836ddbe ifnet: 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 ifnet 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 ifnet 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 ifnet 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.
2014-06-13 15:33:08 -05:00
Dan Williams
746742064d example: fix possible invalid refcounting when changing connections
Since the pointer to the connection's path could change any time
commit_changes() is called, it's not safe to use it as the hash
table key directly.  strdup it instead.
2014-06-13 15:33:08 -05:00
Dan Williams
7b69d8f9c3 keyfile: clean up logging connection verify errors
Prevents:

Connection failed to verify: (unknown)
   invalid or missing connection property 'blah blah/foo bar'

Simply removing the warning in reader.c is fine, because callers that
care already log the warning themselves.  Also make the warning in
update_connection() the same as the warning in new_connection().
2014-06-13 15:33:08 -05:00
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