Commit Graph

18 Commits

Author SHA1 Message Date
Thomas Haller
a83eb773ce all: modify line separator comments to be 80 chars wide
sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
2016-10-03 12:01:15 +02:00
Thomas Haller
d37945b064 all: use nm_strcmp_p() for sorting strings 2016-06-15 10:32:32 +02:00
Thomas Haller
f664c04973 libnm/keyfile: sort entries for writing hash-of-strings
This sorts the entries of the [vpn] section alphabetically.

The sorting order doesn't really matter, but having a defined,
stable way to export a connection is preferred. Also, it looks
better when looking at the keyfile with an editor.
2016-05-23 10:15:17 +02: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
Thomas Haller
afaa27ddbb libnm/keyfile/trivial: rename VPN_SECRETS_GROUP define to NM_KEYFILE_GROUP_VPN_SECRETS
It is a define from an internal header. Still, all defines in headers
should be named with a NM prefix.
2016-02-14 11:14:35 +01:00
Thomas Haller
2c2d9d2e4c build: cleanup default includes
- "gsystem-local-alloc.h" and <gio/gio.h> are already included via
  "nm-default.h". No need to include them separately.

- include "nm-macros-internal.h" via "nm-default.h" and drop all
  explict includes.

- in the modified files, ensure that we always include "config.h"
  and "nm-default.h" first. As second, include the header file
  for the current source file (if applicable). Then follow external
  includes and finally internal nm includes.

- include nm headers inside source code files with quotes

- internal header files don't need to include default headers.
  They can savely assume that "nm-default.h" is already included
  and with it glib, nm-glib.h, nm-macros-internal.h, etc.
2016-02-12 15:36:01 +01:00
Thomas Haller
4f6c91d696 wifi: enable mac-address-randomization by default for new connections
But ensure that old keyfiles that did not yet understand
the new key continue to have it disabled.
2015-11-18 15:37:42 +01:00
Thomas Haller
549ec35d7b libnm/keyfile: fix leak in ip6-addr-gen-mode writer
Fixes: f70c8f3d29
2015-11-11 16:15:41 +01:00
Lubomir Rintel
e9dfdfe9fe libnm-core: default to ip6.addr-gen-mode=stable-privacy
Take a missing value in keyfile/ifcfg-rh as EUI-64 to keep the compatibility
with the old conneciton. Nevertheless, the new connections should default to
the RFC7217 addresses.
2015-11-02 20:27:36 +01:00
Lubomir Rintel
f70c8f3d29 keyfile: add support for addr-gen-mode property 2015-11-02 20:27:00 +01:00
Jiří Klimeš
687b651598 libnm/vlan: default to vlan.flags=REORDER_HDR for new connections (rh #1250225)
The kernel defaults REORDER_HDR to 1 when creating a new VLAN, but
NetworkManager's VLAN flags property defaulted to 0. Thus REORDER_HDR was not
set for NM-created VLANs with default values.

We want to match the kernel default, so we change the default value for the
vlan.flags property. However, we do not want to change the flags for existing
connections if the property is missing in connection files. Thus we have to
update plugins for that. We also make sure that vlan.flags is always written
by 'keyfile' when the value is default. That way new connections have flags
property explicitly written and it will be loaded as expected.

https://bugzilla.redhat.com/show_bug.cgi?id=1250225
2015-10-07 13:45:30 +02:00
Dan Winship
22e1a97e12 all: drop includes to <glib/gi18n.h> for "nm-default.h"
The localization headers are now included via "nm-default.h".

Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
instead of <glib/gi18n.h>. For example under "clients/" directory.
2015-08-05 15:35:51 +02:00
Thomas Haller
19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Thomas Haller
c9a8764ad2 keyfile: support writing certificates as blob inside the keyfile
keyfile should become our main import/export format. It is desirable,
that a keyfile can contain every aspect of a connection.

For blob certificates, the writer in core daemon would always write
them to a file and convert the scheme to path.
This behavior is not great for a (hyptetical) `nmcli connection export`
command because it would have to export them somehow outside of keyfile,
e.g. by writing them to temporary files.

Instead, if the write handler does not handle a certificate, use a
default implementation in nm_keyfile_write() which adds the blob inside
the keyfile.

Interestingly, keyfile reader already supported reading certificate
blobs. But this legacy format accepts the blob as arbitrary
binary without marking the format and without scheme prefix.
Instead of writing the binary data directly, write it with a new
uri scheme "data:;base64," and encode it in base64.

Also go through some lengths to make sure that whatever path
keyfile plugin writes, can be read back again. That is, because
keyfile writer preferably writes relative paths without prefix.
Add nm_keyfile_detect_unqualified_path_scheme() to encapsulate
the detection of pathnames without file:// prefix and use it to
check whether the path name must be fully qualified.
2015-03-12 18:16:58 +01:00
Thomas Haller
5e5afcffce libnm: merge nm-keyfile-reader.h and nm-keyfile-writer.h to internal header
These headers are not entirely private to libnm-core as they are also
used by keyfile plugin. Merge them to a new header file
nm-keyfile-internal.h so that the name makes the internal nature of the
header more apparent.
2015-03-12 18:12:26 +01:00
Thomas Haller
04df4edf48 libnm: add keyfile support to libnm-core
https://bugzilla.gnome.org/show_bug.cgi?id=744699
2015-03-12 18:12:26 +01:00
Thomas Haller
1fc9bc401e keyfile: copy read/writer files to libnm-core
This is the first step to move keyfile to libnm. For now, only
copy the files to make later changes nicer in git-history.

  /bin/cp src/settings/plugins/keyfile/reader.c libnm-core/nm-keyfile-reader.c
  /bin/cp src/settings/plugins/keyfile/reader.h libnm-core/nm-keyfile-reader.h
  /bin/cp src/settings/plugins/keyfile/utils.c  libnm-core/nm-keyfile-utils.c
  /bin/cp src/settings/plugins/keyfile/utils.h  libnm-core/nm-keyfile-utils.h
  /bin/cp src/settings/plugins/keyfile/writer.c libnm-core/nm-keyfile-writer.c
  /bin/cp src/settings/plugins/keyfile/writer.h libnm-core/nm-keyfile-writer.h
2015-03-12 18:12:26 +01:00