Commit graph

5822 commits

Author SHA1 Message Date
Thomas Haller
2d860b3f05 dhcp: comment-out unused systemd utility functions 2015-03-03 11:13:51 +01:00
Thomas Haller
22afaab1c5 dhcp: comment-in now needed string_table_lookup() function in util.c 2015-03-03 11:13:51 +01:00
Thomas Haller
cdd71569b0 dhcp: comment-in now needed filename_is_valid() function in util.c 2015-03-03 11:13:51 +01:00
Thomas Haller
4a58425dbf dhcp: remove local modifications initializing cleanup variables
I cannot reproduce any compiler warnings with these changes.
I think it is desirable, that our version of the code is
as similar as possible to the upstream systemd code.
Undo these local modifications.
2015-03-03 11:13:51 +01:00
Thomas Haller
746d0f544c dhcp/trivial: remove unused fixes to our copy of the systemd code
Make our copy more similar to what systemd has by removing
local changes that are unnecessary.

These changes don't affect the build, because the code is excluded
with #if 0.
2015-03-03 11:13:50 +01:00
Thomas Haller
d568e539a6 dhcp/trivial: remove code comment
dcbw added a comment line and submitted the patch to systemd.
The patch was merged without the comment. Remove it also from our
version, to make the file more similar to what systemd has.
2015-03-03 11:13:50 +01:00
Thomas Haller
7afb63ca34 dhcp: merge branch 'master' into th/systemd-dhcp-integration
Only basic merging. The result does not yet compile.

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

Conflicts:
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-packet.c
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
	src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
	src/dhcp-manager/systemd-dhcp/src/shared/macro.h
	src/dhcp-manager/systemd-dhcp/src/shared/strv.c
	src/dhcp-manager/systemd-dhcp/src/shared/util.c
	src/dhcp-manager/systemd-dhcp/src/shared/util.h
	src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-client.h
2015-03-03 11:13:41 +01:00
Thomas Haller
5599a82d0d 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: 85d9132464
2015-03-03 11:07:01 +01:00
Dan Williams
e93309e81d wwan: don't warn on disconnect if ModemManager isn't running
If ModemManager quit or was terminated, and that caused the disconnect,
don't bother printing out a warning if MM couldn't be started.
2015-03-02 13:56:40 -06:00
Thomas Haller
39f8b7b542 dhcp: update systemd DHCP code
This is a direct dump from systemd git on 2015-03-02, git commit
4d1d2f0858bb2fa6c.  Only relevant files were included.

    SYSTEMD_DIR=../systemd
    COMMIT=4d1d2f0858bb2fa6c45f0a7b3d427e657c0d4f67

    mkdir -p ./src/dhcp-manager/systemd-dhcp/src/libsystemd/sd-id128/

    (
       cd "$SYSTEMD_DIR"
       git checkout "$COMMIT"
       git reset --hard
       git clean -fdx
    )
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd/sd-id128/sd-id128.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd/sd-id128/sd-id128.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-identifier.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-identifier.h
    /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/log.h ./src/dhcp-manager/systemd-dhcp/src/shared/log.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/dhcp-manager/systemd-dhcp/src/shared/macro.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/path-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/path-util.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/unaligned.h ./src/dhcp-manager/systemd-dhcp/src/shared/unaligned.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
2015-03-02 20:25:18 +01:00
Lubomir Rintel
ad2b17bfb4 trivial: don't run wifi tests if the tests are disabled 2015-03-02 19:22:10 +01:00
Thomas Haller
42b39b9482 dhcp: ensure every systemd dhcp file includes 'nm-sd-adapt.h' first 2015-03-02 14:22:09 +01:00
Thomas Haller
15bebd7c51 dhcp: don't include config.h in systemd source
systemd sources should all include 'nm-sd-adapt.h' as first header,
which in turn already includes our 'config.h'.
2015-03-02 14:22:09 +01:00
Thomas Haller
5162426d41 logging: add error argument to _nm_log() to support "%m" format specifier
A gnu extension to printf adds the format specifier "%m"
to print @errno. To preserve the error number until the
point where the logging statement is constructed, pass
it as an additional argument to _nm_log().

This is not (yet) used from NM internal code. But systemd is adding
similar functionality to its logging functions. Add the same also to
nm-logging, to support systemd's usage of "%m".
2015-03-02 14:22:09 +01:00
Thomas Haller
94b9c79cf6 dhcp/trivial: add '/* NM_IGNORED */' comment to #endif added by NetworkManager 2015-03-02 14:22:08 +01:00
Thomas Haller
a05b04c0fd dhcp/trivial: remove shaddowed '#if 0 /* NM_IGNORED */' block
Remove '#if 0' inside another '#if 0' block.
2015-03-02 14:22:08 +01:00
Thomas Haller
f3ad60b434 route-manager: define singelton using NM_DEFINE_SINGLETON_GETTER()
Fixes: 874e4a7595
2015-02-27 21:40:44 +01:00
Thomas Haller
ea0d0b3086 route-manager/build: fix out-of-tree builds for route-manager tests
Fixes: 0659a67c8f
2015-02-27 19:36:43 +01:00
Dan Williams
79aac22148 build: order ADSL plugin build after core files
Build it right before the other plugins.
2015-02-27 10:36:23 -06:00
Dan Williams
677cee0f23 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ß
2015-02-27 10:05:56 -06:00
Lubomir Rintel
f981407a02 core: pass ifindex as parameter to nm_ip6_config_new() 2015-02-27 16:50:09 +01:00
Dan Williams
84f54f0a5f core: pass ifindex as parameter to nm_ip4_config_new() 2015-02-27 16:50:09 +01:00
Lubomir Rintel
0659a67c8f route-manager: add test 2015-02-27 16:48:28 +01:00
Lubomir Rintel
4c3ba29b40 route-manager: remember routes that should be active
Kernel likes to remove a route in case an equivalent route is added to another
interface. Avoid this situation and only apply the new routes in case the ones
that would cause a conflict are removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1164441
https://bugzilla.gnome.org/show_bug.cgi?id=740064
2015-02-27 16:48:28 +01:00
Lubomir Rintel
7c52d094ed route-manager: normalize ipv6 route metrics during comparison
IPv6 metric of zero is equal to 1024.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
72cefd5162 fake-platform: normalize ipv6 route metric before deletion 2015-02-27 16:48:28 +01:00
Lubomir Rintel
4d097829f0 fake-platform: reject adding routes without the gateway on the same interface
This mimics Linux behavior.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
f6c9b4ff83 fake-platform: override routes that clash
This is done to more closely mimic what Linux does.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
1ee03eeb5a fake-platform: move route deletion above addition
No change in behavior.

We'll need it when we'll remove routes that clash upon addition.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
72e8c534e0 fake-platform: don't return null routes in place of deleted ones 2015-02-27 16:48:27 +01:00
Lubomir Rintel
52711b5d89 ip6-config: keep track of ifindex
No functional change, a cosmetic thing for now.

We want it set before any routes are added and ensure routes have a valid
ifindex before we pass it to the platform.

In a future NMRouteManager will need to look up the route for a device in
its cache thus we'll need to make sure routes passed to the it have an
appropriate ifindex set.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
747292a4c3 ip4-config: keep track of ifindex
No functional change, a cosmetic thing for now.

We want it set before any routes are added and ensure routes have a valid
ifindex before we pass it to the platform.

In a future NMRouteManager will need to look up the route for a device in
its cache thus we'll need to make sure routes passed to the it have an
appropriate ifindex set.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
874e4a7595 core: split route management code out from platform
Create a NMRouteManager singleton.

Refactor, no functional changes apart from change of log domain from
LOGD_PLATFORM to LOGD_CORE.

Subsequent commit will keep track of the conflicting routes, avoid overwriting
older ones with newer ones and apply the new ones when the old ones go away.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
47167cab4f platform: fix route addition ordering 2015-02-27 16:48:27 +01:00
Jiří Klimeš
dead766c3b keyfile: update testcase for multicast-snooping property 2015-02-26 09:08:13 +01:00
Jiří Klimeš
b9c79de295 ifcfg-rh: read/write multicast-snooping property 2015-02-26 09:08:13 +01:00
Jiří Klimeš
1252386940 device: add multicast-snooping option support 2015-02-26 09:08:13 +01:00
Lubomir Rintel
73e8aeadba dns-manager: react to dns management mode changes
Load a different plugin when the configuration changes.
2015-02-25 18:25:04 +01:00
Lubomir Rintel
aa672b2dc2 config: move dns mode configuration to NMConfigData
This will make is possible for the NMDnsManager to watch for
configuration changes.
2015-02-25 18:25:04 +01:00
Aleksander Morgado
a84744324f wwan: indentation & alignment fixes 2015-02-24 16:04:45 -06:00
Aleksander Morgado
85d9132464 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:04:37 -06:00
Lubomir Rintel
600489003f device: set the reason for when deactivating for another activation
It's always user requested -- auto activation never happens on already active
devices. nm_device_release_one_slave() rightly asserts teardown with
(un)configuration does not happen for no reason at all.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
2015-02-24 18:43:00 +01:00
Lubomir Rintel
d37f2280b7 manager: don't re-assume generated connections
They're being torn down as their device is being deactivated.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
2015-02-24 18:42:52 +01:00
Thomas Haller
6cdcf36a3d device: skip generating enums for internal flags with glib-mkenums 2015-02-24 18:01:22 +01:00
Thomas Haller
0bfe635119 device: accept user activation request while waiting for carrier
https://bugzilla.redhat.com/show_bug.cgi?id=1079353
2015-02-24 11:49:04 +01:00
Thomas Haller
d80f1bf4f0 device: eliminate direct calls to check_connection_available() in favor of nm_device_check_connection_available()
It was confusing to understand the difference between calling nm_device_connection_is_available()
and check_connection_available(), they behaved similar, but not really
the same. Especially nm_device_connection_is_available() would look
first into @available_connetions, and might call check_connection_available()
itself. Whereas @available_connetions was also populated by testing
check_connection_available(). This interrelation makes it hard to
understand when nm_device_connection_is_available() returned true.

Rename nm_device_connection_is_available() to nm_device_check_connection_available()
and remove all direct calls of check_connection_available() in favor of
the wrapper nm_device_check_connection_available().

Now we only call nm_device_check_connection_available() with different
parameters (@flags and @specific_object). We also have the additional
guarantee that specifying more @flags will widen the result and making
a connection "more" available, while specifying a @specific_object will
restrict it.

This also changes behavior in several cases. For example before
nm_device_connection_is_available() for user-requests would always
declare matching connections available on Wi-Fi devices (only)
regardless of the device state. Now the device state gets consistently
considered.

For default-unmanaged devices it also changes behavior in complicated
ways, because before we would put connections into @available_connetions
for every device-state, but nm_device_connection_is_available() had a
special over-ride only for unmanaged-state.

This also fixes a bug, that user can activate an unavailable Wi-Fi
device:
  nmcli radio wifi off
  nmcli connection up wlan0
2015-02-24 11:49:04 +01:00
Thomas Haller
e524be2c34 device: remove debug logging from is_available()
Having logging statements in a simple getter (or is_*()) means
you cannot call these functions without cluttering the log.

Another approach would be to add an @out_reason argument, and
callers who actually care log the reason. For now, just get rid
of the messages.
2015-02-24 11:49:04 +01:00
Thomas Haller
37ebeccaa7 device: implement flag NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER for is_available() 2015-02-24 11:49:04 +01:00
Thomas Haller
52dbb2398a device: add flags to nm_device_is_available() 2015-02-24 11:49:04 +01:00
Thomas Haller
e96af59444 device: add flags argument to check_connection_available() 2015-02-24 11:49:03 +01:00