Commit Graph

8286 Commits

Author SHA1 Message Date
Pavel Šimerda
c6ba3ca51b core: use nm_platform_master_*_option() for bonds
Acked-by: Dan Winship <danw@gnome.org>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
9e19c3dba5 core: use nm_platform_*_*_option() for bridges
And refactor to prepare for update_connection() implementation.

Acked-by: Dan Winship <danw@gnome.org>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
e96b5d82bd platform: fix and simplify address lifetime compensation
Acked-by: Dan Williams <dcbw@redhat.com>
2013-08-31 00:47:11 +02:00
Pavel Šimerda
c5c8fbea12 trivial: remove unused 'existing' parameter from get_connections() 2013-08-31 00:47:11 +02:00
Thomas Haller
f4118492b6 fix: avoid call to g_file_test with NULL path in nm-dhcp-dhclient.c
Calling g_file_test with a NULL path causes valgrind to complain.

 NetworkManager[24512]: <debug> [1377884547.687536] [dhcp-manager/nm-dhcp-dhclient.c:482] create_dhclient_config(): (em1): no existing dhclient configuration to merge
 ==24512== Syscall param access(pathname) points to unaddressable byte(s)
 ==24512==    at 0x3F976E7627: access (in /usr/lib64/libc-2.17.so)
 ==24512==    by 0x4EDA556: g_file_test (in /usr/lib64/libglib-2.0.so.0.3600.3)
 ==24512==    by 0x49BB69: create_dhclient_config (nm-dhcp-dhclient.c:364)
 ==24512==    by 0x49CC39: ip4_start (nm-dhcp-dhclient.c:671)

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 19:53:25 +02:00
Thomas Haller
f218f9195b fix: nm-device-wifi disconnect signal from supplicatant.iface==NULL
This fixes a glib assertion.

Backtrace:
 #0  0x00007f139ab08e0d in g_logv () from /lib64/libglib-2.0.so.0
 #1  0x00007f139ab08ff2 in g_log () from /lib64/libglib-2.0.so.0
 #2  0x0000003f9aa3151a in g_type_check_instance () from /lib64/libgobject-2.0.so.0
 #3  0x0000003f9aa272d4 in g_signal_handlers_disconnect_matched () from /lib64/libgobject-2.0.so.0
 #4  0x0000000000495b7d in supplicant_interface_release (self=0xc58040) at devices/nm-device-wifi.c:423
 #5  0x0000000000498a28 in dispose (object=0xc58040) at devices/nm-device-wifi.c:3525
 #6  0x0000003f9aa14338 in g_object_unref () from /lib64/libgobject-2.0.so.0
 #7  0x000000000047699a in remove_device (manager=manager@entry=0xc09050, device=0xc58040, quitting=quitting@entry=1) at nm-manager.c:748
 #8  0x0000000000478a84 in dispose (object=0xc09050) at nm-manager.c:4558
 #9  0x0000003f9aa14338 in g_object_unref () from /lib64/libgobject-2.0.so.0
 #10 0x0000000000428cc0 in main (argc=1, argv=0x7fffc0948c98) at main.c:626

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 19:28:27 +02:00
Dan Williams
0c15e1c2ce fix: glib assertion in nm-agent-manager, cancelling completed dbus call
This fixes a glib assertion:
"dbus_g_proxy_cancel_call: assertion `pending != NULL' failed"

Backtrace:
 #0  0x00007f962dad9e0d in g_logv () from /lib64/libglib-2.0.so.0
 #1  0x00007f962dad9ff2 in g_log () from /lib64/libglib-2.0.so.0
 #2  0x00000000004a84bd in nm_secret_agent_cancel_secrets (self=0x213b300, call=0x1) at settings/nm-secret-agent.c:331
 #3  0x00000000004a4068 in request_free (req=0x216a490) at settings/nm-agent-manager.c:479
 #4  0x00007f962dac25fa in g_hash_table_remove_internal () from /lib64/libglib-2.0.so.0

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-30 18:23:24 +02:00
Dan Winship
8c167c1f8f core: fix NMPolicy/NMManager refcounting
NMManager owns the NMPolicy now, so the policy should not be holding a
ref on the manager.
2013-08-30 09:33:43 -04:00
Pavel Šimerda
2371ee6168 trivial: rename nm_settings_add_connection*() functions
It makes more sense to use basic name for the basic function and
suffixed name for the special one.

Acked-by: Dan Williams <dcbw@redhat.com>
2013-08-30 10:54:29 +02:00
Pavel Šimerda
e0c2b970d6 trivial: add some comments to nm-device's link-changed handlers
Acked-by: Dan Winship <danw@gnome.org>
2013-08-30 10:54:20 +02:00
Colin Walters
ff89e98fac trivial: consistently #include "libgsystem.h" rather than just gsystem-local-alloc.h
libgsystem contains more than just the local allocation macros; in the
future we will likely want to make use of some of this such as the
structured logging support.
2013-08-29 16:16:35 -05:00
Dan Williams
f35c8e3e4a gsystem: update libgsystem for compiler warning fixes 2013-08-29 16:16:26 -05:00
Thomas Haller
38213b0524 platform: add nm_platform_*_to_string functions
Add *_to_string functions for address (ip4 and ip6) and
route (ip4 and ip6). Also refactor the previously existing
nm_platform_ip4_route_to_string function.

The to_string function returns a pointer to an internal
buffer. Also update log_* functions to make use of the new
to_string functions.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-29 22:16:45 +02:00
Colin Walters
5fcf647a28 nm-activation-request: Make use of libgsystem local allocations
Just cleaner code.

Reviewed-by: Pavel Šimerda <psimerda@redhat.com>
2013-08-29 15:16:34 -04:00
Dan Williams
a9b9330bed build: fix builddir != srcdir when building D-Bus API spec HTML 2013-08-29 13:43:03 -05:00
Jiří Klimeš
1be3bf17bc cli: add missing 802-1x setting for Wi-Fi connections in the editor
Without that Enterprise type Wi-Fi could not be edited via the nmcli
interactive editor.
2013-08-29 15:56:48 +02:00
Jiří Klimeš
d7788b0d46 cli: fix TAB-completion for aliases in interactive editor
Before the change if an alias for a setting name existed, it was used instead of
the real name and TAB-completion for the real name didn't work.

before:
nmcli> goto 802<TAB>
no output

now:
nmcli> goto 802<TAB>
nmcli> goto 802-11-wireless
802-11-wireless           802-11-wireless-security

nmcli> goto <TAB>
802-11-wireless-security (wifi-sec)  connection                       ipv6
802-11-wireless (wifi)               ipv4
2013-08-29 15:36:55 +02:00
Jiří Klimeš
d646cf909f cli: disable setting 'rate' and 'tx-power' properties in editor
The properties are not implemented in NM core, nor in ifcfg-rh plugin. Thus
they are not preserved over re-reading from ifcfg-* file. Moreover they are
highly dependent on drivers.
When we allowed editing them, the connection changed after re-reading and
was marked as dirty (and users were puzzled).
2013-08-29 13:43:00 +02:00
Jiří Klimeš
d3abb8c79a policy: fix build with glib < 2.34
Use our compatibility version for g_clear_pointer() that is not defined
in glib < 2.34.
2013-08-29 10:22:27 +02:00
Jiří Klimeš
f56d0c2baf trivial: nm_connectivity_check_async() returns void -> use g_return_if_fail() 2013-08-29 10:22:22 +02:00
Thomas Haller
5b449631de core: fix warning about unused variable
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 17:41:28 +02:00
Dan Winship
f668423832 libnm-glib: Add NMClient:primary-connection and :activating-connection
https://bugzilla.gnome.org/show_bug.cgi?id=704841
2013-08-28 11:01:43 -04:00
Dan Winship
8267f5d198 core: add NMManager:primary-connection and :activating-connection
Add properties to track the "primary" connection (ie, the active
connection with either the default route, or the route to the VPN with
the default route), and the active connection that is currently
activating, and likely to become the :primary-connection when it
completes.

https://bugzilla.gnome.org/show_bug.cgi?id=704841
2013-08-28 11:01:13 -04:00
Dan Winship
5c716c8af8 core: make NMPolicy a GObject
And make it owned by NMManager, rather than being a separate top-level
object.
2013-08-28 10:58:49 -04:00
Dan Winship
a854a273c9 cli: add connectivity support 2013-08-28 10:54:09 -04:00
Dan Winship
84919405e1 libnm-glib: support new connectivity property/methods 2013-08-28 10:54:09 -04:00
Dan Winship
07521da591 core: provide additional network connectivity information
NM_STATE_CONNECTED_SITE doesn't distinguish between "behind a captive
portal" and "limited network connectivity" (ie, connected to a router
that has lost its upstream connection). Add a new NMManager
:connectivity property to provide this information.

Also add a CheckConnectivity method, which can be used to force NM to
re-check the connectivity state, which could be called by a client
after it completed a portal login, or fixed a network problem.
2013-08-28 10:54:08 -04:00
Dan Winship
8732914815 core: improve NMManager:state transitions with connectivity checking
The connectivity-checking code would generally result in
NMManager:state going CONNECTING -> CONNECTED_GLOBAL -> CONNECTED_SITE
in the case where the connectivity check failed. The brief incorrect
CONNECTED_GLOBAL is bad, because clients might see it and do the wrong
thing.

Instead, when we are ready to switch from CONNECTING to CONNECTED_*,
do a connectivity check first, and switch to either CONNECTED_SITE or
CONNECTED_GLOBAL based on the result of that.
2013-08-28 10:54:08 -04:00
Dan Winship
52813b48c1 core: add LOGD_CONCHECK, log unexpected concheck responses at LOGL_INFO 2013-08-28 10:54:08 -04:00
Dan Winship
91f810abfe core: build NMConnectivity unconditionally, possibly as a no-op
Build and use NMConnectivity regardless of build options; if you build
without libsoup, NMConnectivity will just always report that you have
full connectivity (like it does when you build with libsoup but don't
enable connectivity checking).
2013-08-28 10:54:08 -04:00
Dan Winship
6885da2648 core: clean up connectivity code a bit
Remove some unnecessary comments and some unnecessary code. Fix
indentation.
2013-08-28 10:54:08 -04:00
Dan Winship
552ed76f59 core: make log domains 64-bit 2013-08-28 10:54:08 -04:00
Thomas Haller
c3ea945c19 nmcli: fix errors in nmcli help output and man page
Fix some spelling errors and wrong parameter description. Also add the
team connection to the manual page.

https://bugzilla.redhat.com/show_bug.cgi?id=997566

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 15:26:50 +02:00
Thomas Haller
2d2b2a48eb cli: change completion to suggest connection ids
Before, whereever a connection id is accepted, the completion only
offered 'id', 'uuid', 'path', etc. With this change, it will additionally
suggest the id of existing connections.

https://bugzilla.redhat.com/show_bug.cgi?id=997997

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 14:36:49 +02:00
Thomas Haller
ab231cb0d9 cli: improve bash completion by parsing options separately.
To support optimal completion, more context must be considered.
Especially the OPTIONS, which must appear before the OBJECT.
Modify bash completion to try parsing first the options.

Before, whenever you had options, completion did not work
anymore (because the object was expected as first argument).
Moreover, options were also suggested after specifying the
object. This is now mitigated by parsing the command line
in two steps.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-28 14:36:49 +02:00
Thomas Haller
2a0ec59dba ifcfg-rh: do not write IPV6_DEFAULTGW=:: for missing gateway
This also slighly changes the behaviour for writing IPV6_DEFAULTGW.
- IPV6_DEFAULTGW will be written after IPV6ADDR and
  IPV6ADDR_SECONDARY.
- Before, if there were no IPv6 addresse present, the IPV6_DEFAULTGW
  might not have been cleared. Now IPV6_DEFAULTGW is always written
  (or unset as in the case of gateway ::).

https://bugzilla.redhat.com/show_bug.cgi?id=997759

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-27 20:58:46 +02:00
Jiří Klimeš
bb72d2e4e2 ifcfg-rh: fix distcheck 2013-08-27 15:03:45 +02:00
Jiří Klimeš
3cb0bf6bc0 cli: consider empty value as "*" for "Interface name: " prompt 2013-08-27 10:20:41 +02:00
Thomas Haller
c822b12cf1 core: add nm_platform_ip4_route_to_string for debugging
Add convenience function to convert an IPv4 route to string.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-26 23:37:36 +02:00
Thomas Haller
fbde824584 core: fail activation when a route cannot be added
Before, when a route failed to be added, NM stopped adding further
routes. However, the activation still continued and the user was not
notified about the error.

Adding a route might fail for example if the gateway is not on one of
the subnets of the interface.

Now, a failure to add a route makes the activaion fail. If the
connection has autoconnect=yes, this might result in some unsuccessful
reconnection attempts.

In the future, we might want to distinguish between manually added routes
and routes from RA/DHCP. So that connecting to a wrongly configured DHCP
server still works for most parts.

https://bugzilla.redhat.com/show_bug.cgi?id=999544

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-26 23:36:38 +02:00
Dan Williams
179dae7c68 core: fix setting is_software for software devices created by NM
These devices don't have a platform device at creation time, thus
is_software wasn't getting set properly.  Move the is_software
decision to constructed() because by this point, the iface and
ifindex (if present) will be known for all cases and thus we can
figure out if it's a software device or not in one place.
2013-08-26 13:14:01 -05:00
Pavel Šimerda
993c0a02d5 update libgsystem submodule 2013-08-26 18:36:11 +02:00
Milo Casagrande
231a166e97 po: updated Italian (it) translation (bgo #706245)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-26 12:16:01 +02:00
Thomas Haller
94dfe2856c core: fix leaking route instance in nm_ip4_config_update_setting
The fix in commit b5b43a6d65 missed the
release of the route instance (because nm_setting_ip4_config_add_route
does not take over the passed route but duplicates it).

So the orginal error was to free the route with the wrong deallocation
method gs_unref_object instead of nm_ip4_route_unref.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-26 10:56:16 +02:00
Thomas Haller
a7588227ed cli: bugfix verification for wifi channel in edit mode
This bug caused the edit mode to refuse most of the valid wifi channels.
The bug was present since the beginning, so all versions before this
commit will have this issue.

https://bugzilla.redhat.com/show_bug.cgi?id=999999

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-23 17:13:56 +02:00
Thomas Haller
b5b43a6d65 core: fix wrong unref in nm-ip4-config/nm_ip4_config_update_setting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-23 15:44:31 +02:00
Pavel Šimerda
68e250f86a core: reset ipv6 sysctls only for managed devices
Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
2013-08-22 22:06:47 +02:00
Pavel Šimerda
0e1ceaa63a core: implement update_connection() for Ethernet
Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
2013-08-22 22:06:47 +02:00
Pavel Šimerda
c1f45eb2df core: match connections to connections instead of devices
This backwards compatible patch adds the possibility to use new
nm_device_generate_connection() API via update_connection() virtual
method implementations in NMDevice subclasses.

Compatibility is achieved by first trying to use the older API and
match_l2_config() virtual method and only then moving on to
update_connection().

The nm_device_generate_connection() calls update_connection() to create
type-specific NMSetting instances and verifies the connection before
returning it. To avoid tinkering with NMSettingConnection in
update_connection() we use a class attribute called connection_type
which is used by nm_device_generate_connection() itself.

Known issues:

* nm_device_generate_connection() method doesn't implement DHCP lease
configuration matching. We shouldn't actually need it but if a use case
for that will come out, we can fix it later.

* nm_device_generate_connection() doesn't fill in the slave-specific
options.

* update_connection() is not implemented and connection_type is not set
in the subclasses. This will be fixed in individual patches.

* NMSetting's compare_property() implementations in combination with
NM_SETTING_COMPARE_FLAG_CANDIDATE are not yet fully ready thus rendering
false negatives in some cases. Same as above.

Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
2013-08-22 22:06:47 +02:00
Pavel Šimerda
2a4a359eb1 libnm-util: add NM_SETTING_COMPARE_FLAG_CANDIDATE flag
Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
2013-08-22 22:06:47 +02:00