Commit graph

3789 commits

Author SHA1 Message Date
Pavel Šimerda
4134acc614 platform: simplify tests Makefile.am using variables 2013-06-26 22:40:28 +02:00
Pavel Šimerda
b0ae0be291 platform: use the term 'software devices' consistently 2013-06-26 22:38:55 +02:00
Pavel Šimerda
9d92275ac9 platform: add link type classification 2013-06-26 22:29:11 +02:00
Pavel Šimerda
1c078e9bd5 platform: log route metric 2013-06-26 19:58:18 +02:00
Pavel Šimerda
a19e1d6f61 platform: make log_* consistent 2013-06-26 19:58:18 +02:00
Pavel Šimerda
75430c72d0 platform: avoid netlink synchronization problem
The route metric is one of the object's key attributes and therefore
cannot be left to be chosen by the kernel. Instead, it must always be
specified explicitly. This matches the architecture of libnl3 and the
current API provided by nm-platform.
2013-06-26 19:58:18 +02:00
Dan Winship
ec1376fad2 trivial: update .gitignore 2013-06-26 11:10:02 -04:00
Dan Williams
0eb97f3ad5 agents: change secrets request hints back to char **
Previously I didn't think they'd be used for anything other than connection secrets
which only have one hint, but in the future we'll want to pass more information.
2013-06-25 17:43:39 -05:00
Dan Williams
b34fdde19c agents: refactor agent secrets request tracking to be more generic
Split the agent secrets request tracking structure into a generic
structure for tracking any agent request, and a connection-specific
subclass.  We'll use the generic structure in the future for device
secrets and other stuff.
2013-06-25 17:43:39 -05:00
Jiří Klimeš
01585d2ebe keyfile: fix reading bonding options (bgo #701527)
Bonding options are written straight into [bond] group like:
[bond]
interface-name=bbb
mode-active-backup
miimon=300

So we have to handle them explicitly.
2013-06-25 18:03:19 +02:00
Pavel Šimerda
393346b4fc cleanup: remove unused netlink/system code 2013-06-25 09:55:57 +02:00
Pavel Šimerda
70916c79eb cleanup: remove libnl dependency from nm-ip4-config/nm-ip6-config 2013-06-25 09:53:27 +02:00
Pavel Šimerda
57df4ce5ed core: use nm-platform for route management 2013-06-25 09:52:12 +02:00
Pavel Šimerda
96219b1d86 vpn: use nm-platform for default routes 2013-06-25 09:52:06 +02:00
Pavel Šimerda
91f8de7936 policy: use nm-platform for routing 2013-06-25 09:50:36 +02:00
Pavel Šimerda
48670c0156 core: use nm-platform for address management 2013-06-25 09:50:36 +02:00
Pavel Šimerda
ef73aa3b2c platform: route utility functions 2013-06-25 09:50:35 +02:00
Pavel Šimerda
bd0fd1cd1d platform: address utility functions 2013-06-25 09:32:06 +02:00
Dan Williams
ab8ca2dbe2 core: fix flushing of routes and updating legacy IPv4 address property
We can't clear the ip_iface until after all the routes and addresses
are updated and flushed, because the addresses and routes are
identified by the ip_iface, and if we clear the ip_iface, we don't
know which things to flush anymore.

Example: 'hso' modems have an 'iface' of 'ttyHS4' (a serial port) and
an ip_iface of 'hso0' (an ethernet port).  If we clear the ip_iface too
soon, then ip_iface/ip_ifindex is invalid and thus NM has no idea what
to remove, and the default route pointing to 'hso0' sticks around.

This could also happen with other devices where the ip_iface is
different than the iface, like modems, ADSL/ATM devices, etc.
2013-06-24 22:47:57 -05:00
Colin Walters
c70ffd6f9b config: Include overrides in parsed config file message
Useful to see which files are being read.
2013-06-24 15:48:53 -05:00
Colin Walters
2269b708ac main+logging: Allow early logging before config files
The new setup phase goes like this:

- main()
- parse command line options
- logging is configured, targeting stdout/stderr
- ...other stuff...
- do or do not daemonize, depending on commandline option and config files
- Call openlog() - further log messages go to syslog (and potentially
  stderr as well, if the -d option was specified so we use LOG_PERROR).

Basically, this allows us to log messages about config file parsing
and such, which *greatly* helps with debugging.
2013-06-24 15:48:53 -05:00
Colin Walters
8043d77237 main: Move static assertions after setlocale(), but before option processing
These assertions (such as getuid() == 0) don't need to access the
config files or commandline arguments, but *do* output localized error
messages, so they should be after setlocale().
2013-06-24 12:25:49 -04:00
Colin Walters
d3fd1b7464 main: Set umask earlier
Since we may be creating e.g. pid files before this, we need to set
the umask as early as possible.
2013-06-24 12:25:49 -04:00
Colin Walters
4ff7eeeaae main: setenv(GIO_USE_VFS=local) *very* early
See https://bugzilla.gnome.org/show_bug.cgi?id=701322 for why we
should order calls to setenv() as early as possible.
2013-06-24 12:25:49 -04:00
Dan Williams
8ce4250d8e core: ping the gateway during the IP_CHECK state (bgo #702515)
Using the new gateway-ping-timeout property, send pings to the first
gateway address until it replies or the timeout is reached, to deal
with dumb hardware that indicates carrier on but doesn't actually
pass traffic.

https://bugzilla.gnome.org/show_bug.cgi?id=702515
2013-06-21 16:18:49 -05:00
Tomas Hozza
6b93150d0d dispatcher: publish vpn_ip6_config 2013-06-21 17:46:19 +02:00
Pavel Šimerda
f625d6a269 platform: handle netlink failures properly 2013-06-21 04:03:41 +02:00
Pavel Šimerda
3b0269bbee platform: add test for address/route cleanup on link removal
The improved tests can be also used to test the previous commit.
2013-06-21 04:03:41 +02:00
Pavel Šimerda
40cb2f4c29 platform: remove cached addresses and routes for deleted devices 2013-06-21 04:02:32 +02:00
Pavel Šimerda
35dd05cc43 platform: share main function among tests 2013-06-21 04:02:32 +02:00
Pavel Šimerda
24dee51bce platform: add tests for default routes
The improved tests can be also used to test the previous commit.
2013-06-21 01:33:02 +02:00
Pavel Šimerda
67731a088e platform: workaround a libnl bug affecting default routes
Current versions of libnl3 use nl_addr_get_len() instead of
nl_addr_get_prefixlen() to determine the default route. Therefore we're
employing a workaround that sets the address length to zero for default
routes.

Unfortunately this workaround causes nl_addr to have wrong address size,
which in turn requires another workaround in init_ip4_route() as well as
init_ip6_route() to cope with the inconsistency.

Even though this solution is very very ugly, we didn't find a better
one. Not calling rtnl_route_set_dst() didn't solve the problem. Thomas
Graf promised to fix the libnl problem upstream. When bumping dependency
to a version that does this correctly, the workarounds can be removed.
2013-06-21 01:28:26 +02:00
Dan Williams
e8c58c957b platform: specify link-added signal as asynchronous
With the move of udev logic into the Linux platform class, the
link-added signals are asynchronous, that is they are not emitted
during the call to nm_platform_*_add(), but after that call has
returned.  The Fake implementation still emitted them synchronously,
which broke the testcases.  Convert the Fake implementation to emit
link-added signals asynchronously and update the testcases to handle
this.
2013-06-20 16:14:08 -05:00
Dan Williams
ed9f6b0843 build: fix distcheck after b294a1ef63 2013-06-20 16:14:08 -05:00
Pavel Šimerda
0b07a5301e settings: publish add_new_connection() as nm_settings_add_connection_internal() 2013-06-20 20:20:08 +02:00
Colin Walters
c1d3d3f2e9 device: queuing two transitions to the same state is not an error
Just ignore this, since it happens in the current code and is
harmless.  While we're here, improve the warning in the case where it
does occur to say whiich state we're overwriting.  This should help
debug any future cases.
2013-06-19 18:06:16 -05:00
Dan Williams
c77c566983 core: ignore default routes when creating configuration for generic interface
NM handles the default routes, so they shouldn't show up in the NMIP4Config
for any interface.  They get exposed via the 'default' and 'default6' properties
of the ActiveConnection instead.
2013-06-19 13:49:12 -05:00
Jiří Klimeš
eea23747ce ifcfg-rh: fix storing connections in the hash table
We have to copy the UUID (key) because otherwise the pointer can be invalidated
when the connection is destroyed and problems will start.

The issue showed up as an unability to delete a conenction via D-Bus.

Reproducer:
$ nmcli con add type eth con-name AAA ifname blah
$ nmcli con delete AAA
$ nmcli con add type eth con-name AAA ifname blah
$ nmcli con delete AAA
-- here the connection is not removed from NM
   (even though ifcfg- file) was removed --
2013-06-19 12:41:36 -05:00
Dan Williams
5c705e643a platform: update linux platform testcases for udev/platform merge
Since the platform started using udev for link-added signals, we need
to run the glib mainloop to wait for the udev signals to come in,
instead of expecting them to be emitted immediately.
2013-06-19 12:33:54 -05:00
Dan Williams
7c5bd0c64d platform: fix return value for no-firmware case
The function returns 'gboolean' so it shouldn't be returning an
enum, but it should instead set the platform error and return FALSE.
2013-06-19 12:28:48 -05:00
Pavel Šimerda
b294a1ef63 platform: add minimal Makefile.am for convenience
When working only with nm-platform and its testsuite, it's convenient to
call 'make', 'make check', etc from 'src/platform' directory.
2013-06-19 13:48:29 +02:00
Pavel Šimerda
ed37ceeb91 trivial: platform: add_kernel_object now returns int, not gboolean 2013-06-19 13:28:00 +02:00
Dan Williams
4182deb398 core: remove possibly dangling idle handler in ip6 manager
If things happen just right, where a bond is the first device to use
IPv6 and thus has the only reference to the NMIP6Manager, and the
RTM_NEWROUTE event comes in and triggers manager_request_ip6_info()
but then the device is removed by 'rmmod bonding', the call to
manager_request_ip6_info() could be dangling after the IP6Manager
has been disposed.  Fix that.
2013-06-18 14:41:26 -05:00
Dan Williams
caed0243f5 bluetooth: fix crash creating device
Due to the hardware address changes in 77dda53b (danw/hwlen) creating
a new Bluetooth device was crashing.  The changes there assumed that the
NMDeviceBt's hardware address should only be valid when we were connected
to the device, but that's not quite true.  Since we already know the remote
device's Bluetooth hardware address, we already know the hardware address
for the NMDeviceBt as well.
2013-06-17 12:04:54 -05:00
Dan Williams
c73e891a4c wifi: fix checking AP mode and EAP-FAST support
Classic strcmp() return value thinko.  Oops.
2013-06-14 14:24:19 -05:00
Dan Williams
cf1d2f81f2 core: rename nm_device_hw_* to nm_device_*
Now that we only have one set of is_up/bring_up/take_down functions
lets rename the _hw_ variants.
2013-06-14 13:45:39 -05:00
Dan Williams
4d4a99beaa wimax: hw_bring_up is pointless
The function only checked whether wimax was enabled (rfkill/user pref)
and whether wimaxd was running.  Only nm-device.c calls this function
for WiMAX devices, and the only two uses of it were during activation
(which is already covered by nm-device-wimax.c's is_available() function)
and when the device enters the UNAVAILABLE state, where it is used
to check for missing firmware, which is implemented by the parent
class, not WiMAX.
2013-06-14 13:45:39 -05:00
Dan Williams
17ce00ff27 core: remove bring_up, take_down, is_up device class methods
These turn out to be pretty useless, since their functions are already
covered by each device's state-changed handler or can be done in other
places like deactivate().

https://bugzilla.gnome.org/show_bug.cgi?id=702190
2013-06-14 13:45:32 -05:00
Colin Walters
907d99c2ac Make no-auto-default=* work again
Sadly '*' is a valid interface name, and so the config processing was
thinking it was shorthand for "interface-name:*".
2013-06-14 13:40:27 -03:00
Dan Winship
ac1692a17b keyfile: remove some debugging 2013-06-14 12:57:47 -03:00