Commit graph

7671 commits

Author SHA1 Message Date
Jiří Klimeš f36c7301f0 libnm-util: more verbose verification errors for :interface-name 2013-03-14 11:00:45 +01:00
Jiří Klimeš 2295e5fbe0 libnm-util: add the detailed description of interface-name to blurb as well
So that the description is in the generated documentation and nm-settings(5)
manual page.
2013-03-14 10:36:50 +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 dbbec9b7d7 libnm-glib: match interface name in nm_device_connection_compatible()
Do NMSettingConnection:interface-name matching on the client side as
well, so that, eg, nm-applet does not list connections under the wrong
device.

(Also, move some return-if-fail checks from the subclass method
implementations into the wrapper function.)

https://bugzilla.gnome.org/show_bug.cgi?id=693684
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 2d668d763e libnm-util: add 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š df142a5dc4 libnm-util: make property verification errors more descriptive
- fix g_set_error()/g_set_error_literal() usage
- make the error messages translatable
- use g_prefix_error() to prepend property name
2013-03-13 17:47:11 +01: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
Dan Williams 44bcc990f7 build: distribute autogen.sh 2013-03-12 15:43:43 -05:00
Dan Williams f5f76dfd74 build: fix Vala bindings build and distcheck
Didn't handle srcdir != builddir and got installed without PREFIX.
2013-03-12 14:27:31 -05:00
Milo Casagrande c7df1ad224 po: updated Italian translation (bgo #695637) 2013-03-12 14:50:29 -04: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 fa97543186 libnm-util: free temporary decoded base64 data when parsing OpenSSL key files
==7347== 1,201 bytes in 1 blocks are definitely lost in loss record 5,016 of 5,107
==7347==    at 0x4A06B0F: calloc (vg_replace_malloc.c:593)
==7347==    by 0x39B90548E6: g_malloc0 (gmem.c:189)
==7347==    by 0x39B9026F8D: g_base64_decode (gbase64.c:407)
==7347==    by 0x4C51CA1: parse_old_openssl_key_file (crypto.c:227)
==7347==    by 0x4C51EC3: crypto_decrypt_private_key_data (crypto.c:497)
==7347==    by 0x4C529BE: crypto_verify_private_key_data (crypto.c:706)
==7347==    by 0x4C52B7B: crypto_verify_private_key (crypto.c:735)
==7347==    by 0x4C5CCC5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1633)
==7347==    by 0xC8F64D4: eap_tls_reader (reader.c:2270)
==7347==    by 0xC8F4886: fill_8021x (reader.c:2704)
==7347==    by 0xC8F8311: wireless_connection_from_ifcfg (reader.c:2825)
==7347==    by 0xC8FAFD2: connection_from_file (reader.c:4303)
2013-03-08 09:27:51 -06:00
Dan Williams c22e4da986 libnm-util: free PPPoE setting private data members
==23089== 342 bytes in 38 blocks are definitely lost in loss record 4,870 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B906A4BB: g_strdup (gstrfuncs.c:356)
==23089==    by 0x31FC02DA90: set_property (nm-setting-pppoe.c:220)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
==23089==    by 0x39B903F8DF: g_hash_table_foreach (ghash.c:1524)
==23089==    by 0x31FC01756C: nm_connection_duplicate (nm-connection.c:1203)
==23089==    by 0x4A7BE3: get_settings_auth_cb (nm-settings-connection.c:1062)
==23089==    by 0x4A5624: auth_start (nm-settings-connection.c:1008)
2013-03-08 09:27:51 -06:00
Dan Williams ca00badb03 libnm-util: free temporary string when parsing OpenSSL key files
'str' was not freed anywhere.

==23089== 2,072 (24 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 5,063 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 0x39B906C7FA: g_string_sized_new (gstring.c:121)
==23089==    by 0x39B906CE75: g_string_new_len (gstring.c:186)
==23089==    by 0x31FC0149CE: parse_old_openssl_key_file (crypto.c:150)
==23089==    by 0x31FC014E33: crypto_decrypt_private_key_data (crypto.c:494)
==23089==    by 0x31FC01592E: crypto_verify_private_key_data (crypto.c:703)
==23089==    by 0x31FC015AEB: crypto_verify_private_key (crypto.c:732)
==23089==    by 0x31FC0200E5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1640)
==23089==    by 0xC694304: eap_tls_reader (reader.c:2280)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
2013-03-08 09:27:51 -06:00
Dan Williams 2878481c09 libnm-util: free temporary GByteArray when using NM_SETTING_802_1X_CK_SCHEME_PATH
If the certificate's format was valid, but we're asked to refer to it by
paths instead of using the raw data, 'data' would be leaked.

==23089== 8,232 (40 direct, 8,192 indirect) bytes in 1 blocks are definitely lost in loss record 5,109 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 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01ED26: nm_setting_802_1x_set_client_cert (nm-setting-8021x.c:819)
==23089==    by 0xC6944A4: eap_tls_reader (reader.c:2316)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
==23089==
==23089== 8,352 (160 direct, 8,192 indirect) bytes in 4 blocks are definitely lost in loss record 5,110 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 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01E5E6: nm_setting_802_1x_set_ca_cert (nm-setting-8021x.c:538)
==23089==    by 0xC694DD8: eap_peap_reader (reader.c:2358)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
2013-03-08 09:27:51 -06:00
Dan Williams 0f5b91ad2e libnm-util: fix leak of s390 subchannels
==23089== 7,293 (1,248 direct, 6,045 indirect) bytes in 39 blocks are definitely lost in loss record 5,100 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 0x39B9024E90: g_ptr_array_sized_new (garray.c:884)
==23089==    by 0x31FB81B3FC: ptrarray_copy (dbus-gvalue-utils.c:1047)
==23089==    by 0x31FB81845C: proxy_value_copy (dbus-gtype-specialized.c:446)
==23089==    by 0x39B980F51E: g_boxed_copy (gboxed.c:359)
==23089==    by 0x31FC03134C: set_property (nm-setting-wired.c:619)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
2013-03-08 09:27:51 -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
Pavel Šimerda e98d6430a8 misc: add toplevel .dir-locals file that tells Emacs to show trailing whitespace
To help developers avoid adding any.
2013-03-08 15:15:28 +01:00
Pavel Šimerda 9ba40ca886 cleanup: remove obsolete nmnetlink.test.c 2013-03-08 15:12:13 +01:00
Enrico Nicoletto cff78d8f49 po: updated Brazilian Portuguese (pt_BR) translation (bgo #694959) 2013-03-08 10:54:54 +01: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
Dan Winship 0006c6aa1d trivial: update .gitignore 2013-03-07 07:12:53 -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