Commit Graph

13873 Commits

Author SHA1 Message Date
Dan Williams
09bde40f02 core: fix PropertiesChanged signals for IP-related properties
To present a consistent API to clients, the IP-related properties
are only valid when the device has finished IP configuration.  But
they are set before that happens, and their change notifications
were emitted before the IP configuration was considered valid.
Re-emit the change notifications when the device enters the IP_CHECK
state (and thus has IP configuration) and also when the device
deactivates to enusre clients have up-to-date IP-related property
information.

For the changes to has_ip_config(), the priv->ipX_state checks are
not necessary since the device will have valid IP configuration
when it enters the IP_CHECK state.  The other checks can be
consolidated into a single statement.

Acked-by: Dan Winship
2013-10-09 13:59:42 -05:00
Dan Williams
b5fa0fec1c trivial: remove unnecessary warning 2013-10-09 09:39:57 -05:00
Thomas Haller
2b25d0d3e0 core: avoid use-after-free in libnm-util/bond.verify()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-08 22:33:19 +02:00
Enrico Nicoletto
e9a362ba65 po: updated Brazilian Portuguese (pt_BR) translation (bgo #709675)
https://bugzilla.gnome.org/show_bug.cgi?id=709675

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-08 21:16:18 +02:00
Dan Williams
9543e45afe core: allow IPv4 to proceed if IPv6 is globally disabled but set to "auto" (rh #1012151)
If the user disabled IPv6 support in the kernel with "ipv6.disable=1" on the
kernel boot line, then any attempts to open IPv6 sockets (which libndp does)
will fail.  This failed the entire connection, even if IPv6's "may-fail"
property was TRUE.  Instead, just fail IPv6 and allow IPv4 to proceed.  If
IPv4 fails or is disabled, then other logic will fail the entire connection.
2013-10-07 11:53:18 -05:00
Jiří Klimeš
2af8c08f65 ifcfg-rh: ignore default routes in route6 file (rh #991807)
Base on patch from Francesco Prelz <Francesco Prelz mi infn it>:
https://mail.gnome.org/archives/networkmanager-list/2013-January/msg00095.html

https://bugzilla.redhat.com/show_bug.cgi?id=991807
2013-10-07 18:10:27 +02:00
Dan Williams
87041545b4 ifcfg-rh: fix ignoring updates that don't change anything
connection_from_file() requires the 'error' parameter.  Not passing a
valid 'error' parameter causes the function to fail and return NULL,
which mean that commit_changes() would always re-write the connection
instead of ignoring commits where nothing has actually changed.

connection_from_file() no longer requires the unmanaged, keyfile,
or routefile parameters, so remove them.
2013-10-04 23:43:25 -05:00
Thomas Haller
6868076e3c test: launch dbus for test-remote-settings-client
Running `make check` on systems without running dbus failed
in test-remote-settings-client.c:383

    make[4]: Entering directory `/tmp/NetworkManager/libnm-glib/tests'
    /tmp/NetworkManager/libnm-glib/tests/test-remote-settings-client /tmp/NetworkManager/libnm-glib/tests test-remote-settings-service.py

    ** (/tmp/NetworkManager/libnm-glib/tests/.libs/lt-test-remote-settings-client:26983): WARNING **: Error connecting to D-Bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    make[4]: *** [check-local] Trace/breakpoint trap (core dumped)

Modify the Makefile to start the dbus-daemon, if it is not yet
running.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-04 17:02:43 +02:00
Thomas Haller
08670c9163 bluez: fix leak of NMBluezDevice in bluez_connect_cb
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-03 14:00:51 -05:00
Dan Williams
c4035ead5f core: fix nm_ip6_config_replace() nameserver address comparison 2013-10-03 13:59:18 -05:00
Dan Williams
da2f1d5870 trivial: print route prefix when printing RA discovered routes 2013-10-03 13:59:18 -05:00
Dan Williams
72ac1e38f9 rdisc: mask host bits off RA prefix (rh #1008104) (bgo #709230)
Some RA implementations (like radvd) dump whatever the user configures
onto the wire, accepting a prefix of "2001:db8:1:0::1/64" without
masking the host bits off.

This causes NetworkManager to send that route down to the kernel, which
*does* mask the host bits off.  This causes a mismatch between the
route NetworkManager expects the kernel to create, and what the kernel
actually created, when searching for the kernel object in the platform's
refresh_object() function:

	cache = choose_cache (platform, object);
	cached_object = nl_cache_search (choose_cache (platform, object), object);
	kernel_object = get_kernel_object (priv->nlh, object);

kernel_object is NULL since 'object' (a route which came from the RA
prefix) is not the same as the object the kernel actually did create.

Ensure we match kernel behavior by fixing up prefixes for dumb router
advertisement services.
2013-10-03 13:59:18 -05:00
Jiří Klimeš
b2ff06fc12 cli: fix a possible crash when casting NULL using NM_CONNECTION (rh #1011942)
https://bugzilla.redhat.com/show_bug.cgi?id=1011942
2013-10-03 19:14:16 +02:00
Dan Winship
cbe261caa2 libnm: more valgrinding fixes 2013-10-03 11:04:45 -04:00
Dan Winship
28e67c7d73 libnm-glib: fix the leak that breaks the shell network status icon
All NMObjects created in response to property changes were getting
leaked, which in particular included all NMAccessPoint objects, which
meant that after disconnecting and reconnecting a wifi interface some
number of times (depending on how many access points were in the
area), gnome-shell would be watching so many D-Bus AccessPoint objects
(most of which didn't exist any more) that it would hit dbus-daemon's
limit on the number of match rules you can register, which meant that
NMActiveConnections created after that point wouldn't be able to
register for PropertiesChanged notifications, which meant that the
network status icon would get out of sync.
2013-10-03 11:04:45 -04:00
Jiří Klimeš
8695410d86 cli: enhance TAB-completion in nmcli editor
- completion now works for command shortcuts too
  nmcli> g ethe<TAB>
- completion now allows leading spaces
  nmcli>   desc wifi.ss<TAB>
- fix completion of settings when property is already there
  nmcli> set con<TAB>.id
- fix completion of properties in setting.property
  nmcli> des con.inter<TAB> bla
2013-10-03 16:39:30 +02:00
Thomas Haller
78a8df37d8 cli: fix bash completion to show general options
This fixes an error in the following example:
  $ nmcli con add type bridge con-name test-bridge <TAB>

Before, general options such as 'autoconnect' and 'ifname' were
wrongly not suggested.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-03 16:05:44 +02:00
Thomas Haller
f4557256ea bluez: fix creation of NAP connection for bluez device
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:21:44 +02:00
Thomas Haller
e08687e1e2 team: do not g_source_remove after g_child_watch_add signal was emitted
g_child_watch_add only emits one signal and gets automatically
removed from the source. No need for double removal, so unset
teamd_process_watch before calling teamd_cleanup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:22 +02:00
Thomas Haller
67789cd476 team: fix missing teamd_cleanup in certain cases
Also ensure that teamd_timeout_cb does a state transition of the device.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:05 +02:00
Thomas Haller
154dcd948a team: fix startup of team by ignoring teamd_dbus_vanished at first
g_bus_watch_name immediatly emits a vanished signal, if the name does not exist
at the begining. So the first signal, does not indicate an actual change of
state and must be ignored.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:07:05 +02:00
Jiří Klimeš
23e90ee76d team: fix a crash on team devices (rh #1013593)
teamd was being watched using g_bus_watch_name(). But when the NM team device
was destroyed NM tried to remove the watcher with g_source_remove() instead of
g_bus_unwatch_name(). Thus the watcher was not removed and
teamd_dbus_appeared() was called on disposed device.

https://bugzilla.redhat.com/show_bug.cgi?id=1013593#c28

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 20:05:05 +02:00
Thomas Haller
e4fc7440cc team: ensure that teamd_start does not get called when already starting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 19:39:17 +02:00
Dan Williams
b573de0408 trivial: whitespace fix 2013-10-02 10:13:18 -05:00
Thomas Haller
f37686fba7 cli: add primary bonding option in bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-02 14:19:12 +02:00
Jiří Klimeš
e6fa711088 trivial: remove stray ')' from nmcli prompts in questions 2013-10-02 11:48:07 +02:00
Jiří Klimeš
62d113f6c2 cli: accept 'primary' bonding option 2013-10-02 11:48:07 +02:00
Jiří Klimeš
1bb78f6ecf cli: enhance questionnaire for bond connections (rh #1007355)
The session now looks like this:

There are optional arguments for 'bond' connection type.
Do you want to provide them? (yes/no) [yes]
Bonding mode [balance-rr]:
Bonding monitoring mode (miimon or arp) [miimon]: miimon
Bonding miimon [100]:
Bonding downdelay [0]:
Bonding updelay [0]:

...when answered arp...
Bonding arp-interval [0]:
Bonding arp-ip-target [none]:

https://bugzilla.redhat.com/show_bug.cgi?id=1007355
2013-10-02 11:48:07 +02:00
Jiří Klimeš
9e9afdb25b cli: fix memory leaks on questionnaires 2013-10-02 11:48:07 +02:00
Dan Williams
d3aae79e5c dhcp: fix IPv6 address prefixes (rh #1013583)
53e55aab36 mistakenly moved the address
prefix without moving the memset() to initialize the address.  Make
sure the address is initialized before trying to do anything with it.
2013-10-01 15:48:25 -05:00
Dan Williams
1b773f4e6e libnm-glib: make properties-changed debugging available at runtime
Use an environment variable LIBNM_GLIB_DEBUG=properties-changed to
indicate that properties-changed debugging messages should be printed.
Also cleans up the debug output formatting.
2013-10-01 11:17:59 -05:00
Jiří Klimeš
6d2e033a0e libnm-util: only remove ARP when MIIMON is being set to non-zero and vice versa
miimon or arp_interval == 0 means 'disable'. So we should not remove options of
one mode when the other mode is actually being disabled (set to zero).
2013-10-01 17:26:03 +02:00
Thomas Haller
0f88cb13f1 team: remove variable teamd_on_dbus that was always FALSE
The variable teamd_on_dbus in nm-device-team was never set to TRUE.
Remove it. Also, before teamd_dbus_vanished did never cleanup anything.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-01 11:45:46 +02:00
Thomas Haller
d11f41a8a0 team: fix wrong assertion in device-team
The assertion that priv->teamd_pid is set does not hold.

For example, if no teamd binary can be found, "Stage 1 of 5 (Device
Prepare)" fails with "Activation (nm-team) to start teamd: not found".
This causes the device state to become "failed" and later
"disconnected", which in turn calls teamd_stop without a valid teamd_pid
set.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-01 11:18:13 +02:00
Jiří Klimeš
f767e05f4a team: chain up parent dispose() in NMDeviceTeam dispose() (rh #1013593)
NMDeviceTeam dispose() did not chain up to parent dispose(). This prevented
parent dispose() to be called (only finalize()) and thus link_changed_cb()
and device_ip_changed() handlers were not disconnected. Later these handlers
were called on invalid device resulting in a crash.

https://bugzilla.redhat.com/show_bug.cgi?id=1013593
2013-10-01 10:23:12 +02:00
Thomas Haller
ed08a3fe04 cli: fix missing type option 'team' in mcli completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-30 19:07:18 +02:00
Jiří Klimeš
a74d3678d1 cli: use a generic function asking for both IPv4/IPv6 in questionnaire 2013-09-30 13:42:13 +02:00
Jiří Klimeš
5ba3e42b1e cli: be more verbose when adding IP addresses in questionnaire (rh #1006450)
Now the session looks like this:
Do you want to add IP addresses? (yes/no) [yes]
Press <Enter> to finish adding addresses.
IPv4 address (IP[/plen] [gateway]) [none]: 10.0.0.22/24 10.0.0.1
  Address successfully added: 10.0.0.22/24 10.0.0.1
IPv4 address (IP[/plen] [gateway]) [none]: 10.0.0.22/24 10.0.0.1
  Warning: address already present: 10.0.0.22/24 10.0.0.1
IPv4 address (IP[/plen] [gateway]) [none]: 192.168.1.1 abc
Error: invalid gateway 'abc'
IPv4 address (IP[/plen] [gateway]) [none]:
IPv6 address (IP[/plen] [gateway]) [none]: abcd::1234 ::2 blabla
  Address successfully added: abcd::1234 ::2
  Warning: ignoring garbage at the end: 'blabla'
IPv6 address (IP[/plen] [gateway]) [none]:
2013-09-30 13:39:44 +02:00
Jiří Klimeš
469febc0d9 rdisc: do not crash on NDP init failures (rh #1012151)
ndp_open() can fail, do not assume it cannot.
When 'ipv6.disable=1' kernel parameter is used, the whole IPv6 stack is
disabled and the attempt to create PF_INET6 socket fails.

https://bugzilla.redhat.com/show_bug.cgi?id=1012151
2013-09-30 12:08:35 +02:00
Dan Winship
e69727bf8a libnm-util: support the "primary" bond option 2013-09-27 09:34:41 -04:00
Jiří Klimeš
6b9b3adbd1 trivial: remove trailing spaces 2013-09-27 13:26:29 +02:00
Jiří Klimeš
282b9df60d vpn: fix VPN plugin D-Bus errors
The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*,
but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.*

Also update the errors documentation.
2013-09-27 13:26:29 +02:00
Jiří Klimeš
9dff830692 vpn: fix connecting to VPN (bgo #708255)
The ConnectInteractive() -> Connect() fallback code doesn't work, because
_connect_internal() changes the state to NM_VPN_SERVICE_STATE_STARTING before
checking if it can implement ConnectInteractive(), and then when the Connect()
call comes in, the VPN is not in STOPPED or INIT, so it returns an error.

The commit moves setting state to STARTING after the ConnectInteractive() check
availability, in the plugin. We introduce new plugin error and set it when the
the plugin does not implement ConnectInteractive(). NetworkManager uses this
error for ConnectInteractive() -> Connect() fallback.

https://bugzilla.gnome.org/show_bug.cgi?id=708255
2013-09-27 13:26:09 +02:00
Enrico Nicoletto
f9bb4bb2ca po: updated Brazilian Portuguese (pt_BR) translation (bgo #708869)
https://bugzilla.gnome.org/show_bug.cgi?id=708869

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-27 11:57:53 +02:00
Dan Winship
e98eb83a1a libnm-glib: fix cut+pasteo 2013-09-26 17:19:18 -04:00
Dan Williams
57c99c11fe core: don't run Bluetooth disconnect unless the device was connected
Don't unconditionally call disconnect during device deactivation, since
the device also gets deactivated in the UNAVAILABLE -> DISCONNECTED
state change, long before any Bluetooth connection has been made.
2013-09-26 15:50:00 -05:00
Dan Williams
a045c29638 api: clarify lifetime and behavior of ActiveConnection's SpecificObject property (rh #1012309)
It doesn't change once it's set, and it reflects the original
specific object used during activation.  It will not, for example,
switch to the currently active WiFi access point even if the
original access point that was used as the specific object disappears.
2013-09-26 12:17:51 -05:00
Jiří Klimeš
f820fbeeb3 examples: add an python example (using GI) showing Wi-Fi networks 2013-09-26 16:30:23 +02:00
Thomas Haller
1f4608e06e bluez: fix compile error in nm-bluez-device for BlueZ 4 (unused variable)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-26 13:41:12 +02:00
Dan Williams
1735fadc10 trivial: print a more informative warning if built for Bluez5 but Bluez4 is installed 2013-09-25 19:45:15 -05:00