Commit graph

19 commits

Author SHA1 Message Date
Thomas Haller
7c6c8f0d8b all: cleanup switch fall-through comments for -Wimplicit-fallthrough warning
The -Wimplicit-fallthrough=3 warning is quite flexible of accepting
a fall-through warning.

Some comments were missing or not detected correctly.

Thereby, also change all other comments to follow the exact
same pattern.
2017-02-06 16:45:20 +01:00
Thomas Haller
11bc3f191e all: use nm_utils_strv_find_first() from shared/nm-utils 2017-02-04 17:55:30 +01:00
Lubomir Rintel
55a5bf580d dns-unbound: avoid using nm_spawn_process()
It doesn't improve anything and is the last user of said function.
2017-02-03 18:53:40 +01:00
Lubomir Rintel
46c534d7e9 dns-manager: get rid of the nm_spawn_process() use
There's no point in making our lives more complicated by concatenating
the argument into a string and then splitting it up again.
2017-02-03 18:53:39 +01:00
Lubomir Rintel
4e8eddd100 dns-manager: fix a NULL dereference in error handling
nm_spawn_process() only sets error if the g_spawn_sync() itself fails,
not when the program ran returns a non-zero code.

  <debug> [148  059915.1567] dns-mgr: update-dns: updating resolv.conf
  <info>  [148  059915.1568] dns-mgr: Removing DNS information from /usr/bin/resolvconf
  No resolv.conf for interface NetworkManager
  Thread 1 "NetworkManager" received signal SIGSEGV, Segmentation fault.
  0x0000555555  7c325 in nm_dns_manager_end_updates
  1532  _LOGW ("could not commit DNS changes: %s", error->message);
  (gdb) bt full
  #0  0x0000555555  7c325 in nm_dns_manager_end_updates
          error = 0x0
2017-02-03 18:53:24 +01:00
Thomas Haller
674f5f24af dns: fix memleak in _get_config_variant()
There are cases where we wouldn't call g_variant_builder_end()
on @strv_builder and @entry_builder.

Fixes: e3c67177ac
2017-01-04 14:05:22 +01:00
Beniamino Galvani
e4edef8fe2 dns: fix memory leak
Fixes: e3c67177ac
2016-12-20 11:40:12 +01:00
Beniamino Galvani
4ec6481695 dns: remove duplicate declaration of singleton instance 2016-12-20 11:40:12 +01:00
Thomas Haller
4bdee37771 all: use O_CLOEXEC for file descriptors 2016-12-13 11:26:59 +01:00
Thomas Haller
3206b72964 dns: split collecting resolv-conf data out of update_dns()
update_dns() is rather complicated. The part where we collect
resolv-conf data can be moved out. That is nice, because
_collect_resolv_conf_data() has no side-effects (except logging)
and it's only purpose is to return the out-arguments.
2016-12-12 22:06:24 +01:00
Thomas Haller
916a0e7cad dns: use cleanup attributes for update_dns()'s strv arrays 2016-12-12 22:06:24 +01:00
Beniamino Galvani
e3c67177ac dns: export current configuration through D-Bus
It is useful to let clients retrieve the current DNS configuration,
which can be displayed to users or used (together with dns=none) to
implement custom DNS configuration logic through external tools.
2016-12-12 22:06:23 +01:00
Beniamino Galvani
14105ece56 dns: export DNS manager D-Bus object
Extend the D-Bus API and introduce a new NMDnsManager interface that
contains all the information related to DNS configuration.

At the moment the new DnsManager object only contains basic properties
describing the current DNS mode and resolv.conf manager.
2016-12-12 21:49:15 +01:00
Beniamino Galvani
5307e07e3b dns: don't print empty configurations
Previously we printed the DNS configuration for all devices including
unmanaged and unconfigured ones:

  dns-mgr: config:      100 best    v4 ens3             : 192.168.10.1
  dns-mgr: config:      100 default v6 ens3             : fd01🔡:3681:c4ff:fec0:fe94
  dns-mgr: config:      100 default v4 lo               :
  dns-mgr: config:      100 default v6 lo               :
  dns-mgr: config:      100 default v4 ens9             :
  dns-mgr: config:      100 default v6 ens9             :

Instead, print only devices that have name servers set.
2016-12-12 21:41:23 +01:00
Beniamino Galvani
6546b70c98 Revert "dns: clear dnsmasq cache after an update"
We now pass the --clear-on-reload option to dnsmasq, so the manual
clear is no longer needed.

This reverts commit 4feb58b50b.
2016-11-29 23:12:23 +01:00
Christian Hesse
c966fd54bf dns: tell dnsmasq to clear cache on servers reload
A new DNS may have different data for us. So tell dnsmasq to
automatically clear the cache when servers change.

Signed-off-by: Christian Hesse <mail@eworm.de>
2016-11-29 22:56:39 +01:00
Thomas Haller
afcfa7be2b config/trivial: unify name of compile time config defaults 2016-11-25 18:02:38 +01:00
Thomas Haller
44ecb41593 build: don't add subdirectories to include search path but require qualified include
Keep the include paths clean and separate. We use directories to group source
files together. That makes sense (I guess), but then we should use this
grouping also when including files. Thus require to #include files with their
path relative to "src/".

Also, we build various artifacts from the "src/" tree. Instead of having
individual CFLAGS for each artifact in Makefile.am, the CFLAGS should be
unified. Previously, the CFLAGS for each artifact differ and are inconsistent
in which paths they add to the search path. Fix the inconsistency by just
don't add the paths at all.
2016-11-21 14:26:37 +01:00
Thomas Haller
62c2e6ccda build: rename "src/dns-manager" to "src/dns"
The dns directory does not only contain the manager
instance, but various files related to DNS.

Rename.
2016-11-21 14:07:47 +01:00