Commit Graph

17 Commits

Author SHA1 Message Date
Beniamino Galvani
92208ebd1f libnm-core: fix memory leak in match setting
Fixes: 808e837149 ('all: add "path" property to the match setting')
2020-06-18 14:26:00 +02:00
Beniamino Galvani
808e837149 all: add "path" property to the match setting
Add a new "path" property to the match setting, which can be used to
restrict a connection to devices with a given hardware path. The new
property is a list of patterns that are matched against the ID_PATH
udev property of devices.

ID_PATH represents the topological persistent path of a device and
typically contains a subsystem string (pci, usb, platform, etc.) and a
subsystem-specific identifier. Some examples of paths are:

 pci-0000:00:02.0
 pci-0000:00:14.0-usb-0:5:1.0
 platform-1c40000.ethernet

systemd-networkd also has a "Path=" option to match a device by udev
ID_PATH.
2020-06-12 16:04:06 +02:00
Thomas Haller
4101894466 libnm: use nm_str_is_empty() in "nm-setting-match.c" 2020-05-08 11:11:43 +02:00
Thomas Haller
0ba444a084 libnm: allocate device and kernel_command_line arrays in NMSettingMatch lazy 2020-05-06 15:39:14 +02:00
Thomas Haller
7939c8e770 libnm: allocate interface_name array in NMSettingMatch lazy
Also track the interface_name in a GArray so that
nm_setting_match_get_interface_names() returns a NULL
terminated strv array.
2020-05-06 15:39:08 +02:00
Thomas Haller
ef16dcaee4 libnm: cleanup NMSettingMatch.verify() 2020-05-06 15:19:22 +02:00
Thomas Haller
eaf3862075 libnm: fix gtk-doc annotations for nm_setting_match_get_{kernel_command_lines,drivers}()
Otherwise the function is not usable via generated bindings.
2020-05-06 15:07:09 +02:00
Adrian Freihofer
214b31dcbc settings: add match for driver
Add a new "driver" match option to nm-settings. It allows to disable a
network connection configuration if a pattern is found or is not found
in the device driver name.
2020-05-06 15:05:21 +02:00
Adrian Freihofer
3a8e46f2a5 settings: add match for proc cmdline
Add a new "kernel-command-line" match option to nm-settings. It allows
to disable a network connection configuration if a pattern is found or
is not found in /proc/cmdline.
2020-05-06 15:05:20 +02:00
Adrian Freihofer
b42c3aa97a settings: add match verify function 2020-05-06 15:05:20 +02:00
Thomas Haller
180cda7632 libnm: fix gtk-doc annotations for nm_setting_match_get_interface_names()
Otherwise the function is not usable via generated bindings.

Fixes: 9b9dce9486 ('all: add 'match' setting')
2020-05-06 15:01:06 +02:00
Beniamino Galvani
78f1977ecd libnm-core: remove trailing dot from setting description
The trailing dot is already added when generating the man page.
2020-03-23 11:42:57 +01:00
Thomas Haller
3b69f02164 all: unify format of our Copyright source code comments
```bash

readarray -d '' FILES < <(
  git ls-files -z \
    ':(exclude)po' \
    ':(exclude)shared/c-rbtree' \
    ':(exclude)shared/c-list' \
    ':(exclude)shared/c-siphash' \
    ':(exclude)shared/c-stdaux' \
    ':(exclude)shared/n-acd' \
    ':(exclude)shared/n-dhcp4' \
    ':(exclude)src/systemd/src' \
    ':(exclude)shared/systemd/src' \
    ':(exclude)m4' \
    ':(exclude)COPYING*'
  )

sed \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \
  -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \
  -i \
  "${FILES[@]}"

echo ">>> untouched Copyright lines"
git grep Copyright "${FILES[@]}"

echo ">>> Copyright lines with unusual extra"
git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved

sed \
  -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \
  -i \
  "${FILES[@]}"

```

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
2019-10-02 17:03:52 +02:00
Lubomir Rintel
24028a2246 all: SPDX header conversion
$ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
2019-09-10 11:19:56 +02:00
Thomas Haller
c0e075c902 all: drop emacs file variables from source files
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.
2019-06-11 10:04:00 +02:00
Thomas Haller
19141ef770 libnm-core: reorder code in settings
Order the code in our common way. No other changes.

- ensure to include the main header first (directly after
  "nm-default.h").

- reorder function definitions: get_property(), set_property(),
  *_init(), *_new(), finalize(), *_class_init().
2019-01-15 09:55:24 +01:00
Beniamino Galvani
9b9dce9486 all: add 'match' setting
Add a new 'match' setting containing properties to match a connection
to devices. At the moment only the interface-name property is present
and, contrary to connection.interface-name, it allows the use of
wildcards.
2018-08-11 09:41:07 +02:00