Commit Graph

10305 Commits

Author SHA1 Message Date
Simon Farnsworth
155cd790f3 wwan: allow completing new GSM connections without an APN (bgo #729665)
In commit 215306f5 [1], NetworkManager was changed to require an APN for GSM
connections; previously, an omitted APN was taken as "use the default APN
for this device".

ModemManager supports this behaviour with an empty APN string; older
NetworkManager versions support this behaviour with no APN in the
settings. Choose the older NM behaviour, for backwards compatibility.

[1] commit 215306f5a1
  Author: Dan Williams <dcbw@redhat.com>
  Date:   Mon Jan 10 23:39:12 2011 -0600

    core: add AddAndActivate D-Bus method

    Given connection details, complete the connection as well as possible
    using the given specific object and device, add it to system
    settings, and activate it all in one method.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=729665
2014-07-23 14:31:21 -05:00
Dan Williams
0151df2f0a merge: add WWAN support for IPv6 (bgo #682623) 2014-07-23 14:27:09 -05:00
Dan Williams
2e0ba9d865 wwan: use a shorter DHCP timeout
With WWAN, the DHCP is all done in modem firmware, and never started
until we know we have a successful packet connection to the network.
Which means the modem firmware already knows the IP details and
is ready to provide them.  Furthermore, since the DHCP is done on
what is essentially a reliable, wired point-to-point link, we don't
have to waste time with retransmits for dropped packets either.
2014-07-23 14:26:40 -05:00
Dan Williams
784d263170 dhcp: DHCPv6 OtherConf failures should not be fatal
OtherConf implies the address has already been delivered via RA,
and possibly DNS too, meaning our IP configuration is already
good enough.  If nothing on the network bothers to reply to our
DHCPv6 Information Requests, let's just run with the config
we already have instead of tearing down the whole device.
2014-07-23 14:26:40 -05:00
Dan Williams
20081816e1 wwan: don't disconnect if nothing to disconnect
Avoid this error:

NetworkManager[25181]: <warn> (cdc-wdm1): Failed to connect 'T-Mobile Internet': Connection requested IPv4 but IPv4 is unsuported by the modem.
NetworkManager[25181]: <info> (cdc-wdm1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]

** (NetworkManager:25181): CRITICAL **: mm_modem_simple_disconnect: assertion 'MM_IS_MODEM_SIMPLE (self)' failed

self->priv->simple_iface is only valid if stage1/prepare actually
completes, so don't try to access it if stage1/prepare failed.
2014-07-23 14:26:39 -05:00
Dan Williams
b5817dffa0 core: remove child devices when a parent's ip_iface becomes known
Child devices shouldn't be exposed as real NMDevices (yet) since the
configuration and life cycle is controlled by the parent.  We already
do this if the ip_iface is known when the child device is added, but
PPP and other transient interfaces often show up just before we know
the parent's ip_iface.
2014-07-23 14:26:39 -05:00
Dan Williams
d29ab97c39 wwan: move IP method handling into the modem object
Do it in one place (NMModem) so that NMDeviceBt takes advantage of
the same logic that NMDeviceModem used to use.
2014-07-23 14:26:39 -05:00
Dan Williams
0caea7db2c wwan: add IPv6 support for ModemManager1 (bgo #682623)
https://bugzilla.gnome.org/show_bug.cgi?id=682623
2014-07-23 14:26:39 -05:00
Dan Williams
8c05e26c42 wwan: add infrastructure for IPv6 config results 2014-07-23 14:26:39 -05:00
Dan Williams
dd6abd407a wwan: clean up and split IP method values
Add an 'unknown' value; make the type an enum, and rename it since
this enum is private to NetworkManager and abstracts differences
in old and new MM.

We also need separate methods for IPv4 and IPv6 since they may not
use the same mechanism.  For example, IPv4 may use DHCP but IPv6 may
require static configuration, based on what the modem firmware wants.
2014-07-23 14:26:39 -05:00
Dan Williams
f3557d326c wwan: read supported IP types from ModemManager
Not all modems support IPv6, and to prevent some common failure
cases, make sure we don't try to use IPv6 when the modem doesn't
support it.
2014-07-23 14:26:39 -05:00
Dan Williams
75fa46bd19 ppp: add IPv6 support
Add support for IPv6 to the pppd plugin and return the interface identifiers
to NetworkManager.  Use those to construct the IPv6LL addresses for the
PPP interface and the peer.
2014-07-23 14:26:39 -05:00
Dan Williams
af1f183b3d wwan: split out WWAN IP4Config from device config
We want to set the WWAN config last, to ensure that the configuration we
use overwrites anything that pppd might have set, becuase it touches some
stuff itself.  That means we have to keep the WWAN config separate, since
dev_ip4_config is used for DHCP and IPv4LL, which we always set first to
ensure they these don't overwrite external, administrator added config
(eg, priv->ext_ip4_config).

This also synchronizes the IPv4 config path with the upcoming IPv6
config path.
2014-07-23 14:26:39 -05:00
Dan Williams
69ea2705ec merge: construct IPv6 addresses using Interface Identifiers (bgo #682623) 2014-07-23 14:24:58 -05:00
Dan Williams
288bf39e44 core: fail IPv6 router discovery if IID cannot be generated
If the IID cannot be generated, the IPv6 address resulting from
the combination of an advertised prefix and 64-bits of zero is
both wrong and quite likely to clash with some other machine on
the network that doesn't implement IPv6 quite right either.

Require an valid interface identifier.  If NetworkManager doesn't
know how to generate one, then we should fix NM to do so.
2014-07-23 14:21:11 -05:00
Dan Williams
05e99e24a1 trivial: move addrconf6_start_with_link_ready() above caller 2014-07-23 12:53:55 -05:00
Dan Williams
e2270040c0 core: use Interface Identifiers for IPv6 SLAAC addresses
Ethernet-like interfaces aren't the only type of interfaces that can
run IPv6 but the rdisc code only returns an address if the interface's
hardware address is 6 bytes.

Interface types like PPP (rfc5072) and IPoIB (rfc4391) have their own
specifications for constructing IPv6 addresses and we should honor
those.

So instead of expecting a MAC address, let each device subclass
generate an Interface Identifier and use that for rdisc instead.
2014-07-23 12:53:55 -05:00
Dan Williams
27f91d054c core: simplify hardware address reading
We no longer need a class method for reading the hardware address
length, for a couple reasons:

1) Using the IP interface hardware address for IP operations now makes
NMDevice's priv->hw_addr_len constant.  So there's no reason to re-read
it all the time.

2) get_hw_address_length() is now only used for determining whether the
hardware address is permanent, and that only mattered for Bluetooth.
Since Bluetooth interfaces have a bogus interface name, they will never
have a valid ifindex, and thus nm_platform_link_get_address() would be
useless.  So instead of using the 'permanent' stuff, just don't bother
updating the hardware address if the NMDevice's ifindex isn't valid,
and let subclasses pass the initial hardware address at device creation.

This also works correctly for NMDevice classes that previously
implemented get_hw_address_length() like ADSL and WWAN, since those
too will never have a valid ifindex or a valid hardware address.

3) Reading the device's hardware address length just ended up calling
nm_platform_link_get_address() for most devices anyway, so
nm_device_update_hw_address() would effectively read the link address
twice (once to read the length, the second time to read the actual
address).  Let's just read the address once.
2014-07-23 12:53:55 -05:00
Thomas Haller
ac4fafe7a4 platform: assert against the maximum length of link_get_address()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-23 12:42:45 -05:00
Dan Williams
7f771d0a05 core: use IP interface hardware address for IP-level operations
The IP interface may have its own hardware address (like the net
port for WWAN devices) and that's the hardware address that must be
used for DHCP and IPv6 SLAAC, not the hardware address (if any) of
the NMDevice itself.

This patch does change the NMDevice hardware address property to
always be the Device's hardware address, instead of the IP interface
hardware address.  This means that ADSL and WWAN will no longer
change their hardware address to the hardware address of their
IP interface.  But in all these cases, the hardware address is
non-existent (PPP) or transient and meaningless (WWAN/ADSL).
2014-07-23 12:42:45 -05:00
Colin Walters
15734a4ba5 config: avoid segfault if there's no ignore_carrier
Just return false.
2014-07-23 12:21:46 -05:00
Dan Winship
4a6f91c77c core: misc cleanup
spin-off of https://bugzilla.gnome.org/show_bug.cgi?id=680909
2014-07-23 10:56:26 -04:00
Dan Winship
7da97fc6fe config: drop NMConfigDevice, use NMDevice directly
NMConfigDevice was added because in the 0.9.8 days, when each subdir
of src/ was compiled separately, it was impossible to make src/config/
depend on src/devices/ because of circular dependencies.

Since now everything gets compiled into a single libNetworkManager.la,
this is no longer a problem, and so NMConfigDevice is just an
unnecessary complication.
2014-07-23 10:56:26 -04:00
Dan Winship
2b2faf9c28 config: move some spec-match-list handling from config to core
NMConfig accepted no-auto-default and ignore-carrier lists with
untagged specs (ie, interface names not prefixed with
"interface-name:" and hardware addresses not prefixed with "mac:").
Move that handling into nm_match_spec_interface_name() and
nm_match_spec_hwaddr() instead.
2014-07-23 10:56:26 -04:00
Dan Winship
4308a8305a core: fix libndp linking
We were linking libndp into the NetworkManager binary, but it ought to
be marked as a dependency of libNetworkManager, in case a test
exercises that code.
2014-07-23 10:56:26 -04:00
Dan Winship
b28f6526c2 core: fill in nm-types.h, clean out other headers
Clean up some of the cross-includes between headers (which made it so
that, eg, if you included NetworkManagerUtils.h in a test program, you
would need to build the test with -I$(top_srcdir)/src/platform, and if
you included nm-device.h you'd need $(POLKIT_CFLAGS)) by moving all
GObject struct definitions for src/ and src/settings/ into nm-types.h
(which already existed to solve the NMDevice/NMActRequest circular
references).

Update various .c files to explicitly include the headers they used to
get implicitly, and remove some now-unnecessary -I options from
Makefiles.
2014-07-23 10:56:26 -04:00
Dan Winship
b7c7832ae8 settings: remove libnm-glib references
Several plugins were using -I$(top_srcdir)/libnm-glib, which is bad
since libnm-glib has its own nm-types.h which is different from src's.
Worse yet, some were actually linking against libnm-glib (which
presumably only worked at all because they weren't calling any
functions in it and so the linker just ignored the request). Fix both
problems.
2014-07-23 10:56:25 -04:00
Dan Winship
371c68cee9 trivial: update .gitignore 2014-07-23 10:56:06 -04:00
Dan Winship
b25a237fd6 dhcp: remove a stray reference to test-dhcp-options
5b4be27f moved test-dhcp-options from src/tests/ to
src/dhcp-manager/tests/, but src/tests/Makefile.am still included it
in "TESTS" (which would still work until you tried to build from a
clean tree...)
2014-07-23 10:04:18 -04:00
Dan Williams
afebbb6ef8 merge: DHCP client code cleanups and simplification (bgo #732965)
In preparation for library-based DHCP clients, remove some assupmtions
that all DHCP clients are subprocesses, and that all DHCP options
get passed back NM via D-Bus.

https://bugzilla.gnome.org/show_bug.cgi?id=732965
2014-07-22 14:39:32 -05:00
Dan Williams
7ef4e3fd01 dhcp: add client hardware address and priority accessors 2014-07-22 14:39:20 -05:00
Dan Williams
e40322f572 dhcp: allow clients to retrieve DUID after DHCPv6 start 2014-07-22 14:39:20 -05:00
Dan Williams
2c982d877e dhcp: make DUID-to-string function available to subclasses 2014-07-22 14:39:20 -05:00
Dan Williams
a1c86a9a27 dhcp: pass IPv6 privacy preference to client class 2014-07-22 14:39:20 -05:00
Dan Williams
24c1523b51 dhcp: pass individual options to DHCP instead of NMSettingIPxConfig 2014-07-22 14:39:19 -05:00
Dan Williams
d7b3ae8c10 dhcp: consolidate more state logic in nm_dhcp_client_set_state()
The goal is to remove generic logic from nm_dhcp_client_new_options(),
since library-ized DHCP clients won't ever call that function since
their native data format isn't a hash table of strings.
2014-07-22 14:39:19 -05:00
Dan Williams
3ffb25ddce dhcp: trivial: move state table and state string functions earlier 2014-07-22 14:39:19 -05:00
Dan Williams
6ffcde08dd dhcp: pass DHCP options with BOUND state change
The options hash is never used except for BOUND events, so don't
bother caching it in the DHCP client object.  Just pass it along
with the BOUND state change, like the IP configuration object.
2014-07-22 14:39:19 -05:00
Dan Williams
aff6a70c52 dhcp: convert options testcases to g_assert() 2014-07-22 14:39:19 -05:00
Dan Williams
31d19f51d1 dhcp: filter DHCP options when setting them
Don't bother storing all the options, only store the ones we care
about and ones we export through the NMDHCP4Config and NMDHCP6Config
objects.
2014-07-22 14:39:19 -05:00
Dan Williams
4ce6e39a8f dhcp: pass IP config in state signal
Just pass it in the state change signal.
2014-07-22 14:39:19 -05:00
Dan Williams
5b4be27f4a dhcp: consolidate and simplify DHCP options tests
Previously the tests required that a NMDHCPClient object was
created, but all that's really being tested is the DHCP option
parsing and that doesn't need a client object now that the
option parsing has been split out.

Also, the options test wasn't in src/dhcp-manager/, so put it there.

Lastly, the test ran for both dhclient and dhcpcd, but the code
executed for both cases was the same, so there's no reason to keep
running the test for both clients.
2014-07-22 14:39:19 -05:00
Dan Williams
f275a66105 dhcp: split out DHCP options processing
No code changed except passing what used to use "priv->" as
function parameters.
2014-07-22 14:39:19 -05:00
Dan Williams
5b5801f268 dhcp: find existing clients by ifindex, not interface name
More robust against ifname changes, plus we save some strcmps().
For the most part, the interface name should be informational
only and unused for actual control logic.
2014-07-22 14:39:18 -05:00
Dan Williams
fec121fd9d dhcp: remove the client REMOVE signal
Instead of using a separate signal for it, just drop and release
the client object when it reaches terminate states like TIMEOUT,
FAIL, and DONE.  The 5 second removal signal timeout appears to
no longer be necessary, since the running child process is killed
synchronously.
2014-07-22 14:39:18 -05:00
Dan Williams
7262e606c4 dhcp: always signal state changes
Modify code so that listeners remove state change signal handlers
before stopping the client.  Which means we can remove the 'emit_state'
argument from nm_dhcp_client_set_state().
2014-07-22 14:39:18 -05:00
Dan Williams
180d298dea dhcp: make nm_dhcp_client_set_state() available to subclasses
Not all state changes will be done in the base NMDHCPClient class
anymore, especially with non-subprocess DHCP clients.
2014-07-22 14:39:18 -05:00
Dan Williams
a7a84d7f76 core: consolidate DHCP client termination in dhcp[4|6]_fail()
DHCP failure should just clean up the client in all cases.  This
also has the benefit of removing the signal handler for the DHCP
client's state-change signal before telling the client to terminate,
which will simplify some DHCP code later.
2014-07-22 14:39:18 -05:00
Dan Williams
9568ae52e4 dhcp: merge TIMEOUT signal with DHCP_STATE_TIMEOUT
No reason to have two signals for the same thing. Previously, the
TIMEOUT signal was used for the internal overall DHCP transaction
bound, while DHCP_STATE_TIMEOUT/DHC_TIMEOUT was a signal from
the DHCP client itself that something had timed out.  But in both
cases the results should be the same, so just collapse the
stand-alone TIMEOUT signal into the DHCP_STATE_TIMEOUT state.
2014-07-22 14:39:18 -05:00
Dan Williams
9e75e2ad0d dhcp: simplify DHCP states
The existing DHC_* states are pretty specific to dhclient, and aren't
useful for more generalized DHCP.  NetworkManager wasn't using many
of the states anyway, and doesn't need to differentiate between
states like REBOOT/REBIND/RENEW anyway.  So simplify the DHCP states
into the ones we really care about.
2014-07-22 14:39:18 -05:00