Commit graph

16 commits

Author SHA1 Message Date
Thomas Haller 831286df30 include: use double-quotes to include our own headers
In practice, this should only matter when there are multiple
header files with the same name. That is something we try
to avoid already, by giving headers a distinct name.

When building NetworkManager itself, we clearly want to use
double-quotes for including our own headers.
But we also want to do that in our public headers. For example:

  ./a.c
    #include <stdio.h>
    #include <nm-1.h>
    void main() {
        printf ("INCLUDED %s/nm-2.h\n", SYMB);
    }

  ./1/nm-1.h
    #include <nm-2.h>

  ./1/nm-2.h
    #define SYMB "1"

  ./2/nm-2.h
    #define SYMB "2"

$ cc -I./2 -I./1 ./a.c
$ ./a.out
INCLUDED 2/nm-2.h

Exceptions to this are
  - headers in "shared/nm-utils" that include <NetworkManager.h>. These
    headers are copied into projects and hence used like headers owned by
    those projects.
  - examples/C
2017-03-09 14:12:35 +01:00
Jiří Klimeš e02d56c50c libnm-util: document all NMSettingBondError entries 2016-08-10 22:45:31 +02:00
Thomas Haller 47555449fa libnm: add bonding option "lacp_rate" to NMSettingBond
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-02 16:36:03 +02:00
Dan Winship cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Dan Winship 9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Thomas Haller df4e159728 libnm-util: expose nm_setting_bond_validate_option as public API
Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller 4b85408e34 bond: handle bond options more gracefully
Support new bonding options and set them carefully. The options cannot
be set arbitrarily because they interfere with each other.

This commit is forward-ported from rhel-6.5, see patch
rh901662-bond-more-options.patch, originally written by Dan Williams.

https://bugzilla.redhat.com/show_bug.cgi?id=901662
https://bugzilla.redhat.com/show_bug.cgi?id=905532

Co-Authored-By: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Dan Winship e69727bf8a libnm-util: support the "primary" bond option 2013-09-27 09:34:41 -04:00
Jiří Klimeš edb85e9720 core: fix NM_IS_*_CLASS(klass) macros
The argument is 'klass' not 'obj'.
2012-07-27 13:15:54 +02:00
Dan Winship c4994bba54 libnm-util: improve NMSettingBond:verify()
Add NM_SETTING_BOND_ERROR_INVALID_OPTION and
NM_SETTING_BOND_ERROR_MISSING_OPTION error codes so we can better
distinguish errors in different options, and add checks for various
incompatible sets of options.
2012-03-22 13:12:57 -04:00
Dan Winship 54ef8f3224 Fix names of error enum values
When NM was registering all of its enum types by hand, it was using
NamesLikeThis rather than the default names-like-this for the "nick"
values. When we switched to using glib-mkenums, this resulted in
dbus-glib using different strings for the D-Bus error names, causing
compatibility problems.

Fix this by using glib-mkenums annotations to manually fix all the
enum values back to what they were before. (This can't be done in a
more automated way, because the old names aren't 100% consistent. Eg,
"UNKNOWN" frequently becomes "UnknownError" rather than just
"Unknown".)
2012-03-12 15:29:52 -04:00
Dan Williams b9ddbe58f0 libnm-util: add functions for getting valid bond options and defaults
Since the options are a hash table now there wasn't any way to
determine what options were allowed and what their default values
are.  Add some functions to do that.
2012-03-01 17:40:18 -06:00
Jiří Klimeš 7b9c728b85 docs: correct NMSettingBond documentation errors 2012-02-20 12:12:40 +01:00
Thomas Graf 4f166d719b bonding: convert individual bonding options to a dict
Removes all bonding options properties and adds a "options" dict to hold
them all. Accessible via accessor functions. ifcfg interface is
unchanged.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-02-15 21:49:05 -06:00
Dan Winship 839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Thomas Graf a2a0d78818 bonding: settings parser for ifcfg plugin + NMSettingBond class
Introduced a new TYPE=bond for ifcfg-rh configuration files.
Alternatively BONDING_MASTER=yes can be specified instead of
setting the type explicitely to maintain backwards compatibility
with existing configuration files.

Bonding device files require a DEVICE= line to be present which
specifies the virtual bonding interface in the kernel. We do not
allow auto-generation of the name in order to keep confusion to
a minimum when reusing existing bonding interfaces.

The BONDING_OPTS= parameter can be used to specify various bonding
related options, such as:
  - mode
  - miimon
  - updelay
  - downdelay
  - arp_interval
  - arp_ip_target

By default, the NMSettingBond class uses a miimon value of 100 which
seems like a sensible default value for 99% of all configurations.
If this is not suitable, an arp_ip_target needs to be specified
manually.

A writer is not yet implemented.

Changes v2:
 - renamed DeviceName property to InterfaceName
 - moved code to validate device name to dev_valid_name() for future use

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:16:31 -06:00