Commit Graph

10267 Commits

Author SHA1 Message Date
Thomas Haller
5174976cc1 platform/test: use proper to_string() functions when printing NMPlaformIP[46]Address in dump_interface()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-19 22:13:48 +02:00
Thomas Haller
ca85ecd145 contrib/rpm: fix typo in spec file (wrong option --enable-teamdctl)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-19 12:49:14 +02:00
Jiří Klimeš
f227d25ed9 cli: clarify nmcli description for route metric 2014-06-19 10:04:08 +02:00
Jiří Klimeš
7c41835203 cli: editor - do not print separator when printing one setting 2014-06-19 09:24:07 +02:00
Jiří Klimeš
9ab59bdfac cli: editor - enhance TAB completion for 'print' command 2014-06-19 09:24:07 +02:00
Jiří Klimeš
e7830c7925 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
...
2014-06-19 09:23:07 +02:00
Thomas Haller
bf0b08ad55 contrib/rpm: improve usage output of build_clean.sh script
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-18 10:49:51 +02:00
Thomas Haller
02747203c6 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>
2014-06-17 19:15:31 +02:00
Thomas Haller
589272facf dispatcher: fix leak in callouts/nm-dispatcher
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-17 19:09:56 +02:00
Michael Biebl
ec1034a03a 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.
2014-06-17 11:33:50 -05:00
Thomas Haller
d71ec13123 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-16 19:20:33 +02:00
Thomas Haller
0a7a7f5e4d 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-16 19:19:10 +02:00
Thomas Haller
c674f26cd1 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-16 19:18:57 +02:00
Thomas Haller
0c54ab217e 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-16 19:18:57 +02:00
Thomas Haller
10780592c8 dispatcher/trivial: move code
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-16 19:18:57 +02:00
Thomas Haller
b317e79b5b 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-16 19:18:57 +02:00
Thomas Haller
c8e7953333 dispatcher/trivial: rename variables for script directory to NMD_SCRIPT_DIR_* 2014-06-16 19:18:57 +02:00
Thomas Haller
afecbf1f66 device: refactor by combining dispatcher callback functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-16 19:18:57 +02:00
Thomas Haller
851be22146 core/trivial: move code
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-16 19:18:57 +02:00
Thomas Haller
524fc6d454 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-16 19:18:57 +02:00
Thomas Haller
332420ffec 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-16 19:18:57 +02:00
Thomas Haller
d041775501 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>
2014-06-16 13:27:26 +02:00
Jiří Klimeš
1553607223 man: clarify an nmcli example for adding static addresses in nmcli-examples 2014-06-16 12:48:04 +02:00
Dan Williams
7545db508f merge: some settings plugin refcounting and use-after-free fixes (bgo #731534) 2014-06-13 15:32:10 -05:00
Dan Williams
c44556a1d5 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:19:13 -05:00
Dan Williams
72fb1f897f 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:18:47 -05:00
Dan Williams
95e4b6fc1e 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:18:47 -05:00
Dan Williams
3aedc94fa6 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:18:47 -05:00
Thomas Haller
f0cd5bb866 vpn: fix printf format string for PID by casting to (long)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-13 16:58:44 +02:00
Dan Winship
f4f4ecf159 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.
2014-06-12 17:13:56 -04:00
Dan Winship
3c13d9e3fd 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.
2014-06-12 17:13:56 -04:00
Thomas Haller
9f114f661a 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>
2014-06-12 14:58:48 +02:00
Swapnil Nagarkar
2e3523bb43 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>
2014-06-12 14:29:13 +02:00
Jiří Klimeš
948a27257a 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
2014-06-12 13:52:45 +02:00
Yegor Yefremov
c62639d572 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>
2014-06-11 18:53:13 +02:00
Jiří Klimeš
9ee3ac20b0 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
2014-06-11 10:44:18 +02:00
Jiří Klimeš
e70d5579af cli: don't accept prefix 0 for routes 2014-06-11 10:07:02 +02:00
Jiří Klimeš
4e9fc8ad61 cli: don't accept default route entries, NM handles the default route itself 2014-06-11 09:58:44 +02:00
Jiří Klimeš
700f5ec0ef cli: allow missing next hop for routes (bgo #727615)
https://bugzilla.gnome.org/show_bug.cgi?id=727615
2014-06-11 09:58:39 +02:00
Dan Williams
e8fb3864d1 examples: add Python D-Bus and GI examples for updating IPv4 setting method 2014-06-10 16:20:35 -05:00
Dan Winship
cdd09286d7 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
2014-06-10 09:14:48 -04:00
Dan Williams
7c256586da 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:45:29 -05:00
Jiří Klimeš
3dccef6631 contrib/rpm: update NetworkManager description in spec file
Text by dcbw.
2014-06-09 11:07:00 +02:00
Jiří Klimeš
1b55014468 libnm-util: don't append NULL in g_string_append() 2014-06-09 10:36:54 +02:00
Jiří Klimeš
b4544182a2 examples: fix get-active-connections-dbus-glib.c example 2014-06-09 10:16:09 +02:00
Jiří Klimeš
a7eae7a553 trivial: typo in the NEWS 2014-06-09 09:15:40 +02:00
Thomas Haller
63ef089f69 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>
2014-06-07 11:35:22 +02:00
Thomas Haller
b633711572 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>
2014-06-07 11:19:02 +02:00
Thomas Haller
8366d7cd1b 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>
2014-06-07 11:18:51 +02:00
Thomas Haller
2af20f9389 release: bump version to 0.9.11.0 (development) 2014-06-07 02:09:00 +02:00