Commit Graph

15047 Commits

Author SHA1 Message Date
Jiří Klimeš
d12b2079bf utils: fix check_possible_match() function
We can only allow possible match if all the differences are exceptions.
Before, we accepted the connection if an exception was found, but it is wrong
because there may be another difference (that is fatal).
2014-04-11 09:59:12 +02:00
Jiří Klimeš
583eba3828 core: sort connections in descending timestamp order on take-over (rh #1067712)
When assuming the connections on restart we want to prefer more-recently-used
connections. That's why we have to sort connections according to timestamps in
descending order. That means connections used more recently (higher timestamp)
go before connections with lower timestamp.

https://bugzilla.redhat.com/show_bug.cgi?id=1067712
2014-04-11 08:58:28 +02:00
Dan Williams
2200687b0f libnm-glib: add documentation for NMRemoteSettings and connection addition 2014-04-10 10:51:29 -05:00
Thomas Haller
7ef622b447 Merge branch 'th/bgo726287_cleanup_read_sysctl'
https://bugzilla.gnome.org/show_bug.cgi?id=726287

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:36:42 +02:00
Thomas Haller
fe88dcd8fe platform: relax assert when checking pathnames for accessing sysctl
Asserting against "/.." is wrong, because one could rename a link to
"..em1", which is a valid ifname but would crash NetworkManager.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:20 +02:00
Thomas Haller
80d2d0ebe1 core: refactor nm_utils_ascii_str_to_int64()
No need to allocate a dynamic buffer in most of the cases.

And extended test cases to test with/without white space
and leading zeros.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:20 +02:00
Thomas Haller
cbee213781 core: use nm_platform_sysctl_get() to read wifi rfkill value
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:17 +02:00
Thomas Haller
bd08198064 core: use nm_platform_sysctl_get() to read infiniband mode
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:08 +02:00
Thomas Haller
8794d80509 core: use nm_platform_sysctl_get() to read sysctl in NMDeviceAdsl
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:30:52 +02:00
Thomas Haller
e739e01900 core: use ASSERT_VALID_PATH_COMPONENT
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
ec7fc72e67 core: add ASSERT_VALID_PATH_COMPONENT function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
0a9cfb48ff platform: add nm_platform_sysctl_get_int_checked() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
2b3ef7664f core/trivial: clearify code comment on error for nm_utils_ascii_str_to_int64()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Dan Winship
efc72c996f ifcfg-rh: more fix build 2014-04-09 14:14:39 -04:00
Dan Williams
79a7e46bfd core: unregister removed devices from D-Bus
Instead of waiting until the device is disposed and dbus-glib does
it for us, remove them when the Manager is done with them.  If
something (like pending D-Bus calls) holds a reference to the device
when the Manager removes it, the device would previously still
service method calls until all references are released.  When
the device is removed, it's dead, and it shouldn't be exported
anymore.
2014-04-09 12:33:26 -05:00
Dan Winship
88fcf17ce0 ifcfg-rh: fix build
Rebasing the shvar changes to master added some new instances of
svNewFile() and svWriteFile() (in the aliases code) that needed to be
updated for the API changes.
2014-04-09 12:43:35 -04:00
Dan Winship
3cd17c8dc9 fixes/improvements to ifcfg-rh shvar code
https://bugzilla.gnome.org/show_bug.cgi?id=726653
2014-04-09 10:53:49 -04:00
Dan Winship
e43283a288 ifcfg-rh: return proper error messages from svOpenFile() and svWriteFile() 2014-04-09 10:50:56 -04:00
Dan Winship
454311c9ec ifcfg-rh: (trivial) rename svNewFile() to svOpenFile()
It's "new" in the sense that it creates a new shvarFile object, but it
doesn't create a new file, it just opens an existing one.
2014-04-09 10:50:56 -04:00
Dan Winship
5b4cc33cbd ifcfg-rh: semantic code style fixes to shvar.[ch] 2014-04-09 10:50:56 -04:00
Dan Winship
110cb06414 ifcfg-rh: (trivial) syntactic code style fixes to shvar.[ch] 2014-04-09 10:50:56 -04:00
Dan Winship
5bb45373d4 ifcfg-rh: fix up lowlevel ifcfg file reading code
shvar.c was assuming it could do a single read() to read in the ifcfg
file, without taking partial reads or EINTR into account. Fix that.

Also, it was keeping the raw contents of the ifcfg file in the
shvarFile even though it never looked at it after svOpenFile().
(Presumably lineList originally consisted of pointers into arena, but
that had to be changed to support readwrite.) Fix that.

It would simplify things further to use g_file_get_contents() and
g_file_set_contents(), but the current code is perhaps more resilient
to symlink attacks because it keeps the fd open?
2014-04-09 10:50:55 -04:00
Dan Winship
b104994078 ifcfg-rh: use g_ascii_strcasecmp() in svTrueValue()
strcasecmp() is locale-dependent, which is not what we want
2014-04-09 10:50:55 -04:00
Dan Winship
042fb88fea ifcfg-rh: remove ifcfg inheritance code
Nothing was using it, so simplify things by getting rid of it.
2014-04-09 10:50:55 -04:00
Thomas Haller
58500b3b8b core: fix freeing pending activations in dispose() of device
activate_data_free() deletes the data from priv->pending_activation_checks,
thus iterating over the list with g_slist_free_full() causes a double
free or invalid memory access.

This bug does not hit easily, because the policy only get's disposed
when NM shuts down and then there are likely no pending activations
queued.

Fixes regression introduced by commit 4f0c70e945.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-09 15:14:05 +02:00
Matt Soucy
3c211760c5 po: fix spelling of "successfully" in msgid strings
Typo in messages was already fixed in commit
61de24ba35.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-08 11:26:40 +02:00
Thomas Haller
fc1351504d core: fix hanging pending_action "queued state lock"
This bug caused nm-online to hang because "startup complete" state
is never reached. Sometimes you also see this error in the logfile:

  <warn> (em1): add_pending_action (3): 'queued state lock' already added
  file devices/nm-device.c: line 7178 (nm_device_add_pending_action): should not be reached

https://bugzilla.redhat.com/show_bug.cgi?id=1084554
https://bugzilla.redhat.com/show_bug.cgi?id=1084556
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1082045

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-07 17:45:38 +02:00
Dan Winship
1d0b50c2c4 build: add some missing -DNM_VERSION_MAX_ALLOWED
Add -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE to a bunch of
Makefile.ams that were missing it and might eventually need it.
2014-04-07 11:30:18 -04:00
Dan Williams
b703b14a6a merge: rework unmanaged options into flags (rh #1030947)
Instead of having separate booleans for each unmanaged option, make them
a single flags variable instead.  Also split out user-unmanaged from
internal management like suspend/resume so we can control them separately.
2014-04-07 09:52:20 -05:00
Dan Williams
de5c91ea0f core: split user managed preference (unmanaged specs) out from internal management
We'll want to track internal management separately in the future, so split out
user management (eg, whether the device has been explicitly marked unmanaged
by the user).
2014-04-07 09:52:07 -05:00
Dan Williams
6c299bc19b core: convert unmanaged bits to flags
Instead of tracking unmanaged-ness in a couple variables (and because
I'd like to add one for user-unmanaged later) let's do it in a single
flags variable, and consolidate setting of the unmanaged states in one
place.
2014-04-07 09:52:07 -05:00
Mikhail Efremov
194b14e398 core: don't generate a connection for unmanaged devices 2014-04-07 09:52:06 -05:00
Thomas Haller
2748bcfebf examples: fix qt demo to work without STL support
The function toStdString() is only available when QT was
compiled with STL support. The configure script does
not check STL support and might build the QT examples
even if toStdString() is not available.

Fix this, by not using the function.

This fixes the previous commit f73e3669b3
that I pushed accidentally.

https://bugzilla.gnome.org/show_bug.cgi?id=727608

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-04 23:20:05 +02:00
Thomas Haller
dac51747ab platform: workaround older kernels that don't accept extended address flags via netlink
Extended address flags are represented by the additional netlink
attribute IFA_FLAGS. Older kernels don't know this flag and refuse
the messages RTM_NEWADDR and RTMDEL_ADDR when it contains unknown
attributes. See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was
fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.

libnl was fixed in commit 5206c050504f8676a24854519b9c351470fb7cc6 only to
send the additional netlink attribute, when there are actually flags
that make this necessary.

This commit changes nm-platform to strip the flags to &= 0xFF, if we detect
that the kernel does not understand extended address flags.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-04 19:48:44 +02:00
Thomas Haller
f73e3669b3 examples: fix qt demo to work without STL support
The function toStdString() is only available when QT was
compiled with STL support. The configure script does
not check STL support and might build the QT examples
even if toStdString() is not available.

Fix this, by not using the function.

https://bugzilla.gnome.org/show_bug.cgi?id=727608

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-04 17:06:08 +02:00
Yuri Chornoivan
b25c227e07 fix typos in documentation and messages
https://bugzilla.gnome.org/show_bug.cgi?id=727031

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-03 17:12:31 +02:00
Thomas Haller
a72079a862 core: add macro STRLEN
Returns the length of a string at compile time. Contrary to strlen(),
which is a run time expression -- even if the compler might be able to
optimize strlen() for string constants.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-03 10:55:54 +02:00
Dan Williams
408ecd6b5f cli: fix setting DCB application priority (rh #1080510)
Priority was originally a 'guint' but then got changed to 'gint' and
apparently we forgot to fix one place up.
2014-04-02 12:06:14 -05:00
Dan Williams
42499b5b71 merge: DCB-related workarounds for lldpad and driver bugs (rh #799241) (rh #1081991)
lldpad 0.9.46 and earlier appear to be very sensitive to carrier, and if the
interface has no carrier will refuse to do anything with it, reporting that
"Device not found, link down or DCB not enabled".  So while setting up and
tearing down DCB configuration, we must wait for the carrier at various
points before proceeding, to ensure that the operations are successful.
2014-04-02 09:39:47 -05:00
Dan Williams
55704170ca dcb: wait for carrier down/up after disabling FCoE 2014-04-02 09:37:15 -05:00
Dan Williams
18fd3e45d8 dcb: separate DCB enable/disable and wait for carrier changes (rh #799241) (rh #1081991)
Non-git-master versions of lldpad refuse to touch a device that doesn't
have a carrier.  And when enabling/disabling DCB, the kernel driver will
reconfigure itself and may turn carrier off for a few seconds.  So we
must ensure that before enabling/disabling DCB, the carrier is already
on.  Next we must ensure that *after* enabling/disabling DCB, the
carrier is back on before doing further DCB setup.

There's a race condition between enabling/disabling DCB and receiving
the carrier event in NetworkManager that has to be handled carefully.
Because the carrier may not yet be down after the dcbtool call to
enable/disable DCB returns, we need to wait for a couple seconds for
the carrier to go down, and then again for it to come back up.
Otherwise we might see the still-on carrier, proceed with DCB setup,
and the carrier finally goes down halfway through the setup, which
will fail the operations with "DCB not enabled, link down, or DCB
not supported" errors from lldpad.
2014-04-02 09:37:15 -05:00
Dan Williams
0b664ad4a4 core: fix bug with ignore-carrier and master/slave devices (rh #1083521)
Even ignore-carrier devices need to be aware of carrier-up events so
they can continue DHCP when the link comes up.  They just ignore all
carrier-down events.
2014-04-02 09:15:54 -05:00
Dan Winship
ece92fe67a build: add -Wformat-security to the default warning flags 2014-04-02 09:24:56 -04:00
Dan Winship
a9fe0d3a34 dcb: fix -Wformat-security bugs 2014-04-02 09:24:21 -04:00
Thomas Haller
e9fdfa1700 ifcfg-rh: fix compile error with HAVE_SELINUX
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1070829

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-01 23:44:32 +02:00
Dan Winship
736d0a4a40 ifcfg-rh: fix bugs in the new alias code (rh #1067170)
Fix a bug when reading an invalid alias file, where the code meant to
skip the rest of the loop iteration, but failed.

Also fix a memory leak and remove an unused variable.

Bugs noticed by coverity.
2014-04-01 15:07:49 -04:00
Dan Winship
7a838e0a91 trivial: add a (void) annotation for coverity 2014-04-01 15:01:38 -04:00
Dan Winship
55c6d76c54 libnm-util: fix leaks in test-general 2014-04-01 15:00:33 -04:00
Jiří Klimeš
cb80daa942 po: fix "MB/s" -> "Mbit/s" 2014-04-01 15:15:18 +02:00
Jiří Klimeš
b3cbb260ef man: use correct Mbit/s for maximum bitrate in nmcli-examples 2014-04-01 15:15:18 +02:00