summaryrefslogtreecommitdiff
path: root/src/dnsmasq
Commit message (Collapse)AuthorAgeFilesLines
* meson: Improve the src build fileIñigo Martínez2019-10-011-1/+2
| | | | | | | | | | | | The targets that involve the use of the `NetworkManager` library, built in the `src` build file have been improved by applying a set of changes: - Indentation has been fixed. - Set of objects used in targets have been grouped together. - Aritificial dependencies used to group dependencies and custom compiler flags have been removed and their use replaced with proper dependencies and compiler flags to avoid any confussion.
* all: manually drop code comments with file descriptionThomas Haller2019-10-015-9/+4
|
* all: SPDX header conversionLubomir Rintel2019-09-105-70/+5
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* all: drop emacs file variables from source filesThomas Haller2019-06-115-5/+0
| | | | | | | | | | | | | | | | | | | | | | We no longer add these. If you use Emacs, configure it yourself. Also, due to our "smart-tab" usage the editor anyway does a subpar job handling our tabs. However, on the upside every user can choose whatever tab-width he/she prefers. If "smart-tabs" are used properly (like we do), every tab-width will work. No manual changes, just ran commands: F=($(git grep -l -e '-\*-')) sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}" sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}" Check remaining lines with: git grep -e '-\*-' The ultimate purpose of this is to cleanup our files and eventually use SPDX license identifiers. For that, first get rid of the boilerplate lines.
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-122-2/+0
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* build: meson: Add trailing commasIñigo Martínez2018-12-201-1/+1
| | | | | | | Add missing trailing commas that avoids getting noise when another file/parameter is added and eases reviewing changes[0]. [0] https://gitlab.gnome.org/GNOME/dconf/merge_requests/11#note_291585
* device/shared: set ANDROID_METERED option 43 for shared connectionsThomas Haller2018-12-032-1/+14
| | | | | | | | | The problem is that updating the metered value of a shared connection is not implemented. The user needs to fully reactivate the profile for changes to take effect. That is unfortunate, especially because reapplying the route metric works in other other cases.
* dnsmasq: refactor construction of command line options in create_dm_cmd_line()Thomas Haller2018-12-031-105/+52
| | | | | | | | | | | | | | | | | | | | | | | | Having a NMCmdLine implementation here is wrong. For one, it local to nm-dnsmasq-manager.c and not reusable. If there is anything of value in such an implementation, then it should possibly also be useful at other places that create command line arguments. Note that in the end, command line arguments are just strv arrays. There are different ways how to construct that strv array. For example, do we need to clone the strings that we add? How to do that most elegantly and efficiently? The previous implementation for example used a GStringChunk for that (quite creative!). The point is, there are pros and cons about how to create strv arrays. But constructing command line options shouldn't be abstracted in a NMCmdLine API. It should use a suitable API for creating an strv array. Otherwise, it's too much abstraction. Drop NMCmdLine and use GPtrArray directly. Together with a few helper functions nm_strv_ptrarray_*() that is our preferred way to create such strv arrays. Is it perfect? No, we still g_strdup() static strings. That could be optimized. But then we would want an optimized API for constructing strv arrays, not NMCmdLine.
* dnsmasq/shared: fix setting DNS nameserver and search for shared dnsmasqThomas Haller2018-11-291-0/+2
| | | | Fixes: c8fa7b6f57988d1761cd2d3a12631abeefce77f7
* all: don't use gchar/gshort/gint/glong but C typesThomas Haller2018-07-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We commonly don't use the glib typedefs for char/short/int/long, but their C types directly. $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l 587 $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l 21114 One could argue that using the glib typedefs is preferable in public API (of our glib based libnm library) or where it clearly is related to glib, like during g_object_set (obj, PROPERTY, (gint) value, NULL); However, that argument does not seem strong, because in practice we don't follow that argument today, and seldomly use the glib typedefs. Also, the style guide for this would be hard to formalize, because "using them where clearly related to a glib" is a very loose suggestion. Also note that glib typedefs will always just be typedefs of the underlying C types. There is no danger of glib changing the meaning of these typedefs (because that would be a major API break of glib). A simple style guide is instead: don't use these typedefs. No manual actions, I only ran the bash script: FILES=($(git ls-files '*.[hc]')) sed -i \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\> /\1 /g' \ -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \ "${FILES[@]}"
* dnsmasq: fix separation from system-wide dnsmasqEric Renfro2018-06-301-1/+6
| | | | | | | | | This disables loading the system-wide dnsmasq from /etc/dnsmasq.conf and defines to use the NMSTATEDIR device-unique dhcp-leasefile, preventing it from trampling over others, and isolating it to just the wifi-ap use. https://github.com/NetworkManager/NetworkManager/pull/156
* build: use default NM_BUILD_* defines for testsThomas Haller2018-05-311-1/+0
| | | | | | | | | Use two common defines NM_BUILD_SRCDIR and NM_BUILD_BUILDDIR for specifying the location of srcdir and builddir. Note that this is only relevant for tests, as they expect a certain layout of the directories, to find files that concern them.
* all: replace "it's" with "its" where neededBeniamino Galvani2018-04-181-1/+1
|
* build: meson: add prefix to test namesBeniamino Galvani2018-04-121-1/+1
| | | | | | There are multiple tests with the same in different directories; add a unique prefix to test names so that it is clear from the output which one is running.
* build: meson: use run-nm-test.sh to run testsBeniamino Galvani2018-04-121-1/+5
| | | | | Like autotools, use the wrapper script 'run-nm-test.sh' that starts a separate D-Bus session when needed.
* meson: Improve dependency systemIñigo Martínez2018-01-101-8/+2
| | | | | | | | | | | | | | | | | | | | Some targets are missing dependencies on some generated sources in the meson port. These makes the build to fail due to missing source files on a highly parallelized build. These dependencies have been resolved by taking advantage of meson's internal dependencies which can be used to pass source files, include directories, libraries and compiler flags. One of such internal dependencies called `core_dep` was already in use. However, in order to avoid any confusion with another new internal dependency called `nm_core_dep`, which is used to include directories and source files from the `libnm-core` directory, the `core_dep` dependency has been renamed to `nm_dep`. These changes have allowed minimizing the build details which are inherited by using those dependencies. The parallelized build has also been improved.
* build: refine the NETWORKMANAGER_COMPILATION defineThomas Haller2018-01-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Note that: - we compile some source files multiple times. Most notably those under "shared/". - we include a default header "shared/nm-default.h" in every source file. This header is supposed to setup a common environment by defining and including parts that are commonly used. As we always include the same header, the header must behave differently depending one whether the compilation is for libnm-core, NetworkManager or libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h> depending on whether we compile a library or an application. For that, the source files need the NETWORKMANAGER_COMPILATION #define to behave accordingly. Extend the define to be composed of flags. These flags are all named NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the build are available. E.g. when building libnm-core.la itself, then WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE is not available but the internal parts are still accessible. When building nmcli, only WITH_LIBNM_CORE (the public part) is available. This granularily controls the build.
* build: add initial support for meson build systemIñigo Martínez2017-12-131-0/+12
| | | | | | | | | | meson is a build system focused on speed an ease of use, which helps speeding up the software development. This patch adds meson support along autotools. [thaller@redhat.com: rebased patch and adjusted for iwd support] https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00022.html
* logging: configure dnsmasq's logging in shared mode via nm-loggingThomas Haller2017-11-061-1/+2
| | | | (cherry picked from commit cc993aa02040564c16d78c864f3c3a22d20443eb)
* core: rework tracking of gateway/default-route in ip-configThomas Haller2017-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | Instead of having 3 properties @gateway, @never_default and @has_gateway on NMIP4Config/NMIP6Config that determine the default-route, track the default-route as a regular route. The gateway setting is the configuration knob for the default-route. Since an NMIP4Config/NMIP6Config instance only has one gateway property, it cannot track more then one default-routes (see related bug rh#1445417). Especially with policy routing, it might be interesting to configure a default-route in multiple tables. Also, later it might be interesting to allow adding default-routes as regular static routes in a connection, so that the user can configure additional route parameters for the default-route or add default-routes in multiple tables. With this patch, default-routes now have a rt_source property according to their origin. Also, the previous commits of this branch broke handling of the default-route :) . That should be working now again.
* all: use _nm_utils_ip4_*() utils functionsThomas Haller2017-09-051-1/+1
|
* core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndexThomas Haller2017-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Reasons: - it adds an O(1) lookup index for accessing NMIPxConfig's addresses. Hence, operations like merge/intersect have now runtime O(n) instead of O(n^2). Arguably, we expect low numbers of addresses in general. For low numbers, the O(n^2) doesn't matter and quite likely in those cases the previous implementation was just fine -- maybe even faster. But the simple case works fine either way. It's important to scale well in the exceptional case. - the tracked objects can be shared between the various NMPI4Config, NMIP6Config instances with NMPlatform and everybody else. - the NMPObject can be treated generically, meaning it enables code to handle both IPv4 and IPv6, or addresses and routes. See for example _nm_ip_config_add_obj(). - I want core to evolve to somewhere where we don't keep copies of NMPlatformIP4Address, et al. instances. Instead they shall all be shared. I hope this will reduce memory consumption (although tracking a reference consumes some memory too). Also, it shortcuts nmp_object_equal() when comparing the same object. Calling nmp_object_equal() on the identical objects would be a common case after the hash function pre-evaluates equality.
* dnsmasq: fix generating shared IPv4 address rangeThomas Haller2017-05-292-59/+101
| | | | | | | | | | | | | | | | | Change behavior for the network-address and broadcast-address. Users should not specify such addresses, but if they do, generate something more sensible. Also, if the address was in network larger then /24, the generated address range was rather unexpected. Change behavior here. There are no particularly strong reasons for the chosen range. It just seems suitable. The decision to hand out at most a /24 is because it is likely to be plenty, and because that is what the previous code did -- at least, if the address was in the first /24 of the subnet. See how the result for 192.168.0.1/20 is unchanged, but 192.168.1.1/20 changes.
* dnsmasq/tests: add more tests for test_address_ranges()Thomas Haller2017-05-291-52/+131
|
* dnsmasq: use ipv4.dns and ipv4.dns-search with ipv4.method=sharedThomas Haller2017-03-031-0/+20
| | | | | Configure the dnsmasq DHCP server for shared mode to announce the configured name resolution settings.
* dnsmasq: reuse string buffer in creating command line arguments in ↵Thomas Haller2017-03-031-10/+11
| | | | create_dm_cmd_line()
* build: don't add subdirectories to include search path but require qualified ↵Thomas Haller2016-11-213-3/+3
| | | | | | | | | | | | | | | 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.
* build: rename "src/dnsmasq-manager" to "src/dnsmasq"Thomas Haller2016-11-215-0/+658
The dnsmasq directory does not only contain the manager instance, but various files related to dnsmasq. Rename.