Commit graph

14099 commits

Author SHA1 Message Date
Thomas Haller 35c120ee15 doc: update CONTRIBUTING to no longer allow // FIXME comments
Most of our FIXME/TODO comments are already (rightly) /**/.
Just get rid of this non-obvious inconsistancy in our coding
style.
2016-02-04 17:59:05 +01:00
Beniamino Galvani b5a469a894 device: check nm_ip6_config_get_address_first_nontentative() argument
Since commit 9ff161b2a1 ("device: move have_ip6_address() to
nm_ip6_config_get_address_first_nontentative()") the IP configuration
argument of nm_ip6_config_get_address_first_nontentative() must be
non-NULL. Add checks where needed.

Fixes: 9ff161b2a1
2016-02-03 17:54:12 +01:00
Thomas Haller 05b34e11d6 contrib/rpm: update comment in 00-server.conf 2016-02-03 16:25:19 +01:00
Thomas Haller b4d1e3eb7b contrib/rpm: remove unneeded chkconfig and systemd-sysv requirements 2016-02-03 16:19:02 +01:00
Thomas Haller 5344a3297b contrib/rpm: remove unused 10-ibft-plugin.conf file
Fixes: 6f0036151f
2016-02-03 15:57:58 +01:00
Thomas Haller 6490dc154c contrib/rpm: add rpm_version in spec file
and rename realversion to real_version to follow the pattern.
2016-02-03 15:47:28 +01:00
Thomas Haller 455b981215 contrib/rpm: update comment for patches in spec file
We don't want to create backups of original files when
patching. Update the comment in the spec file to indicate
that.
2016-02-03 15:42:19 +01:00
Thomas Haller e6244814eb nmtst: add nmtst_add_test_func() helper to schedule tests with arguments 2016-02-03 15:27:52 +01:00
Thomas Haller 9fda0817ab nmtst: don't use G_STRLOC in test functions
Instead pass separate values for file and line. Otherwise, we create
a unique string for each occurance.
2016-02-03 13:34:38 +01:00
Thomas Haller 123747963a nmtst: improve test macros FAIL() and ASSERT()
Fail only printed a message to stderr and exited.
Instead, print it with g_error(), which also breaks
in the debugger and produces a core-dump.

Also, it constructed the message based on an unchecked
format string and constructed a format string dynamically.
Just don't do that.

Also add a comment that these macros are discouraged because
they are cumbersome to write (requiring a test-name and a failure
message).
2016-02-03 12:41:35 +01:00
Thomas Haller c510323368 all/tests: fix messages for ASSERT() macro
These places pass an invalid arguments for the given
format string. Fix them, by dropping the overly verbose
ASSERT() macro.
2016-02-03 12:37:43 +01:00
Jiří Klimeš 0f4ddf7882 po: update translations for "m[monitor]" -> "m[onitor]" change 2016-02-03 10:16:24 +01:00
Jiří Klimeš 1351b852f5 cli: fix nmcli help for 'monitor' command 2016-02-03 10:04:47 +01:00
Jiří Klimeš 3cb3fedef8 vpn-plugin-info: add description for @filename parameter 2016-02-03 09:58:16 +01:00
Thomas Haller 87dc14476b contrib/rpm: make build more configurable by using conditionals
Also add a new conditional "debug" to enable more assertions and
more logging, which is disabled by default.

Also add a conditional "test" to disable running the unit tests
(make check) while building the package.

http://rpm.org/wiki/PackagerDocs/ConditionalBuilds
2016-02-02 16:09:24 +01:00
Thomas Haller 3b01d25561 contrib/rpm: add --no-build option to build_clean.sh
Option to skip building the source package. Useful if you already
have a source tarball from a previous run.
2016-02-02 16:05:23 +01:00
Thomas Haller a75f358be5 device: merge branch 'th/device-ext-ip6-config-captured-bgo761371'
https://bugzilla.gnome.org/show_bug.cgi?id=761371
2016-02-02 11:53:44 +01:00
Thomas Haller 118a75fcde device: check ext_ip6_config_captured for ll_addr in dhcp6_start_with_link_ready()
We should not check ip6_config for the link local address because
ip6_config contains the merged settings we want to configure,
not the addresses that are actually configured on the device.
Check ext_ip6_config_captured for that.

Also, reuse nm_ip6_config_get_address_first_nontentative() which
only takes an address after it survived DAD.
2016-02-02 11:43:57 +01:00
Thomas Haller 9ff161b2a1 device: move have_ip6_address() to nm_ip6_config_get_address_first_nontentative() 2016-02-02 11:43:57 +01:00
Thomas Haller 5ff8decb8f device: add ext_ip6_config_captured to remember the last-read platform configuration
ext_ip6_config gets modified to only contain items that are configured
externally, not by internal choice.
2016-02-02 11:43:57 +01:00
Thomas Haller dfdce13cee core: add nm_ip6_config_new_cloned() function 2016-02-02 11:43:54 +01:00
Beniamino Galvani dc4d0a4200 device/team: fix tiny memory leak
Fixes: 10f9b6c58b
2016-02-01 22:26:05 +01:00
Thomas Haller f2879e1ba2 connectivity: implement nm_connectivity_state_to_string() as NM_UTILS_LOOKUP_STR_DEFINE_WARN() 2016-02-01 14:52:55 +01:00
Thomas Haller 174b25d98c utils: reimplement NM_UTILS_ENUM2STR_DEFINE() without helper function
The compiler might be able to optimize the switch better.
But more importantly, it has the type information of the enum
and can give warnings about unmentioned enum values.
2016-02-01 14:52:55 +01:00
Thomas Haller 72255b71d7 utils: pass entire return statement to NM_UTILS_LOOKUP_DEFINE() 2016-02-01 14:20:26 +01:00
Thomas Haller 572b60a203 utils: change _NM_UTILS_LOOKUP_DEFINE() to generate compiler warning about missing enum values
Don't implement a "default" case so that we get a compiler warning
about unused enum values.
2016-02-01 14:10:04 +01:00
Thomas Haller 2bf4960ec1 connectivity: fix calling parent dispose() 2016-02-01 13:24:52 +01:00
Thomas Haller da4ae74fff dns: don't add an IP-addresss-like hostname to the search domains
https://bugzilla.gnome.org/show_bug.cgi?id=761302
2016-02-01 10:20:50 +01:00
GunChleoc 4441dbf3f3 po: add Gaelic (gd) translation (bgo #761282)
https://bugzilla.gnome.org/show_bug.cgi?id=761282
2016-01-31 22:14:47 +01:00
Piotr Drąg 9cbf3be779 po: update Polish (pl) translation (bgo #761367)
https://bugzilla.gnome.org/show_bug.cgi?id=761367
2016-01-31 19:19:22 +01:00
Thomas Haller f04e554f08 dnsmasq-manager: lazy create debug logging string
The logging macros evaluate their arguments only when necessary.
This saves creating the message in case debug logging is disabled.
2016-01-30 19:26:43 +01:00
Dan Williams d442dcd174 platform: ignore permanent MAC addresses of all ones (FF:FF:FF:FF:FF:FF)
Drivers are stupid, and just like the platform ignores an all zeros
permanent address, so should it ignore all ones.

NetworkManager[509]: <debug> [1453743778.854919] [devices/nm-device.c:8885] nm_device_update_hw_address(): [0x190370] (eth0): hardware address now 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.855438] [devices/nm-device.c:9138] constructed(): [0x190370] (eth0): read initial MAC address 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.861602] [devices/nm-device.c:9148] constructed(): [0x190370] (eth0): read permanent MAC address FF:FF:FF:FF:FF:FF
2016-01-29 17:37:39 -06:00
Dan Williams 2d1638bba9 core,dhcp: look for IPv6LL address in composite config
It will only be in ext_ip6_config if it was added by the kernel,
which isn't usually the case since NM handles IPv6LL address
generation on new enough kernels.

If the LL address isn't found, IPv6 configuration will never
complete because DHCPv6 was started already but lack of an LL
address bails out early without handling the error.

Fixes: b8c2fc26c1
2016-01-29 16:00:54 -06:00
Thomas Haller c2709eac40 ifcfg-rh/tests: fix variable scope for test arguments
The @read_wired_static array is passed on as test function. But defining
it in a local scope is strictly speaking not correct because the lifetime
of the array ends before the test run. Move it to the outer scope, which
exists during the test runs.
2016-01-29 20:22:28 +01:00
Thomas Haller a76a1abb49 ifcfg-rh/tests: fix test after changing behavior for setting NM_SETTING_IP_CONFIG_GATEWAY
Since commit bb868770, setting a gateway of "0.0.0.0"
or "::" in NMSettingIPConfig means to set the gateway
to NULL. There is indeed no difference between an unset
gateway and an any gateway. This change was done to have
a consistent behavior in NMSettingIPConfig.

Fixes: bb86877031
2016-01-29 20:22:28 +01:00
Lubomir Rintel 60b7ed3bdc ifcfg,keyfile: fix temporary file races (CVE-2016-0764)
Two of these raised Coverity's eyebrows.

CID 59389 (#1 of 1): Insecure temporary file (SECURE_TEMP)
5.  secure_temp: Calling mkstemp without securely setting umask first.

CID 59388 (#1 of 1): Insecure temporary file (SECURE_TEMP)
1.  secure_temp: Calling mkstemp without securely setting umask first.

Last one raised mine.

When a connection is edited and saved, there's a small window during which and
unprivileged authenticated local user can read out connection secrets (e.g. a
VPN or Wi-Fi password). The security impact is perhaps of low severity as
there's no way to force another user to save their connection.
2016-01-29 20:18:28 +01:00
Lubomir Rintel 503b714f15 wext: avoid division by zero
Coverity is angry:

CID 59367 (#1-3 of 3): Division or modulo by float zero (DIVIDE_BY_ZERO)
30. divide_by_zero: In expression
  ((double)max_level - (double)level) /
  ((double)max_level - (double)noise),
division by expression (double)max_level - (double)noise which may be zero has
undefined behavior.
2016-01-29 20:18:22 +01:00
Lubomir Rintel 9b85179840 fake-platform: check link_get return
Can not fail no fake platform, but makes Coverity worried:

CID 59381 (#1 of 1): Dereference null return value (NULL_RETURNS)
6.  dereference: Dereferencing a null pointer device.
2016-01-29 20:18:22 +01:00
Lubomir Rintel a77ec45110 ifcfg: make Coverity happy
CID 59382 (#1 of 1): Dereference null return value (NULL_RETURNS)
10.  dereference: Dereferencing a pointer that might be null value
when calling strcmp.

Not exactly true, since we ruled out the posibility earlier; but
we could still get rid of a couple of strcmps.
2016-01-29 20:18:21 +01:00
Thomas Haller 301c747938 settings: coding style and use gs_free in write_hostname() 2016-01-29 17:36:27 +01:00
Joel Holdsworth 55a07b4ca4 settings: resolve path if hostname is a sym-link
If the hostname file is a symbolic link, follow it to find where the
real file is located, otherwise g_file_set_contents will attempt to
replace the link with a plain file.

https://mail.gnome.org/archives/networkmanager-list/2016-January/msg00061.html
https://mail.gnome.org/archives/networkmanager-list/2016-January/msg00073.html
2016-01-29 17:33:48 +01:00
Thomas Haller 17c5e4ec65 device: don't iterate over a va_list more then once
Calling va_start() (with va_end()) in between seems to work and
is done by systemd and other code occasionally.

However, it's not clear that this really works on every architecture.
So just replace thise one instance with a different implementation
by passing the arguments as an array.
2016-01-29 14:29:28 +01:00
Thomas Haller bb86877031 libnm-core: cleanup handling IP address in NMIPRoute
The change to canonicalize_ip() has actually no effect
because all callers that pass null_any==TRUE, ensure
already that they don't pass NULL.
2016-01-29 13:49:27 +01:00
Thomas Haller 862be319a8 libnm-core: use utility function in NMIPRoute for getting size of addresses per family 2016-01-28 21:15:59 +01:00
Thomas Haller 0ba4322eec libnm-core: ensure any next_hop in NMIPRoute is NULL
NMIPRoute has the convention that a next-hop 0.0.0.0/:: is stored
as NULL. However, the binary setters could violate that.
2016-01-28 21:15:59 +01:00
Dan Williams 91f06323c7 examples: avoid compile errors around NM versioning 2016-01-28 12:27:14 -06:00
Dan Williams 1cf4727766 wwan: retry connect on some errors and save them for log messages
First, cb751012a2 mistakenly converted the
act_stage_context_step() in connect_ready() to connect_context_clear()
instead of connect_context_step().  This would cause the IP Type retry
logic to fail and no further types to be tried.  It also throws
away the ctx->first_error and causes all errors that MM returns on the
connect attempt to be dropped on the floor.

Second, not all errors should cause an advance to the next IP Type,
since some errors aren't related to it.  Specifically, MM_CORE_ERROR_RETRY
when using Simple.Connect() means that a timeout was reached
in the internal connect logic, not a modem or network error.  In
that case, try the connect again with the same IP Type before advancing
to the next type.

Fixes: cb751012a2

Tested-by: Ladislav Michl <ladis@linux-mips.org>
Tested-by: Tore Anderson <tore@fud.no>
2016-01-28 12:25:47 -06:00
Lubomir Rintel 061edeaea6 vpn-service-plugin: allow VPNs with no IP configuration
Perfectly fine for ethernet-bridged networks (openvpn with tap devices).
2016-01-28 11:50:15 +01:00
Lubomir Rintel 8e3a5f6d3a vpn-connection: try completing the connection when plugin sends config
In case there's no IP configuration we wan the connection to succeed,
not time out.
2016-01-28 11:50:15 +01:00
Michael Biebl 06dbbb899c tests: fix tests for nm_utils_kill_child() by using "bash"
Seems that "dash" has issues with trap EXIT. This causes
test failures on systems where the default shell is not "bash".

[thaller@redhat.com: patch extracted from BZ and modified to
 use bash everywhere]
https://bugzilla.gnome.org/show_bug.cgi?id=761146
2016-01-28 10:07:44 +01:00