Commit graph

9884 commits

Author SHA1 Message Date
Thomas Haller
620c4956ec tui: fix inverted option "Require IPvX addressing for this connection"
https://bugzilla.redhat.com/show_bug.cgi?id=1108839

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 41a20a75a1)
2014-06-23 19:21:11 +02:00
Piotr Drąg
9c4b6d5a67 po: update Polish (pl) translation (bgo #732013)
https://bugzilla.gnome.org/show_bug.cgi?id=732013

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit f5681d15ba)
2014-06-23 12:16:36 +02:00
Dan Williams
63b0a2f5e6 release: bump version to 0.9.9.98 (0.9.10-rc1) 2014-06-20 19:04:26 -05:00
Dan Winship
0d795789f5 libnm-util: various NMSetting* property doc fixes/improvements
Fix up various issues with the docs for the NMSetting properties, and
pull in text from the GParamSpec docs where the GParamSpec docs were
better (or contained information that is necessary in the context of
nm-settings.5).

Also, consistently wrap all of the doc comments to the same width (80
columns).

(cherry picked from commit e8577083ca)
2014-06-20 18:11:17 -05:00
Dan Winship
f2050d50c7 libnm-util: fix gtk-doc bugs in NMSetting* properties
Fix misused gtk-doc annotations and incorrectly-identified properties.

In particular, the upcoming introspection-based generate-settings-spec
expands macro and enum values, so if you use '%' where you should have
used '#', it will fail to find an expansion, and error out.

(cherry picked from commit 9de24b16e8)
2014-06-20 18:11:08 -05:00
Dan Winship
d4e67ceb18 libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", "InfiniBand" in docs
We made the UIs consistent last year, but missed the documentation.
Fix the docs to also consistently use "Wi-Fi" rather than "WiFi",
"Wifi", "wifi", or "WiFI"; "Ethernet" rather than "ethernet"; and
"InfiniBand" rather than "Infiniband".

(cherry picked from commit 8487a4490c)
2014-06-20 18:11:01 -05:00
Dan Williams
1b5804db9e examples: add Python dbus example indicating if WWAN is the default connection
(cherry picked from commit 5a4e42bc51)
2014-06-20 17:29:09 -05:00
Thomas Haller
2bd0098b68 dispatcher: suppress log warning when nm-dispatcher is disabled in systemd
When 'nm-dispatcher' is not running because its systemd service
'NetworkManager-dispatcher.service' is not enabled, any calls to the dispatcher
will fail with an error of typ DBUS_ERROR:DBUS_GERROR_REMOTE_EXCEPTION (32):

  "Unit dbus-org.freedesktop.nm-dispatcher.service failed to load: No such file or directory."

This clutters the logfile with warnings, although the user probably
disabled the service on purpose.

Special case this particular (recurring) failure and downgrade the warning
to debug level.

Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 0d45284aa7)
2014-06-20 17:28:56 -05:00
Dan Winship
5fabb4f2a5 wifi: fix WoWLAN detection
WoWLAN state has to be requested by phy, not by ifindex

Related: rh#1025009
(cherry picked from commit 73508704d8)
2014-06-20 17:28:48 -05:00
Dan Williams
ae841e0bd5 platform: merge branch 'th/bgo727382_platform_fix_addr_lifetime' (part 2)
https://bugzilla.gnome.org/show_bug.cgi?id=727382

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:26:39 -05:00
Thomas Haller
590c0d27e6 platform: extend nm_platform_ip_address_cmp_expiry() to handle addresses without timestamp
If the timestamp is set to zero, the to_string() functions treat the lifetime
as based on *now*. For nm_platform_ip_address_cmp_expiry() this makes no
sense, because there is no absolute exiry to compare. Instead compare
them as expire earlier then the other address.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:27 -05:00
Thomas Haller
60477f3f1c platform: modify address to_string() to show raw lifetime values
The "lifetime" part when printing an address in nm_platform_ip[46]_address_to_string()
is supposed to show the raw, internal values of the address.

We already have the "lft" and "pref" output that presents the expiries based on now.
These fields are already crafted to show what the user probably wants
to see when looking at debugging log. "lifetime" should not do any
special casing and just print the raw values.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:27 -05:00
Thomas Haller
1184cadc7d platform: handle unset address timestamp as *now* in to_string()
When printing an address in nm_platform_ip4_address_to_string()
and nm_platform_ip6_address_to_string() treat an unset @timestamp
as counting from @now.

This is useful, if you just have the remaining lifetime at hand
and want to print an address. In general it is not a good idea to
leave the timestamp not anchored to an absolute @timestamp.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:26 -05:00
Thomas Haller
2d37fedcd3 platform: set timestamp in platform addresses to last_update_time()
Previous patch 8310a039d8 modified
platform to set the timestamp of addresses always to 1.

So, when adding an address platform logging looked like:
  signal: address 4 added: 192.168.232.3/24 lft 2000sec pref 1000sec lifetime 12345-1[13344,14344] dev em1 src kernel

This is confusing in the log file and during debugging. Instead set the
timestamp to the last modification time of the address so that it will
look like:
  signal: address 4 added: 192.168.232.3/24 lft 2000sec pref 1000sec lifetime 12345-12345[1000,2000] dev em1 src kernel

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:26 -05:00
Thomas Haller
9980b9843c platform: fix off-by-two error converting lifetimes in _init_ip_address_lifetime()
When setting the timestamp to 1, we have to subtract(!) one second
from a_valid and a_preferred.

Due to this error, NM saw the lifetimes of addresses from system as two
seconds larger then the actual value.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:26 -05:00
Thomas Haller
225a199fd3 dhcp: nm_dhcp_dhclient_read_lease_ip_configs() must anchor the address lifetime at *now*
nm_dhcp_dhclient_read_lease_ip_configs() calculates the remaining time
until the address expires. It must anchor the lifetimes by setting the
@timestamp to nm_utils_get_monotonic_timestamp_s().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-20 17:22:26 -05:00
Thomas Haller
bbcaa8b925 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-20 17:22:26 -05:00
Thomas Haller
f6ef874f35 contrib/rpm: fix typo in spec file (wrong option --enable-teamdctl)
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit ca85ecd145)
2014-06-20 17:21:29 -05:00
Jiří Klimeš
258dcdbac7 cli: clarify nmcli description for route metric
(cherry picked from commit f227d25ed9)
2014-06-20 17:21:21 -05:00
Jiří Klimeš
497fb4cb94 cli: editor - do not print separator when printing one setting
(cherry picked from commit 7c41835203)
2014-06-20 17:20:15 -05:00
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