Commit graph

5676 commits

Author SHA1 Message Date
Thomas Haller
cea32bd0dc core: fix memleak in NMDBusManager:private_server_new()
(cherry picked from commit 96b8b99c7d)
2015-03-13 11:50:50 +01:00
Dan Williams
c505658815 ifcfg-rh: fix memleak in test-ifcfg-rh.c
(cherry picked from commit ad90f2f0ea)
2015-03-13 11:50:50 +01:00
Dan Williams
33264396c9 tests: fix memleaks in test-wifi-ap-utils.c
(cherry picked from commit 51b3540ae4)
2015-03-13 11:50:50 +01:00
Lubomir Rintel
411fa7d002 test: initialize auto-destructed pointers
Otherwise the compiler complains that they could be left uninitialized in case
the function returns too early.

Fixes: 76745817c3
(cherry picked from commit 2981839bde)
2015-03-13 11:50:50 +01:00
Thomas Haller
b9a8f3c059 tests: enable valgrind tests for tests
(cherry picked from commit c50f30e79c)
2015-03-13 11:50:04 +01:00
Thomas Haller
c2cd7e631f platform/tests: reenable valgrind tests
valgrind tests for platform were wrongly disabled.

Fixes: e3784fa618
(cherry picked from commit 6853d07f05)
2015-03-13 11:50:04 +01:00
Thomas Haller
692619ea89 supplicant/tests: fix memleaks in test code for valgrind
(cherry picked from commit 624aa51614)
2015-03-13 11:50:04 +01:00
Thomas Haller
12ee98f471 dhcp/tests: fix memleaks in test code for valgrind
(cherry picked from commit d74a3d0a02)
2015-03-13 11:50:04 +01:00
Thomas Haller
4f685b4310 config/tests: fix memleak in test code for valgrind
(cherry picked from commit 63f5a22ad7)
2015-03-13 11:50:04 +01:00
Thomas Haller
a369923d03 device: refactor dispose/cleanup of NMDevice to free members in finalize
NMTestDevice does not invoke dispose(), hence it leaks memory which causes
false warnings in testing.
Some minor refactring to let dispose() clear the fields, but free it
later in finalize(). This avoids memleaks in the NMTestDevice stub.

(cherry picked from commit a82d94a64e)
2015-03-13 11:50:04 +01:00
Thomas Haller
e25d06cf71 ifcfg-rh/tests: fix memleaks in test code for valgrind
(cherry picked from commit 0750d934bf)
2015-03-13 11:50:04 +01:00
Thomas Haller
72666156e3 ibft/tests: fix memleaks in test code for valgrind
(cherry picked from commit fbe8c0ed87)
2015-03-13 11:50:04 +01:00
Thomas Haller
f334c4a7f1 keyfile/tests: fix memleaks in test code for valgrind
(cherry picked from commit 9a2f2ed7fd)
2015-03-13 11:50:04 +01:00
Thomas Haller
b352d0a26b core/tests: fix memleak in tests to avoid valgrind warnings
(cherry picked from commit 1680bf3ad1)
2015-03-13 11:50:04 +01:00
Thomas Haller
84ff53ec76 dhcp: fix memleak in process_dhclient_rfc3442_route()
(cherry picked from commit 1935fca09a)
2015-03-13 11:50:04 +01:00
Thomas Haller
825eb5cb62 ifcfg-rh: fix memleak in write_ip4_aliases() and assert against overflow
(cherry picked from commit a9bfe9f4bb)
2015-03-13 11:50:04 +01:00
Thomas Haller
273576b01c ifcfg-rh: fix memleaks in reader
(cherry picked from commit 53796f0beb)
2015-03-13 11:50:04 +01:00
Thomas Haller
856962cea8 ifcfg-rh: fix memleak due to make_wpa_setting() returning both wsec and error
==10501== 353 (32 direct, 321 indirect) bytes in 1 blocks are definitely lost in loss record 1,579 of 1,641
    ==10501==    at 0x7EE3728: g_type_create_instance (gtype.c:1847)
    ==10501==    by 0x7EC75B4: g_object_new_internal (gobject.c:1746)
    ==10501==    by 0x7EC945C: g_object_newv (gobject.c:1890)
    ==10501==    by 0x7EC9C23: g_object_new (gobject.c:1556)
    ==10501==    by 0x1CD87C: nm_setting_wireless_security_new (nm-setting-wireless-security.c:122)
    ==10501==    by 0x16F70B: make_wpa_setting (reader.c:3010)
    ==10501==    by 0x16F33F: make_wireless_security_setting (reader.c:3188)
    ==10501==    by 0x161F4C: wireless_connection_from_ifcfg (reader.c:3464)
    ==10501==    by 0x16109A: connection_from_file_full (reader.c:4763)
    ==10501==    by 0x1614EE: connection_from_file_test (reader.c:4862)
    ==10501==    by 0x13D1D6: test_read_wifi_wpa_psk_unquoted2 (test-ifcfg-rh.c:4316)
    ==10501==    by 0x1281FD: main (test-ifcfg-rh.c:12513)
    ==10501==

(cherry picked from commit fcfd8f487a)
2015-03-13 11:50:04 +01:00
Thomas Haller
2ceea73dc3 ifcfg-rh: fix memleak in svSetValue()
(cherry picked from commit 98a0299265)
2015-03-13 11:50:04 +01:00
Thomas Haller
3e1055d141 ibft: fix memleak in read_ibft_blocks()
(cherry picked from commit 494c5c395d)
2015-03-13 11:50:04 +01:00
Thomas Haller
410a22b28f keyfile: fix memleak in parity_parser()
(cherry picked from commit 9d8f93384a)
2015-03-13 11:50:03 +01:00
Thomas Haller
74d44dd563 config: fix memleak in read_config()
(cherry picked from commit b49fdae59e)

Conflicts:
	src/nm-config.c
2015-03-13 11:50:03 +01:00
Dan Williams
6e77c1ba2f device: don't assume valid ip4/ip6 config in nm_device_get_ipX_route_metric()
These functions will sometimes get called on updates to the device's IP
config due to external changes, or when addresses get flushed from the
device when activating it.  If the device is a slave device, then at
this point its NMConnection won't have an IP settings.  Suppress the
warning that gets printed when s_ip == NULL, because it's expected.

(cherry picked from commit d2de83e0f7)
2015-03-12 15:06:40 -05:00
Dan Williams
a8833a4dbd device: fix handling if DHCP hostname for configure-and-quit
Fixes: 5149fd120d
(cherry picked from commit 1dae47e9cc)
2015-03-12 14:38:58 -05:00
Thomas Haller
06b3e3ae6b settings: update year in copyright text of plugin-info for keyfile and ifcfg-rh
(cherry picked from commit 4475f59bce)
2015-03-11 17:07:56 +01:00
Thomas Haller
76ee139107 ifcfg-rh: don't reload connection in connection_ifcfg_changed() if monitoring is not enabled
This was not really an error, because NMIfcfgConnection would not
watch the files if monitoring is not enabled. Still do it, because
it feels more correct.

(cherry picked from commit 236226a590)
2015-03-11 17:07:56 +01:00
Thomas Haller
581caca9f2 ifcfg-rh: refactor update_connection()
Make update_connection() analogous to keyfiles implementation.
Effectively merge _internal_new_connection() and update_connection()
-- previously connection_new_or_changed().

https://bugzilla.redhat.com/show_bug.cgi?id=1171751
(cherry picked from commit 0c6349c627)
2015-03-11 17:07:56 +01:00
Thomas Haller
4b5d3f160d ifcfg-rh: sort paths in read_connections()
Presort the files in read_connections() as we do it
for keyfile.

This alone has not much consequences. Do this patch first, to
keep the next patches more self-contained.

(cherry picked from commit 0cf00ff3aa)
2015-03-11 17:07:56 +01:00
Thomas Haller
d6bd8cc496 ifcfg-rh/trivial: rename connection_new_or_changed() and variable
The ifcfg-rh implementation should be similar to the one from keyfile.
Rename the variables and function that have the same meaning.
Do this trivial commit first, before starting refactoring.

(cherry picked from commit a609dd12d3)
2015-03-11 17:07:56 +01:00
Thomas Haller
0516b55de2 ifcfg-rh: add logging macros _LOGX() to plugin.c
(cherry picked from commit bbaa243e31)
2015-03-11 17:07:55 +01:00
Thomas Haller
7510e67f0a settings: avoid duplicate UUID in settings
When adding a connection to NMSettings we did not check for
duplicate connection UUIDs (which could for example happen
if two different plugins report a conflicting UUID).
Also, we would not check that an already added connection
changes it's UUID.

Both could lead to have duplicate connections (by UUID).

Avoid that two ways:
- when adding a connection to NMSettings, ensure that we don't add
  a conflicting UUID. Otherwise just bail out and do nothing.
- when modifying a connection that is already added to NMSettings,
  enforce that the UUID cannot change. Otherwise fail with error.

For ifcfg-rh plugin this situation still can happen during reload.
In this case error out and refuse to update the connection. After
all, the user configured invalid UUIDs.

https://bugzilla.redhat.com/show_bug.cgi?id=1171751
(cherry picked from commit 7b807b11cc)
2015-03-11 17:07:55 +01:00
Thomas Haller
6cd264b0d5 keyfile: ignore GFileMonitor change flags in dir_changed()
When writing a file (for example with `sed -i`) a temporary file
might be created and removed quickly. This causes spurious events
in dir_changed().

(cherry picked from commit 8ba8a55cfa)
2015-03-11 17:07:55 +01:00
Thomas Haller
8c97626918 keyfile: reuse duplicate check from update_connection() in add_connection()
Also during add_connection() we must take special care of not "adding" a
connection with a conflicting UUID. In that case we want to fallback to
"update".

update_connection() already does all the checks, so call
update_connection() from add_connection().

(cherry picked from commit db5c4ce64f)
2015-03-11 17:07:55 +01:00
Thomas Haller
84353078c1 keyfile: cleanup logging
Log lines with a "keyfile:" prefix and show more information about
the loaded connection. Especially printing the UUID is interesting.

(cherry picked from commit 5c2fa92099)
2015-03-11 17:07:55 +01:00
Thomas Haller
1b0fd9fae0 keyfile: read_connections() must skip duplicate connections
If there are keyfiles with duplicate UUIDs, read_connections()
would iterate over the files, loading them as they appear and
overwriting duplicate connections that were just loaded.

For example, have keyfiles 'A' and 'B' with the same UUID.
On start, NM might first load 'A', then 'B'. 'B' would replace the
content of 'A' which was just loaded.
On reload, NM would first overwrite 'B' with 'A', and then again
overwriting 'A' with 'B'.

Fix that by accept the first found connection and don't overwrite
it during the same read_connections() run.

Also sort the files by file modification timestamp so that we
get a reproducible and sensible behavior.

(cherry picked from commit 8a4e64c6aa)
2015-03-11 17:07:55 +01:00
Thomas Haller
b21d0b68fe keyfile: merge update_connection() and new_connection()
new_connection() and update_connection() are very similar as both
must anticipate collisions of UUIDs.

When reloading a connection (update_connection(), previously), the loaded
connection for a certain path might actually replace another existing
connection. In this case, the old connection must be removed, and
the existing one updated instead.
If reloading a connection changes the UUID to a new value, the old
connection must be removed likewise and a new connection added.

Merge both functions into update_connection().

(cherry picked from commit c2fcb680f8)
2015-03-11 17:07:55 +01:00
Thomas Haller
09e88d1d45 keyfile/trival: move code
(cherry picked from commit f41586f00c)
2015-03-11 17:07:55 +01:00
Thomas Haller
6f5c18f8fa keyfile: simplify g_return() checks for _internal_write_connection()
(cherry picked from commit fbd30c7dd2)
2015-03-11 17:07:55 +01:00
Thomas Haller
2e0293cc81 settings: log connection diffs in replace_settings only where appropriate
Only log connection diffs when we update a connection that we actually
care about.

Note that most plugin specific connections use
nm_settings_connection_replace_settings() in their constructor
to initialize themselves. These occurrences are not interesting
and spam the logfile.

(cherry picked from commit e14ea6818a)
2015-03-11 17:07:55 +01:00
Thomas Haller
857b5bc345 settings: no need to check nm_connection_compare() before nm_settings_connection_replace_settings()
nm_settings_connection_replace_settings() does nothing, if there are no changes.

(cherry picked from commit 750f01dfcb)
2015-03-11 17:07:55 +01:00
Thomas Haller
d0283bc9e6 settings: fix wrong assertions for calling nm_settings_connection_replace_settings()
(cherry picked from commit c2dc5d3b0f)
2015-03-11 17:07:55 +01:00
Thomas Haller
46e2e11a69 core: log object type in nm_utils_log_connection_diff()
(cherry picked from commit 73703c4d19)
2015-03-11 17:07:55 +01:00
Thomas Haller
fdacbe8ddd core: log ignored property notification with level TRACE
Avoids for example:
  notify(): ignoring notification for prop visible on type NMKeyfileConnection

(cherry picked from commit 45094c71d8)
2015-03-11 17:07:55 +01:00
Dan Williams
ad7ea00c81 core: quit if manager startup completed before starting the mainloop
(cherry picked from commit a5891299b9)
2015-03-11 09:29:32 -05:00
Lubomir Rintel
fe9dada57a route-manager: refactor: a readability improvement
(cherry picked from commit 6c5d93b847)

Conflicts:
	src/nm-route-manager.c
2015-03-09 14:27:44 +01:00
Lubomir Rintel
435632a757 platform: fix route addition ordering
(cherry picked from commit 47167cab4f)
2015-03-09 14:26:13 +01:00
Thomas Haller
ae500e4ee0 wwan: refactor nm_modem_ip_type_to_string() and fix return type
The statement
    g_return_val_if_reached (NM_MODEM_IP_TYPE_UNKNOWN);
was wrong, because the return type is 'const char *'.

But just refactor nm_modem_ip_type_to_string() to get rid of
the static table and make it a switch statement.

Fixes: 02beeeeb12

(cherry picked from commit 5599a82d0d)
2015-03-05 12:55:04 +01:00
Dan Williams
a7323ab2cc dhclient: use fqdn.fqdn for server DDNS updates
dhclient only supports fqdn.fqdn for server DDNS updates with
DHCPv6.  And even though the underlying DHCP options that fqdn.fqdn
controls allow non-qualified hostnames on the wire, dhclient does
not.  So we must require a fully-qualified name for DHCPv6.

Second, while no-client-updates seems like it should be "off", doing
that apparently makes dhclient set the "O" flag to 1 which appears to
be a bug, and results in the server not doing the DDNS update.  So
we must stop setting that option too.

Found by: Alexander Groß

(cherry picked from commit 677cee0f23)
2015-02-27 10:06:25 -06:00
Aleksander Morgado
2a4b785925 wwan: indentation & alignment fixes 2015-02-24 16:15:27 -06:00
Aleksander Morgado
02beeeeb12 wwan: new retry logic when ipv4=auto and ipv6=auto
When ipv4=auto and ipv6=auto, we'll first try with the IPv4v6 PDP type, and if
that fails (e.g. if either the modem or the operator doesn't support it), we'll
fallback to trying with IPv4 or IPv6 PDP types (only if may-fail configuration
allows it).

Patch based on a previous implementation by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=733696
2015-02-24 16:15:27 -06:00