Commit Graph

7207 Commits

Author SHA1 Message Date
Thomas Haller
f892ac4f45 core/trivial: remove semicolon from macro
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 15:19:05 +01:00
Lubomir Rintel
892602c912 device: Don't delete the link if a re-activation is scheduled 2014-11-07 14:26:41 +01:00
Lubomir Rintel
842648a992 team: Don't let teamd rip off the link when it terminates
We might be reactivating a connection on the device and don't want it to go
away. In other cases we still take care of the link deletion ourselves.
2014-11-07 14:26:41 +01:00
Jiří Klimeš
8e99b44f08 dhcp: fix building without sys/auxv.h 2014-11-07 13:57:40 +01:00
Dan Winship
e374923bbe all: allow route metrics to be "0"
Change NMIPRoute to use "-1" for "default", so that "0" is a valid
metric. Update everything for that.
2014-11-07 07:49:41 -05:00
Dan Winship
d16905df63 libnm-core, libnm, core: add AddressData and RouteData properties
Add AddressData and RouteData properties to NMSettingIPConfig and
NMIP[46]Config. These are like the existing "addresses" and "routes"
properties, but using strings and containing additional attributes,
like NMIPAddress and NMIPRoute.

This only affects the D-Bus representations; there are no API changes
to NMSettingIP{,4,6}Config or NMIP{4,6}Config as a result of this; the
additional information is just added to the existing 'addresses' and
'routes' properties.

NMSettingIP4Config and NMSettingIP6Config now always generate both
old-style data ('addresses', 'address-labels', 'routes') and new-style
data ('address-data', 'gateway', 'route-data') when serializing to
D-Bus, for backward compatibility. When deserializing, they will fill
in the 'addresses' and 'routes' properties from the new-style data if
it is present (ignoring the old-style data), or from the old-style
data if the new-style isn't present.

The daemon-side NMIP4Config and NMIP6Config always emit changes for
both 'Addresses'/'Routes' and 'AddressData'/'RouteData'. The
libnm-side classes initially listen for changes on both properties,
but start ignoring the 'Addresses' and 'Routes' properties once they
know the daemon is also providing 'AddressData' and 'RouteData'.
2014-11-07 07:49:40 -05:00
Dan Winship
f17699f4e3 libnm-core: add NMSettingIPConfig:gateway, drop NMIPAddress:gateway
The gateway is a global property of the IPv4/IPv6 configuration, not
an attribute of any particular address. So represent it as such in the
API; remove the gateway from NMIPAddress, and add it to
NMSettingIPConfig.

Behind the scenes, the gateway is still serialized along with the
first address in NMSettingIPConfig:addresses, and is deserialized from
that if the settings dictionary doesn't contain a 'gateway' key.

Adjust nmcli's interactive mode to prompt for IP addresses and gateway
separately. (Patch partly from Jirka Klimeš.)
2014-11-07 07:49:40 -05:00
Dan Winship
329791ad55 all: stop pretending to support multiple "gateway"s
NMSettingIP[46]Config let you associate a gateway with each address,
and the writable settings backends record that information. But it
never actually gets used: NMIP4Config and NMIP6Config only ever use
the first gateway, and completely ignore any others. (And in the
common usage of the term, an interface can only have one gateway
anyway.)

So, stop pretending that multiple gateways are meaningful; don't
serialize or deserialize gateways other than the first in the
'addresses' properties, and don't read or write multiple gateway
values either.
2014-11-07 07:49:40 -05:00
Dan Winship
35f6264745 core, clients: implement dhcp-send-hostname for IPv6
Now that NMSettingIP6Config inherits the dhcp-send-hostname property
from NMSettingIPConfig, fix things up so that it actually gets used.

(Note that this changes behavior: previously if ip6.dhcp-hostname was
unset, no hostname would be sent. Now, the system hostname will be
set. Also, ifcfg-rh does not currently support this property, so there
is no way to disable this...)
2014-11-07 07:49:40 -05:00
Dan Winship
3f30c6f1c2 libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classes
Split a base NMSettingIPConfig class out of NMSettingIP4Config and
NMSettingIP6Config, and update things accordingly.

Further simplifications of now-redundant IPv4-vs-IPv6 code are
possible, and should happen in the future.
2014-11-07 07:49:40 -05:00
Dan Winship
39709fdc2e libnm-core: add NMIPAddress/NMIPRoute attributes, use for labels
Add key-value attributes to NMIPAddress and NMIPRoute, and use them to
store IPv4 address labels. Demote NMSettingIP4Config:address-labels to
a D-Bus-only property, and arrange for :addresses setter to read the
labels out of that property when creating the addresses.
2014-11-07 07:49:40 -05:00
Dan Winship
21c8a6b20e libnm-core, all: merge IPv4 and IPv6 address/route types
Merge NMIP4Address and NMIP6Address into NMIPAddress, and NMIP4Route
and NMIP6Route into NMIPRoute. The new types represent IP addresses as
strings, rather than in binary, and so are address-family agnostic.
2014-11-07 07:49:40 -05:00
Thomas Haller
5bcd54ad82 vpn: fix cleanup of connection timeout in maybe_complete()
Fixes: a966a5e8b5
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 13:44:00 +01:00
Thomas Haller
57133a389f dhcp/test: fix compiler warning about pointer arithmetric for void*
clang warns:

    make[4]: Entering directory `./NetworkManager/src/dhcp-manager/tests'
      CC       test-dhcp-utils.o
    test-dhcp-utils.c:684:2: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wpointer-arith]
            COMPARE_ID (nothex, TRUE, nothex, strlen (nothex));
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test-dhcp-utils.c:667:23: note: expanded from macro 'COMPARE_ID'
                    g_assert (memcmp (p + 1, expected, expected_len) == 0); \
                                      ~ ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 12:38:12 +01:00
Thomas Haller
890fff4be7 dhcp: fix swapped order of argument for logging function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 12:33:18 +01:00
Lubomir Rintel
b1550df6f5 sd-dhcp-client: Add missing initializers
Missing initializers together with automatic cleanup seem to annoy GCC's
-Werror=maybe-uninitialized, breaking the --enable-more-warnings=error
builds.
2014-11-07 12:02:27 +01:00
Dan Williams
d2dd3b2c90 dhcp: add systemd-based "internal" DHCP client
We must also remove -Waggregate-return from m4/compiler-warnings.m4 because systemd
uses aggregate return (correctly) in a couple cases, and we cannot keep single-level
makefiles and override aggregate-return only for the systemd sub-library.

This client currently only supports DHCPv4 because the base systemd code
does not yet fully support DHCPv6.
2014-11-06 22:42:43 -06:00
Dan Williams
3c34f1d92f dhcp: add nm_dhcp_utils_client_id_string_to_bytes()
Generic function to convert a DHCP client identifier string in either
hex form ("aa:bb:cc") or string form ("blahblah") to bytes.
2014-11-06 21:58:32 -06:00
Dan Williams
cd12e97620 dhcp: systemd DHCP code changes necessary for NM integration
Random functionality that's necessary for our use of the library.
2014-11-06 21:58:32 -06:00
Dan Williams
1b1222ffdf dhcp: make systemd DHCP code into a library
The systemd code was modified to add "#if 0 /* NM_IGNORED */"
around lines that cause problems for compilation or code that is
not actually used in the library.

An adaptation layer (nm-sd-adapt) was added for glue between
systemd functions and NetworkManager, but changes to the actual
systemd code have been kept to a minimum.

The sd_event/sd_event_source functions of systemd have been
re-implemented on top of the GLib main loop.
2014-11-06 21:58:32 -06:00
Thomas Haller
78539e5ad6 dhcp: fix compiler warning in IN_SET macro
clang warns:

    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
            assert_return (IN_SET(client->state, DHCP_STATE_INIT,
                           ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:376:17: note: expanded from macro 'IN_SET'
                    const typeof(_y) _x = (x);                              \
                    ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:47: note: expanded from macro 'IN_SET'
                    for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                  ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:91: note: expanded from macro 'IN_SET'
                    for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                                                              ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^
    dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:380:31: note: expanded from macro 'IN_SET'
                            if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
                                  ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                    if (_unlikely_(!(expr))) {                              \
                                     ^
    ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
    #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                               ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-06 21:36:03 -06:00
Dan Williams
9c3dbb0268 sd-dhcp-client: fix REBOOT state handling
client->secs wasn't getting set in the REBOOT state, causing
an assertion.  REBOOT should work the same way as INIT, per
RFC 2131:

   secs          2  Filled in by client, seconds elapsed since client
                    began address acquisition or renewal process.

REBOOT is necessary because many DHCP servers (especially on
home routers) do not hand back the same IP address when in
response to a DISCOVER packet, even if the same client ID is used.
2014-11-06 21:36:03 -06:00
Dan Williams
389daa38f7 sd-dhcp-client: clean up raw socket sd_event_source when creating UDP source
The raw socket sd_event_source used for DHCP server solicitations
was simply dropped on the floor when creating the new UDP socket
after a lease has been acquired.  Clean it up properly so we're
not still listening and responding to events on it.
2014-11-06 21:36:03 -06:00
Dan Williams
d0bb1592f6 sd-dhcp-lease: expose load/save functions
They're useful outside of networkd itself.
2014-11-06 21:36:03 -06:00
Dan Williams
0c14c88745 sd-dhcp-lease: load/save client ID
The lease is intimately tied to the client ID in use, so when loading
and renewing a lease, the same client ID should be used.
2014-11-06 21:36:03 -06:00
Dan Williams
7c9db27a2e sd-dhcp-client: support custom client IDs
Non-ethernet interface types use different client identifier formats,
plus when doing DHCPv4 and DHCPv6 on the same interface, the client
identifier should be related per RFC 4361.  Thus let the caller
override the existing MAC-based client identifier if necessary.
2014-11-06 21:36:03 -06:00
Dan Williams
20462b5095 dhcp: add systemd DHCP code
This is a direct dump from systemd git on 2014-10-28, git commit
c4ac990007.  Only relevant files were included.

    SYSTEMD_DIR=../systemd
    COMMIT=c4ac990007cd0069bb7e76ec15dd731320f382fd

    mkdir -p ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/
    mkdir -p ./src/dhcp-manager/systemd-dhcp/src/shared/
    mkdir -p ./src/dhcp-manager/systemd-dhcp/src/systemd/

    (
       cd "$SYSTEMD_DIR"
       git checkout "$COMMIT"
       git clean -fdx
    )
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/dhcp-manager/systemd-dhcp/src/shared/async.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/dhcp-manager/systemd-dhcp/src/shared/list.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/dhcp-manager/systemd-dhcp/src/shared/macro.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/dhcp-manager/systemd-dhcp/src/shared/refcnt.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/socket-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/dhcp-manager/systemd-dhcp/src/shared/sparse-endian.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/dhcp-manager/systemd-dhcp/src/shared/strv.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/dhcp-manager/systemd-dhcp/src/shared/strv.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/dhcp-manager/systemd-dhcp/src/shared/util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/dhcp-manager/systemd-dhcp/src/shared/util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/dhcp-manager/systemd-dhcp/src/systemd/_sd-common.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-event.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-id128.h
2014-11-06 21:36:02 -06:00
Dan Williams
9f6c81caa0 sd-dhcp6-client: fix off-by-two error in DUID length
The duid data passed by the client does not include the DUID type,
but client->duid_len does account for the size of the DUID type.
2014-11-06 21:36:02 -06:00
Dan Williams
6cbbb9c0bb vpn: reconnect on service failures (bgo #349151)
Attempt to reconnect the VPN on failures, except when the underlying
device fails.

https://bugzilla.gnome.org/show_bug.cgi?id=349151
2014-11-06 21:17:34 -06:00
Dan Williams
b11798a196 vpn/core: move VPN gateway route between devices when routing changes 2014-11-06 21:17:34 -06:00
Dan Williams
1f544d337c vpn: allow plugins to indicate 'can-persist' capability
The plugin can indicate that this connection can persist across link
changes and other connectivity dropouts by passing this option
back in the SetConfig() calls.
2014-11-06 21:17:34 -06:00
Dan Williams
a966a5e8b5 vpn: allow plugins to re-enter the STARTING state to indicate reconnect
If the VPN re-enters the STARTING state to indicate that it has
disconnected from the VPN server and is trying to reconnect, change
the VPN connection's state to indicate that connectivity may be
limited.  Wait for the VPN to provide updated IP configuration
information from the reconnect to change back to the ACTIVATED
state.
2014-11-06 21:17:34 -06:00
Dan Williams
2b9e442013 libnm/libnm-util: add VPN 'persistent' property
This property will indicate that the user wishes the VPN connection
to stay active until explicitly disconnected, even across link changes
or other interruptions.
2014-11-06 21:16:57 -06:00
Dan Williams
fb78b671d7 platform: fix lifetime/preferred type in _address_get_lifetime()
They are defined as gint32 but are assigned a guint32 value and
then immediately passed back to the caller of _address_get_lifetime()
as guint32.  They can never be negative, and may receive values
greater than G_MAXINT32, so they should be unsigned.
2014-11-05 12:44:59 -06:00
Thomas Haller
b63f8c80f8 wimax/build: use NM_PRAGMA_WARNING_DISABLE() macro instead of #pragma
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-31 21:02:42 +01:00
Thomas Haller
3d7acbc427 dhcp: don't add special route to DHCP server when having direct route
When the DHCP server address is not on the same subnet, we used
to add a /32 route to the server IP address via the gateway.

Do not add this route, if we already got a direct route from DHCP.

https://bugzilla.gnome.org/show_bug.cgi?id=738590

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-31 18:35:31 +01:00
Thomas Haller
ff145486d1 core: add nm_ipX_config_get_direct_route_for_host() functions
add two functions nm_ip4_config_get_direct_route_for_host()
and nm_ip6_config_get_direct_route_for_host() to check if we have
a direct (non-gw) route to a certain host.

Signed-off-by: Thomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=738590
2014-10-31 18:35:31 +01:00
Thomas Haller
22911696f4 core: add nm_utils_ip6_route_metric_normalize() function
Kernel treats IPv6 route metrics with value zero (0) special.
Add a utility function that helps accounting for that.

Signed-off-by: Thomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=738590
2014-10-31 18:31:19 +01:00
Lubomir Rintel
1f275a980a Merge branch 'lr/ap'
https://bugzilla.gnome.org/show_bug.cgi?id=738439
2014-10-31 15:35:20 +01:00
Lubomir Rintel
48b4f6f830 Merge branch 'lr/rpm-make-check'
https://bugzilla.gnome.org/show_bug.cgi?id=739127
2014-10-30 14:40:47 +01:00
Lubomir Rintel
7ad8b8a358 tests: Fix /general/nm_utils_kill_child race
/general/nm_utils_kill_child: **
GLib:ERROR:test-general-with-expect.c:105:test_nm_utils_kill_child_sync_do: Did not see expected message NetworkManager-DEBUG: *kill child process 'test-s-1-1' (*): waiting up to 500 milliseconds for process to terminate normally after sending SIGTERM (15)...
Aborted

The first test case assumes the child does not go away immediately after being
delivered a TERM signal. Add some delay to its teardown code path, so that NM
will set up the timeout the test expects.
2014-10-30 14:39:08 +01:00
Thomas Haller
f4f3f4d69b core/logging: make log level and domain a C enum
This way the compiler issues a warning when accidently
switching the level and domain arguments when logging.

Make LOGD_ALL and LOGD_DEFAULT members of the enum instead
defining them. Previously the LOGD_ALL define included all
the defined domains, hence this is no functional change.

Also define the logging domain aliases as enum members (instead
of preprocessor defines).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-30 14:18:16 +01:00
Thomas Haller
4e404212fc core/logging: adjust numerical values of the logging domain flags
The numerical value 0x01 was unused. Shift all the values
to fill the "hole".

Fixes: 552ed76f59
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-30 12:45:30 +01:00
Thomas Haller
b7d6e44f3c settings: check file permissions when loading settings plugins
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:19:15 +01:00
Thomas Haller
b2123a397a settings: accept missing settings plugins
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:19:15 +01:00
Thomas Haller
4545b6cb1e config: set a compile time default for the main.plugins configuration option
In case of a missing NetworkManager.conf (or a missing configuration option
main.plugins), allow to determine the fallback at compile time

https://bugzilla.gnome.org/show_bug.cgi?id=738611

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:17:55 +01:00
Thomas Haller
99c9529b15 build: add configure option for ibft plugin
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:17:55 +01:00
Thomas Haller
caa1779f33 utils: fix printf format for pid_t in nm_utils_get_start_time_for_pid()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:02:04 +01:00
Dan Winship
ace746df4e platform: deal with default route being passed to route_sync() (bgo 735325)
NMIP4Configs and NMIP6Configs are never supposed to contain a default
route, and thus nm_platform_ip6_route_sync() should never have to deal
with one. Unfortunately, if it *does* get passed a default route, it
will add it even if it was already there. This will result in an
RTM_NEWROUTE notification, which will cause NMPlatform to emit
ip6-route-changed, which will result in NMDevice doing some work and
then calling nm_ip6_config_commit(), which will result in NMIP6Config
passing the same list of routes to nm_platform_ip6_route_sync() again,
including the default route, which will cause NMPlatform to add the
route again...

(Something eventually causes this cycle to get broken, but it starts
up again the next time NM receives an RA.)

Fix this by having the route_sync() functions never add/modify the
default route (They were already not deleting it.)
2014-10-29 09:14:03 -04:00
Dan Winship
9f739d0c61 rdisc: properly handle RDNSS/DNSSL forced expiration
If the router sends an RA with an RDNSS or DNSSL lifetime of "0", that
means to immediately stop using the corresponding server/domain name.
NMLNDPRDisc knew this, but messed up its handling of it, and so if
this happened, it might end up sending out an RS to get new data every
0 seconds...

(Noticed while investigating bgo 735325, though it turned out to be
irrelevant there.)
2014-10-29 09:13:36 -04:00