Commit graph

14265 commits

Author SHA1 Message Date
Thomas Haller
bf29d02ac1 systemd: don't include "nm-sd-adapt.h" in systemd header files
The header files are not compiled directly, but always included while compiling
other source files. We already require every source file to include "nm-sd-adapt.h"
as first, thus we don't need the include in the headers too.
2016-02-29 14:08:00 +01:00
Thomas Haller
ce4b1dc891 build: sort files for libsystemd_nm_la_SOURCES alphabetically 2016-02-29 14:07:59 +01:00
Beniamino Galvani
4ded98dd0f cli: fix use-after-free when adding ADSL connections
check_adsl_protocol() can free and assign a new string to
@protocol_ask, leaving @protocol dangling. Fix this.

Fixes: 290c1626b9
2016-02-29 13:47:47 +01:00
Beniamino Galvani
1c0fb2f652 introspection: fix description for vxlan ageing property 2016-02-29 13:47:47 +01:00
Thomas Haller
5805683efc device: fix compile error due to typo
Fixes: 6d409653b1
2016-02-29 13:38:14 +01:00
Thomas Haller
547980d2e4 device/trivial: adjust whitespace for property definitions 2016-02-29 13:13:54 +01:00
atul
6d409653b1 device: use _notify() instead of g_object_notify() for object properties
https://github.com/NetworkManager/NetworkManager/pull/3
2016-02-29 13:10:02 +01:00
Lubomir Rintel
faf70df480 device: the veth should have the same priority as ethernet
It's supposed to be a virtual ethernet.
2016-02-27 20:15:56 +01:00
Lubomir Rintel
f541a17270 device: when activating without cloned-mac-address, set the permanent one
Don't rely on what's already on the device. It could be that the MAC address
set on the device is not meaningful -- the NM crashed while two devices were
teamed together and now they have the same hardware address and now it's
impossible to bond them with mode=5.
2016-02-26 17:35:21 +01:00
Thomas Haller
ec35542cd5 wifi/test: fix bug in test code wpa_flags_for_idx() 2016-02-26 16:32:24 +01:00
Thomas Haller
6adf25c53c contrib/rpm: print dnf-install command at the end of build.sh 2016-02-26 14:36:49 +01:00
Lubomir Rintel
02278d3b8f arping-manager: failure to get a device name should not be fatal
The device could just be removed mid-flight.
2016-02-26 13:37:01 +01:00
Beniamino Galvani
aae6f07fe5 device: trivial: fix indentation and whitespaces 2016-02-25 11:10:52 +01:00
Thomas Haller
ff527652c7 callouts: downgrade logging severity of messages to g_info() and g_debug()
In dispatcher, we install a log-handler which maps G_LOG_LEVEL_MESSAGE
to syslog priority LOG_NOTICE, which in turn causes journal to highlight
the message. We don't want that so instead use g_info() and g_debug()
which maps to lower syslog levels.

There is only one problem, in debug-mode, we don't use syslog but the
default logging handler from glib. In this case, we have to set
G_MESSAGES_DEBUG otherwise g_info()/g_debug() is suppressed.
2016-02-24 20:04:29 +01:00
Thomas Haller
17779975c8 nm-glib: backport g_info() macro 2016-02-24 20:04:29 +01:00
Beniamino Galvani
22b3494de6 libnm,core: fix syntax of 'transfer' annotation 2016-02-24 17:23:01 +01:00
Lubomir Rintel
36573225b6 ifcfg-rh: add test for BOOTPROTO=autoip
Previous commit fixed parsing of these connection; let's check that we don't
regress there.
2016-02-24 16:54:27 +01:00
Lubomir Rintel
2e2f56697f ifcfg-rh: short circuit the IP configuration parsing on IPv4LL
We need the other keys, such as may_fail, too.
2016-02-24 16:54:27 +01:00
Lubomir Rintel
7d1709d7f6 device: check may_fail when progressing to IP_CHECK
Don't let the device progress to check and then in turn to activated unless all
the required IP configuration is in place.
2016-02-24 16:54:26 +01:00
Lubomir Rintel
9a55f662b9 device/trivial: rename nm_device_check_ip_failed()
This saves 110 bytes (which is 1/29986680757 of the size of the books in the
Library of Congress).

Also, the function is static; not using the nm_device_ prefix is preferred.
2016-02-24 16:54:26 +01:00
Dan Williams
751a37bf43 wifi: ignore monitor interfaces
If a monitor interface is created, NM will grab that interface
and change it to station mode.  That's not very nice.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00068.html
2016-02-24 11:43:42 +01:00
Thomas Haller
b913e1d641 platform: optimize sysctl_set() to use stack allocated buffer
The value written to sysctl is usually a short string. It makes sense
to optimize for this case and avoid allocating a temporary string
on the heap.

An alternative would be to use writev(), which effectively does the same
and also creates a temporary buffer (preferably stack allocated).

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00070.html
2016-02-24 11:24:13 +01:00
Thomas Haller
f41aebf897 device: merge branch 'jk/device-types-bgo762538'
https://bugzilla.gnome.org/show_bug.cgi?id=762538
2016-02-23 23:17:40 +01:00
Thomas Haller
1b00009169 device: add new NMDeviceType NM_DEVICE_TYPE_VETH
Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
2016-02-23 23:15:37 +01:00
Thomas Haller
26718e989e libnm: add missing device types to get_type_name() 2016-02-23 23:15:37 +01:00
Thomas Haller
a1eb5eba30 all: merge branch 'jk/device-types'
Resurrect old branch by Jirka, rebase it and
merge some parts.
2016-02-23 15:52:56 +01:00
Thomas Haller
8852b219a2 libnm-util: add missing device types to NMDeviceType
Althoug we don't fully backport the new device types, at least
add the types to the NMDeviceType enum.

Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
2016-02-23 15:26:49 +01:00
Thomas Haller
71962881a8 examples: add missing device-types to examples
Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
2016-02-23 15:24:39 +01:00
Thomas Haller
734f45e0e0 doc: update introspection/all.xml to include missing nm-device xmls 2016-02-23 15:23:22 +01:00
Thomas Haller
b875ac34be man: clarify DEVICE_IFACE vs. DEVICE_IP_IFACE in man NetworkManager 2016-02-22 20:08:56 +01:00
Lubomir Rintel
f6d0fc3341 wifi: avoid autoconnecting Ad-Hoc networks with method=auto
This fixes the issue where all Ad-Hoc networks try to connect one after one on
NM startup instead of the managed network that has AP available.

Fixes: e2637760f1
2016-02-22 17:11:01 +01:00
Thomas Haller
79b0a4361c device: merge branch 'th/device-unmanaged-settings-bgo762331'
https://bugzilla.gnome.org/show_bug.cgi?id=762331
2016-02-22 16:30:18 +01:00
Thomas Haller
c210134bd5 device: revert overruling NM_UNMANAGED_USER_SETTINGS decision
Since commit 87a3df2e57, the unmanaged
flag NM_UNMANAGED_USER_SETTINGS could be overwritten via an explict
user decision (NM_UNMANAGED_USER_EXPLICIT).

It makes sense to allow user configuration from file to be changable
by an explict user action via D-Bus at runtime.

However, it also changes behavior for devices that are currently explicitly
managed. Previously, a reload of the NM_UNMANAGED_USER_SETTINGS would
immediately unmanaged the device:

  - for keyfile: send SIGHUP to reload NetworkManager.conf
  - for ifcfg-rh: `nmcli connection [re]load`

So this change in behavior could negatively affect users who rely
on being able to configure "NM_CONTROLLED=no" and expect to unmanaged
the device immediately. Thus revert the change.

Note that NM_UNMANAGED_USER_SETTINGS is anyway ugly and should be
deprecated:
  - for keyfile, why having the option "keyfile.unmanaged-devices"
    instead of a generic options?
  - for ifcfg-rh, why put per-device configuration in a per-connection
    file?
The preferred way is to configure NM_UNMANAGED_USER_UDEV via
"ENV{NM_UNMANAGED}". Maybe we should also add a new configuration
scheme via NetworkManager.conf.

https://bugzilla.gnome.org/show_bug.cgi?id=762331
2016-02-22 16:24:32 +01:00
Thomas Haller
569cca6595 device: rename NM_UNMANAGED_USER_CONFIG to NM_UNMANAGED_USER_SETTINGS
The NM_UNMANAGED_USER_SETTINGS flags are determined by the settings plugins.
That is, either:
  - keyfile's "unmanaged-devices" configuration option
  - ifcfg-rh's "NM_CONTROLLED" option
  - ifnet's "managed" option

Rename NM_UNMANAGED_USER_CONFIG to NM_UNMANAGED_USER_SETTINGS to reflect
that it this is user configuration determined by the settings plugin.
2016-02-22 16:14:39 +01:00
Thomas Haller
d3e776b0e2 ifcfg-rh: fix leaking unmanaged_spec/unhandled_spec in NMIfcfgConnection 2016-02-22 15:36:12 +01:00
Thomas Haller
1f46ae57c4 logging: merge branch 'th/logging-format-bgo762009'
https://bugzilla.gnome.org/show_bug.cgi?id=762009
2016-02-21 18:42:40 +01:00
Thomas Haller
1b8cc4b9c5 logging: always print the timestamp and align location
Change the logging format. For syslog, we will now always
print the timestamp (also for <info> and <warn> messages).
Also, when printing the file location, we will always
align it.

For journal logging, also enable the timestamp. While the timestamp
is already captured separately by journal, most of the time a user
will look at the syslog like output from journal, so we want the
timestamps there too.
2016-02-21 18:37:49 +01:00
Thomas Haller
c01d1b0513 logging: add LOG_FORMAT_FLAG_ALIGN_LOCATION flag 2016-02-21 18:37:49 +01:00
Thomas Haller
1905862e26 logging: add logging-format-flags
No functional change.
2016-02-21 18:37:49 +01:00
Thomas Haller
d22b3fabc5 core: use nm_utils_parse_debug_string() instead of g_parse_debug_string() 2016-02-21 18:31:39 +01:00
Thomas Haller
a51a1cde36 utils: add nm_utils_parse_debug_string() to replace g_parse_debug_string()
g_parse_debug_string() interprets the string "help" special and accepts
an "all" tag to invert the result. We don't want that.
2016-02-21 18:31:39 +01:00
Thomas Haller
6ee744f41d dispatcher: minor cleanup ignoring dispatcher scripts by filename 2016-02-21 18:31:39 +01:00
Thomas Haller
4eb5ba8b02 macros: split macro NM_GOBJECT_PROPERTIES_DEFINE() in two
Sometimes we don't need the _notify() helper which results in a
unused-function warning.
2016-02-19 19:59:05 +01:00
Thomas Haller
8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Lubomir Rintel
89d6fa6aa9 device: don't allways set assumed reason when platform init is done
When the device is transitioning from unmanaged to disconnected for "assumed"
reason, bring_up is not called. This is not a good thing in numerous
instances, e.g.:

1.) vlans that we've created need that to set IFF_UP and read carrier
otherwise they won't be available for connections.

2.) veths that are being managed need to start the deferred carrier check
so that the behavior matches real Ethernet.

3.) Hardware devices that were plugged in while NetworkManager is running
that need the IFF_UP for a carrier check, possibly enqueueing a deferred one.

Fixes: 5637d72af2.
2016-02-19 14:40:16 +01:00
Thomas Haller
6d5e55870a shared: fix nm_sprintf_buf() macro to allow plain string
Use non-portable gcc extension to allow for zero variadic
arguments so that you can pass a plain string as argument.
2016-02-19 01:42:29 +01:00
Thomas Haller
7197425137 device: expose NMIP4Config:addresses in stable/defined sort order
Like we already do for IPv6 addresses, we should expose addresses
in a defined, stable sort order.

Clients usually show the addresses in the same order as obtained
via D-Bus.
2016-02-18 21:53:03 +01:00
Thomas Haller
328c733a6a platform: expose nmp_utils_ip4_address_is_link_local() function 2016-02-18 20:21:27 +01:00
Thomas Haller
b76d4b6b09 Revert "build: fix detection of NSS library on Debian"
Sorry, it was not Debian's fault. It is only libnss-devel package on
Ubuntu 12.04/Precise [1].

Revert the workaround and avoid the failure by dropping the version check altogether.
NSS 3.11 is from 2006, it's unlikely a user tries to build current NetworkManager
against such an old version of the library.

[1] https://bugs.launchpad.net/ubuntu/+source/nss/+bug/1547147

This reverts commit d48790cbec.
2016-02-18 19:50:51 +01:00
Beniamino Galvani
86f005ea4b device: fix assertion on unmanaged_mask for slave devices
When executing these commands:

  ip link add br0 type bridge
  ip link set dev br0 up
  ip link add dummy1 type dummy
  ip link set dev dummy1 up
  ip addr add 1.1.1.1/24 dev br0
  brctl addif br0 dummy1
  sleep 1
  ip link del br0
  ip link del dummy1

the following assertion was failing:

  nm_device_master_release_one_slave: runtime check failed: (NM_FLAGS_HAS (slave_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE))

  #0  g_logv()
  #1  g_log()
  #2  g_warn_message()
  #3  nm_device_master_release_one_slave()
  #4  nm_device_cleanup()
  #5  _set_state_full()
  #6  nm_device_state_changed()
  #7  nm_device_unrealize()
  #8  _platform_link_cb_idle()
  #9  g_main_context_dispatch()
  #10 g_main_context_dispatch()
  #11 g_main_context_iterate()
  #12 g_main_loop_run()
  #13 main()

Upon slave removal we unrealize the device, resetting the unmanaged
flags to NM_UNMANAGED_PLATFORM_INIT, then we clean up the device and
call nm_device_master_release_one_slave(), which asserts the presence
of NM_UNMANAGED_IS_SLAVE flag cleared just before.

Drop the check.

Fixes: 87a3df2e57
2016-02-18 14:18:07 +01:00