Commit Graph

7207 Commits

Author SHA1 Message Date
Dan Williams
3e293e1101 dhcp: we don't always have an NMSettingIP6Config for the DHCP hostname
Prevents:

NetworkManager[19405]: nm_setting_ip6_config_get_dhcp_hostname: assertion `NM_IS_SETTING_IP6_CONFIG (setting)' failed
2013-03-20 11:28:22 -05:00
Dan Williams
bd636ffb40 dbus: reinstall property filter on dbus connection changes (rh #918273)
Like if the dbus daemon restarts; in this case the connection has changed
and the new connection doesn't have the filter installed, and libdbus
aborts when we try to remove a filter that doesn't exist on the connection.
Fix that by re-adding the filter when the connection changes.
2013-03-20 08:51:08 -05:00
Dan Fruehauf
edd1ebe8a0 dbus: allow talking to the NetworkManager-SSH VPN plugin 2013-03-20 08:28:14 -05:00
Jiří Klimeš
a96053fe13 dhclient: also request 'static-routes' option from DHCP server (rh #922558)
DHCP server won't send 'Static Route' option to the client if it is not
explicitly requested.
2013-03-20 10:00:42 +01:00
Dan Williams
6551e9bbc4 core: don't fail IPv6 if otherconf/info-only DHCPv6 fails
Just like we don't fail IPv4 if DHCP fails to get DNS servers,
don't fail IPv6 if we've already got an RA and for some reason
DHCPv6 fails.  otherconf/info-only DHCP is not mandatory, and
lack of results thus should not fail the entire IPv6 config,
since DNS servers can also be passed in the RA.

RFC4861:

1-bit "Other configuration" flag.  When set, it
indicates that other configuration information is
available via DHCPv6.  Examples of such information
are DNS-related information or information on other
servers within the network.
2013-03-14 13:57:52 -05:00
Jiří Klimeš
df1a1bf69e keyfile: fix reading unmanaged-devices for interface name
[keyfile]
unmanaged-devices=interface-name:eth0
2013-03-14 12:03:47 +01:00
Pavel Šimerda
a290c5c3a6 Revert "trivial: remove nm-netlink-monitor.h from main"
This reverts commit 272335a2cf.

Done by mistake. Sorry.
2013-03-13 23:52:14 +01:00
Pavel Šimerda
272335a2cf trivial: remove nm-netlink-monitor.h from main
nm-netlink-monitor is deprecated and the only consumer that still uses
it is nm-ip6-manager, which will start it on its own.

Conflicts:
	src/main.c
2013-03-13 23:08:06 +01:00
Pavel Šimerda
fa86a377a0 main: don't activate nm-netlink-monitor
It will be activated by the first module that needs it.
2013-03-13 22:15:37 +01:00
Pavel Šimerda
363dece23b netlink: don't ref/unref the singleton 2013-03-13 22:15:29 +01:00
Dan Winship
d9e87d933b core: document some NMDevice methods 2013-03-13 16:45:19 -04:00
Dan Winship
c308e75b92 core: allow marking a device unmanaged by its interface name
Virtual devices often don't have stable hardware addresses. So allow
for marking a device unmanaged via its interface name instead.

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:19 -04:00
Dan Winship
611df342af core: make nm_device_check_connection_compatible() check interface-name
If an NMConnection specifies an interface-name, it is only compatible
with a device with the same iface.

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:19 -04:00
Dan Winship
cda65e1802 settings: read/write NMSettingConnection:interface-name
https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:18 -04:00
Dan Winship
1cc367711d core: simplify nm_device_get_best_auto_connection()
As with the other connection-matching methods, move the loop and the
device-independent bits into NMDevice. By reusing
nm_device_check_connection_compatible(), this means that most device
types now no longer need any type-specific code for this.

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 13:21:59 -04:00
Dan Winship
971bab01ea core: simplify/rename nm_device_connection_match_config()
nm_device_connection_match_config() sounded more generic than it
really was; rename it to nm_device_find_assumable_connection(), which
is what it really does.

There was also a lot of redundancy/cut+paste in the subclass
implementations of connection_match_config(); Improve things by moving
the looping-over-connections code into NMDevice itself, and also doing
the general-device-compatibility and IP-config checking there, leaving
the device subclasses to just verify L2 properties. Which most of them
aren't doing...

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 13:21:59 -04:00
Dan Winship
a3f6af817b core: simplify nm_device_spec_match_list()
Since NMDevice has a generic get_hw_address() method now, it can do
nm_device_spec_match_list() itself (for everything except ethernet,
which needs to match against s390 subchannels too).

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 13:21:59 -04:00
Dan Winship
1a8790b2a0 core: fix NMDeviceEthernet matching
nm_device_connection_match_config() on an ethernet connection could
succeed for a device that was in the connection's
mac-address-blacklist, but then NM would immediately fail to activate
the connection because nm_device_connection_compatible() would check
the blacklist and return FALSE. Fix the former to match the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 13:21:59 -04:00
Jiří Klimeš
cc66b547cf device: do not call nm_system_iface_set_up() with invalid index (rh #920145)
in hw_take_down()

usb 1-3: USB disconnect, device number 6
modem-manager[547]: <info>  (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3
<info>  (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3
<info> (ttyACM0): device state change: disconnected -> unmanaged (reason 'removed') [30 10 36]
<info> (ttyACM0): cleaning up...
<info> (ttyACM0): taking down device.
nm_system_iface_set_up: assertion `ifindex > 0' failed
2013-03-13 09:34:51 +01:00
Pavel Šimerda
b4954be855 modem: it is not a problem to flush IPv6 global routes
Whether they are supported or not. We already remove all addressess.
2013-03-12 18:48:34 +01:00
Jiří Klimeš
8e748bced8 core: fix find_vlan_parent() to return proper device (bgo #695362)
when VLAN parent device is identified through a connection UUID
2013-03-12 18:01:11 +01:00
Jiří Klimeš
0e92228476 trivial: remove extra semicolons 2013-03-12 09:32:47 +01:00
Dan Williams
c636fe88e3 config: rename fill_from_file() to read_config() 2013-03-11 14:45:12 -05:00
Dan Williams
875c1af2fd core: use Config object for connectivity checking parameters 2013-03-11 14:45:12 -05:00
Dan Williams
2e0fead744 config: fix bounds of connectivity_interval values
0 means "turn off connectivity checking", so we can't use that to
determine whether or not the interval has already been set by
command-line options or not.  Instead, store the interval
internally as a signed int and use -1 to mean "not yet set".

Second, validate input values for interval to ensure they can't
be less than 0 or more than G_MAXINT.
2013-03-11 14:45:11 -05:00
Jonh Wendell
06dca1b056 config: honor CLI arguments when config file is not found
If no config file was present, the Config object is returned empty
even if some options were passed via the command-line.
2013-03-11 14:44:47 -05:00
Dan Williams
f378c10e01 trivial: move NMConfig GObject functions to the bottom
More closely match the style of other objects in NM, where the
actual logic is nearer the top, and GObject stuff is near the bottom.
2013-03-11 14:44:46 -05:00
Thomas Bechtold
c910a52241 config: convert NMConfig to object 2013-03-11 14:43:24 -05:00
Dan Williams
20031e1846 ifcfg-rh: save bridge STP disabled setting (bgo #694841)
STP defaults to yes in NetworkManager (and the initscripts), so a missing
STP value in an ifcfg file means yes/on.  Calling svSetValue(STP, NULL)
clears that line from the ifcfg, and thus STP gets interpreted as yes.
Explicitly set stp to "no" so that the value actually gets saved.
2013-03-08 15:43:45 -06:00
Dan Williams
4cdb841881 wifi: optimize AvailableConnections updating on device disable
Call recheck_available_connections() once after removing all APs,
not every time we remove an AP.
2013-03-08 09:27:51 -06:00
Dan Williams
ec781ff9d5 core: fix leak of StateReason struct
==23089== 38,232 (4,248 direct, 33,984 indirect) bytes in 177 blocks are definitely lost in loss record 5,122 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B98371B1: g_value_array_new (gvaluearray.c:140)
==23089==    by 0x31FB81B67D: valuearray_constructor (dbus-gvalue-utils.c:771)
==23089==    by 0x42DD8F: get_property (nm-device.c:4675)
==23089==    by 0x39B9819C64: g_object_get_property (gobject.c:1289)
==23089==    by 0x31FB80DA49: object_registration_message (dbus-gobject.c:1322)
==23089==    by 0x363961DA44: _dbus_object_tree_dispatch_and_unlock (dbus-object-tree.c:858)
==23089==    by 0x363960FA82: dbus_connection_dispatch (dbus-connection.c:4685)
==23089==    by 0x31FB80AC44: message_queue_dispatch (dbus-gmain.c:90)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
2013-03-08 09:27:51 -06:00
Dan Williams
b711256a5c core: fix use-after-free
'device' is freed by nm_ip6_manager_cancel_addrconf().  Plus if
addrconf fails, the DHCP options should be ignored anyway.

==23089== Thread 1:
==23089== Invalid read of size 4
==23089==    at 0x4861E0: finish_addrconf (nm-ip6-manager.c:444)
==23089==    by 0x39B904F7EA: g_timeout_dispatch (gmain.c:3882)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
==23089==    by 0x39B904EF87: g_main_context_iterate.isra.23 (gmain.c:3146)
==23089==    by 0x39B904F381: g_main_loop_run (gmain.c:3340)
==23089==    by 0x426188: main (main.c:614)
==23089==  Address 0xcdb791c is 60 bytes inside a block of size 152 free'd
==23089==    at 0x4A07786: free (vg_replace_malloc.c:446)
==23089==    by 0x39B905499E: g_free (gmem.c:252)
==23089==    by 0x39B90692FE: g_slice_free1 (gslice.c:1111)
==23089==    by 0x39B903EC49: g_hash_table_remove_internal (ghash.c:1274)
==23089==    by 0x4861DC: finish_addrconf (nm-ip6-manager.c:443)
==23089==    by 0x39B904F7EA: g_timeout_dispatch (gmain.c:3882)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
==23089==    by 0x39B904EF87: g_main_context_iterate.isra.23 (gmain.c:3146)
==23089==    by 0x39B904F381: g_main_loop_run (gmain.c:3340)
==23089==    by 0x426188: main (main.c:614)
2013-03-08 09:27:51 -06:00
Dan Williams
7badb7ae43 trivial: remove unused define 2013-03-07 16:29:03 -06:00
Colin Walters
dc6f5f5dd7 keyfile: handle NetworkManager.conf not existing
Since in gnome-ostree we're trying to move towards an empty /etc.
We'll create it on demand if necessary.
2013-03-07 15:49:28 -06:00
Colin Walters
21ba714f78 keyfile: Use "goto out" style error handling
Just code cleanup: This is much less error-prone than manual nesting,
and will mesh very well with future changes to use the libgsystem
cleanup macros.
2013-03-07 15:46:15 -06:00
Dan Winship
6f44b7f3c6 all: remove redundant return-if-fail checks
NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate
(x != NULL) check before it.
2013-03-07 07:32:27 -05:00
Pavel Šimerda
bf32605287 cleanup: remove unnecessary headers from nm-netlink-monitor.h
Accomodate nm-netlink-monitor.c to the change by moving around utility
functions and making them static (removing if not used). Unsubscription
of rtnl groups is not necessary and the whole process will be eventually
moved to nm-platform.
2013-03-06 11:59:07 +01:00
Pavel Šimerda
8f758b0af9 cleanup: remove nm-netlink-compat 2013-03-05 23:02:50 +01:00
Pavel Šimerda
47a3e24d32 netlink: replace libnl 1.x functions
Confusingly, nm-platform-compat's rtnl_link_set_oif adds a new nexthop
with ifindex set, while rtnl_link_set_gateway sets gateway for an
existing nexthop. Keeping the behavior to avoid potential problems.
2013-03-05 23:02:42 +01:00
Pavel Šimerda
92481c6a6a ip6: replace libnl 1.x functions 2013-03-05 20:22:47 +01:00
Pavel Šimerda
487afb779c ip6: use delayed execution to avoid duplicate events
device_sync_from_netlink() and nm_netlink_request_ip6_info() are now
delayed, so that they are called only once for a series of events. This
makes the IPv6 processing and especially debug messages more sane.
2013-03-05 02:34:21 +01:00
Pavel Šimerda
896af74097 ip6: replace timed polling with event-based call
Request IPv6 flags from kernel on RTM_NEWROUTE/RTM_DELROUTE instead
of requesting periodically.
2013-03-05 02:32:42 +01:00
Pavel Šimerda
a93fb28d1a ip6: don't subscribe for RTM_PREFIX messages 2013-03-05 02:29:50 +01:00
Pavel Šimerda
195a09d7c0 ip6: fix rtnl_route_alloc_cache() call
NL_AUTO_PROVIDE is not a valid flag for this call and it's coincidental
with ROUTE_CACHE_CONTENT, which is certainly not what we want.

NETLINK_ROUTE is a netlink family, not an address family. It is
coincidental with AF_UNSPEC which is what we actually want.
2013-03-05 02:29:43 +01:00
Pavel Šimerda
fc41ae3ac6 ip6: use assert for fatal errors during initialization 2013-03-05 01:49:18 +01:00
Pavel Šimerda
54746d5ed4 ip6: clean up and improve debugging
Stop logging the whole list of addresses as we already have new and lost
addresses logged. Stop putting 'state' and 'ra_flags' in almost every
message since changes of those are already logged. Log target state
change.
2013-03-05 01:49:13 +01:00
Pavel Šimerda
9dddb51af2 ip6: rename got-ra to got-router-advertisement 2013-03-05 01:02:37 +01:00
Pavel Šimerda
649c21bbc9 trivial: add missing standard includes
This will help later cleanups of nm-system.
2013-03-04 22:11:54 +01:00
Dan Williams
a096ef8f87 core: fix more GValueArray deprecation fallout 2013-02-27 18:09:52 +01:00
Dan Williams
97990135f1 dhcp: ensure any dhclient script from dhclient.conf is ignored
The config file can specify a dhclient script, which gets used instead
of what NM passes on the command-line.  Make sure that script gets
ignored in the final dhclient config, because the script NM passes
is the script that needs to be used to pass data back to NM.  People
may have old dhclient.conf files lying around that get picked up and
we don't want any script specified there to interfere.
2013-02-27 17:17:11 +01:00