Commit Graph

24146 Commits

Author SHA1 Message Date
Iñigo Martínez
509706b62b meson: Avoid the creation of an extra variable
An extra variable is used for sources of
`libnm-settings-plugin-ifupdown` module. However, it only contains
one source file and using it directly avoiding the creation of the
extra variable doesn't hurt readibility.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
146348199e meson: Remove unused variable 2019-10-01 09:49:33 +02:00
Iñigo Martínez
a010fcb5f7 meson: Move network-config directory creation to main install file
The `ifcfg-rh` meson build file installs a new post install script
to create the `network-config` directory.

This has been moved to the main post install file so it's easier to
find because all post install steps are together and it avoids and
extra post install script execution.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f5f9c071ba meson: Improve ifcfg-rh plugin build
The file has been fixed to be consistent with the rest of the files.
The data files to be installed have been grouped together. The
sourc files has been listed vertically and the link target in
`nm-settings-plugin-ifcfg-rh` does not use an array anymore.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
4e5b1e257e meson: Improve nm-initrd-generator target
The set of link targets used when building `nm-initrd-generator`
target has been grouped together.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
c4dc02c9bd meson: Avoid the use of unnecessary array
The linker flags used when building `libnm_wwan` target uses an
array even when it only uses one value.

When using only one value the array is unnecessary so it has been
removed.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
dababfa59e meson: Improve ppp build file
The set of c_flags used when building `ppp` targets has been grouped
together. Used dependencies have also been reviewed and removed
the unnecessary one.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
23bd02110c meson: Rename the compiler flags variable
Renamed the variable holding the compiler flags to be consistent
with different meson ports.

This naming pattern improves the use of different compiler flags
in environments with multiple languages.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
780585952d meson: Use variable for test program name
The name of the `monitor` test program is duplicated. A variable
has been used to avoid using the same string twice.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
31f1516760 meson: Improve the src build file
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.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
1066ddb3a1 meson: Improve the systemd build file
The `systemd` build file has been improved by grouping together all
the objects used in the building of the `libnm-systemd-core`
library.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
caf470f788 meson: Improve targets involving libnm library
The targets that involve the use of the `libnm` library have been
improved by applying a set of changes:

- Generated enum sources variable `libnm_enum` has been renamed to
  `libnm_enum_sources` to clearly specify what it is holding.
- Indentation in the `libnm` build and test files has been fixed.
- Set of objects used in targets have been grouped together.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
1cd615288e meson: Improve the libnm-core test build file
All variables used in every test have been moved to the start of the
build file.

Generated enum sources variable has been renamed to `enum_sources`
to clearly specify what it is holding.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
f427f4771e meson: Improve the libnm-core build file
The `libnm-core` build file has been improved by applying a set of
changes:

- Indentation has been fixed to be consistent.
- Library variable names have been changed to `lib{name}` pattern
  following their filename pattern.
- `shared` prefix has been removed from all variables using it.
- Dependencies have been reviewed to store the necessary data.
- The use of the libraries and dependencies created in this file
  has been reviewed through the entire source code. This has
  required the addition or the removal of different libraries and
  dependencies in different targets.
- Some files used directly with the `files` function have been moved
  to their nearest path build file because meson stores their full
  path seamessly and they can be used anywhere later.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
ad4834009b meson: Improve crypto support build
There are multiple conditional steps for building encryption
support. This is because the support varies from `gnutls` or `nss`.

This has been improved to reduce the number of used conditions.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
de90fc0810 meson: Improve the shared utils test build file
A new variable has been created for the C compiler flags to avoid
polluting the target creation call so the flags are encapsulated.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
70a34c54fe meson: Use dependency for nm-default header
The `nm-default.h` header is used widely in the code by many
targets. This header includes different headers and needs different
libraries depending the compilation flags.

A new set of `*nm_default_dep` dependencies have been created to
ease the inclusion of different directorires and libraries.

This allows cleaner build files and avoiding linking unnecessary
libraries so this has been applied allowing the removal of some
dependencies involving the linking of unnecessary libraries.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
c74e428342 meson: Improve the shared build file
The `shared` build file has been improved by applying a set of
changes:

- Indentation has been fixed to be consistent.
- Unused libraries and dependencies have been removed.
- Dependencies have been reviewed to store the necessary data.
- Set of objects used in targets have been grouped together.
- Header files have been removed from sources lists as it's
  unnecessary.
- Library variable names have been changed to `lib{name}` pattern
  following their filename pattern.
- `shared` prefix has been removed from all variables using it.
- `version_header` its related configuration `version_conf`
  variables have been renamed to `nm_version_macro*` following
  its input and final file names.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
31a2710f11 meson: Simplified WiFi detection when IWD is enabled 2019-10-01 09:49:33 +02:00
Iñigo Martínez
82e79e40a5 meson: Avoid the use of source_root and build_root methods
The way some directory paths are defined has also been changed to
avoid the use of the `source_root` and `build_root` functions
because they are discouraged[0]

[0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2019-10-01 09:49:33 +02:00
Iñigo Martínez
48bb5b68e3 meson: Define meson information early
The used meson modules, default directories and includes have been
moved to the start of the build file, just after project related
information, so they are available early.
2019-10-01 09:49:33 +02:00
Iñigo Martínez
bfbcf8f3fe meson: Use generators placeholders
Functions derived from generators as `configure_file`,
`custom_target` and `i18n.merge_file` can use placeholders like
`@BASENAME@` that removes the extension from the input filename
string.

The output string has been replaced by this placeholder that
allows in some cases the use of less variables.
2019-10-01 09:49:33 +02:00
Thomas Haller
50f146f6e3 libnm/tests: fix compiler warning about unused variable
Fixes: ad68f3f402 ('libnm/tests: assert that callers GMainContext is not iterated while nm_client_new()')
2019-10-01 09:31:14 +02:00
Thomas Haller
78acec9168 all: merge branch 'th/cleanup-file-header-comments'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/288
2019-10-01 07:52:41 +02:00
Thomas Haller
abff46cacf all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
Thomas Haller
9683521521 libnm: spell "Author:" comment with upper case
Like it's done at all other places.
2019-10-01 07:50:52 +02:00
Thomas Haller
3c36231706 CONTRIBUTING: update comment about requiring LGPL-2.1+ license instead of LGPL-2.0+
Historically, libnm claimed to be LGPL-2.0+ licensed. But as keep mixing that
with LGPL-2.1+ code (e.g. from systemd), so probably even the parts that
claimed to be LGPL-2.0+, were not entirely correctly doing so.

Anyway, since we switched to SPDX license identifiers, we now claim
everywhere that the right license is LGPL-2.1+. Update the comment to
reflect that.
2019-10-01 07:50:52 +02:00
Francesco Giudici
e150307ab5 artwork: introduce NetworkManager stickers 2019-09-30 17:36:59 +02:00
Francesco Giudici
d5dbea05be artwork: fix the reversed NetworkManager logo
Slightly changed the size to have a perfect square.
2019-09-30 17:27:16 +02:00
Beniamino Galvani
3c4f70c5c2 dhcp: systemd: support DHCPv6 prefix delegation
Add support to the internal DHCP client for requesting a prefix and
distributing it to interfaces with 'shared' IPv6 mode.

The systemd-networkd API currently allows to request only a single
prefix and so there will be issues when the number of downstream
interfaces is greater than the number of /64 subnets available in the
returned prefix; but this is still an improvement over the previous
situation when no prefix was requested at all.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/247
2019-09-30 16:15:13 +02:00
Thomas Haller
ad68f3f402 libnm/tests: assert that callers GMainContext is not iterated while nm_client_new()
Libraries must not iterate a GMainContext that they don't own.

Add an assertion that we don't do so during nm_client_new().

See https://developer.gnome.org/programming-guidelines/unstable/main-contexts.html.en#using-gmaincontext-in-a-library
2019-09-30 16:01:16 +02:00
Thomas Haller
c1559dae3f shared: add nmtst_g_source_assert_not_called() helper 2019-09-30 16:00:45 +02:00
Thomas Haller
e54047608e libnm: merge branch 'th/libnm-properties-override'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/283
2019-09-30 08:26:30 +02:00
Thomas Haller
29a451d33a libnm: don't special case "vpn.secrets" property in property_to_dbus()
"nm-setting.c" (and property_to_dbus()) should stay independent of
actualy settings implementations. Instead, the property-info should
control the behavior.

What I like about this change is also that the generic handling is not a
flags "handle_secrets_for_vpn", but it just says to skip checking the
param-spec flags and directly call the to_dbus_fcn(). It's just a
generally useful thing to do, to let the to_dbus_fcn() function also
handle checking the property flags. The fact that only vpn.secrets
properties uses this for a certain pupose, is abstracted in a way that
makes sense.
2019-09-30 08:23:19 +02:00
Thomas Haller
5a5e08794e libnm: drop unused NM_SETTING_PARAM_GENDATA_BACKED property flag
The idea was that properties that are implemented via GENDATA still
could have a GObject property. As such, they would be marked with
this flag.

Currently, gendata properties are only implemented by NMSettingEthtool,
and there are no GObject properties where this flag is used. While it
might make sense in theory or in the future, it is unused.

Drop it.
2019-09-30 08:23:19 +02:00
Thomas Haller
133f23d39e libnm: copy list of property-infos instead of keeping buffer from GArray
We use the "properties_override" GArray to construct the list of property infos.
But as we append values to the GArray, the buffer grows exponentially and likely
is larger than the actually used number of values.

As this data is kept until the end of the program, let's not waste the over-allocated
memory and instead copy it to a buffer of the right size.
2019-09-30 08:23:19 +02:00
Thomas Haller
a1b575b07b libnm/trivial: rename _properties_override_add_*() to _nm_properties_override_*()
These macros/functions are in a header file. Everything in a header file
should have an "nm" prefix. Rename.
2019-09-30 08:23:19 +02:00
Thomas Haller
e5495c482f libnm: cleanup _properties_override_add*() functions 2019-09-30 08:23:19 +02:00
Thomas Haller
275d850d1b libnm: replace _properties_override_add_override() with _properties_override_add_gobj() 2019-09-30 08:23:19 +02:00
Thomas Haller
6ecd4bed2a libnm: replace _properties_override_add_transform() with _properties_override_add_gobj() 2019-09-30 08:23:19 +02:00
Thomas Haller
0129954203 libnm: replace _properties_override_add_dbus_only() with _properties_override_add_virt()
We have too many _properties_override_add*() variants. They basically are all the
same. Drop _properties_override_add_dbus_only() and use _properties_override_add_virt()
instead.

Also, I am always confused by the term "synth". We shouldn't treat
non-GObject-based properties as somehow odd that need to be synthesized.
2019-09-30 08:23:19 +02:00
Thomas Haller
d534b6d07a libnm: deduplicate NMSettInfoPropertType instances
There is no need to keep duplicate instances.

Before we had 89 distinct property types, now there are 49.
2019-09-30 08:23:19 +02:00
Thomas Haller
3f36f69156 libnm: refactor NMSettInfoProperty to save memory for simple properties
In total, we register 447 property informations. Out of these,
326 are plain, GObject property based without special implementations.

The NMSettInfoProperty had all function pointers directly embedded,
currently this amounts to 5 function pointers and the "dbus_type" field.

That means, at runtime we have 326 times trivial implementations with
waste 326*6*8 bytes of NULL pointers. We can compact these by moving
them to a separate structure.

Before:

    447 * 5 function pointers
    447 * "dbus_type" pointer
    = 2682 pointers

After:

    447 * 1 pointers (for NMSettInfoProperty.property_type)
     89 * 6 pointers (for the distinct NMSettInfoPropertType data)
    = 981 pointers

So, in total this saves 13608 byes of runtime memory (on 64 bit arch).

The 89 NMSettInfoPropertType instances are the remaining distinct instances.
Note that every NMSettInfoProperty has a "property_type" pointer, but most of them are
shared. That is because the underlying type and the operations are the same.

Also nice is that the NMSettInfoPropertType are actually constant,
static fields and initialized very early.

This change also makes sense form a design point of view. Previously,
NMSettInfoProperty contained both per-property data (the "name") but
also the behavior. Now, the "behavioral" part is moved to a separate
structure (where it is also shared). That means, the parts that are
concerned with the type of the property (the behavior) are separate
from the actual data of the property.
2019-09-30 08:23:19 +02:00
Thomas Haller
f36a0d408b libnm: avoid heap allocation in _nm_utils_strdict_to_dbus() 2019-09-30 08:23:19 +02:00
Thomas Haller
df6714102c shared: add NM_G_VARIANT_TYPE() macro
Like G_VARIANT_TYPE(), but this one can be used to initialize a static variable.
2019-09-30 08:23:19 +02:00
Francesco Giudici
dce1aa87c2 artwork: introduce the new NetworkManager logo and logotype
The preferred logo and logotype are the ones in the main "logo" folder.
There are also few variants available in the "alternate" folder that are
allowed.

Main color for the logo is blue #32557dff.
The alternatei logo red is #cc0000ff.
The font is Montserrat.

Thanks to Máirín Duffy for all the help and support!
2019-09-27 16:15:39 +02:00
Beniamino Galvani
5f284e1574 device: fix wrong string compare in _commit_mtu()
Fixes: e6628fa27c ('ipv6: add 'disabled' method')

https://bugzilla.redhat.com/show_bug.cgi?id=1753128
2019-09-27 13:39:43 +02:00
Beniamino Galvani
f868b509fb team: delete port configuration on release
If we set a port configuration upon enslaving, delete it when the port
is released.

https://bugzilla.redhat.com/show_bug.cgi?id=1755406
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/293
2019-09-27 13:33:36 +02:00
Beniamino Galvani
64a9dd3804 device: don't reapply IP config on link up for disconnected devices
Only reapply the IP configuration on link up if the IP state is CONF
or DONE. Previously we also reapplied it when the device was
disconnected (IP state NONE) and this could lead to a situation where
an incomplete config was applied; then we intersected the desired
configuration with the external - incomplete - one, causing the
removal of part of desired configuration (for example the default
route).

Fixes: d0b16b9283 ('device: unconditionally reapply IP configuration on link up')

https://bugzilla.redhat.com/show_bug.cgi?id=1754511
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/291
2019-09-27 13:27:19 +02:00
Thomas Haller
7751c2fbd0 clients/tests: add test for (invalid) call nmcli dev s eth0 2019-09-27 09:47:33 +02:00