<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/src/platform/tests/test-common.h, branch th/fix-python-test</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>all: SPDX header conversion</title>
<updated>2019-09-10T09:19:56+00:00</updated>
<author>
<name>Lubomir Rintel</name>
<email>lkundrak@v3.sk</email>
</author>
<published>2019-09-10T09:19:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=24028a22467275671df71cc6a8054036b37d8f03'/>
<id>24028a22467275671df71cc6a8054036b37d8f03</id>
<content type='text'>
  $ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  $ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: add tests for handling policy routing rules</title>
<updated>2019-03-13T08:03:59+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-03-05T17:01:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=5ae2431b0f9e8dc2fbba5c9783852735a8db7c27'/>
<id>5ae2431b0f9e8dc2fbba5c9783852735a8db7c27</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>all: drop unnecessary includes of &lt;errno.h&gt; and &lt;string.h&gt;</title>
<updated>2019-02-12T07:50:28+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-01-31T12:44:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=a3370af3a8a965e41950c5022182730d79614df2'/>
<id>a3370af3a8a965e41950c5022182730d79614df2</id>
<content type='text'>
"nm-macros-interal.h" already includes &lt;errno.h&gt; and &lt;string.h&gt;.
No need to include it everywhere else too.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
"nm-macros-interal.h" already includes &lt;errno.h&gt; and &lt;string.h&gt;.
No need to include it everywhere else too.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: merge NMPlatformError with nm-error</title>
<updated>2018-12-27T20:33:59+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-12-22T13:13:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=d18f40320d1a5bb5f43a61f473d2cb6105da9b4e'/>
<id>d18f40320d1a5bb5f43a61f473d2cb6105da9b4e</id>
<content type='text'>
Platform had it's own scheme for reporting errors: NMPlatformError.
Before, NMPlatformError indicated success via zero, negative integer
values are numbers from &lt;errno.h&gt;, and positive integer values are
platform specific codes. This changes now according to nm-error:
success is still zero. Negative values indicate a failure, where the
numeric value is either from &lt;errno.h&gt; or one of our error codes.
The meaning of positive values depends on the functions. Most functions
can only report an error reason (negative) and success (zero). For such
functions, positive values should never be returned (but the caller
should anticipate them).
For some functions, positive values could mean additional information
(but still success). That depends.

This is also what systemd does, except that systemd only returns
(negative) integers from &lt;errno.h&gt;, while we merge our own error codes
into the range of &lt;errno.h&gt;.

The advantage is to get rid of one way how to signal errors. The other
advantage is, that these error codes are compatible with all other
nm-errno values. For example, previously negative values indicated error
codes from &lt;errno.h&gt;, but it did not entail error codes from netlink.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Platform had it's own scheme for reporting errors: NMPlatformError.
Before, NMPlatformError indicated success via zero, negative integer
values are numbers from &lt;errno.h&gt;, and positive integer values are
platform specific codes. This changes now according to nm-error:
success is still zero. Negative values indicate a failure, where the
numeric value is either from &lt;errno.h&gt; or one of our error codes.
The meaning of positive values depends on the functions. Most functions
can only report an error reason (negative) and success (zero). For such
functions, positive values should never be returned (but the caller
should anticipate them).
For some functions, positive values could mean additional information
(but still success). That depends.

This is also what systemd does, except that systemd only returns
(negative) integers from &lt;errno.h&gt;, while we merge our own error codes
into the range of &lt;errno.h&gt;.

The advantage is to get rid of one way how to signal errors. The other
advantage is, that these error codes are compatible with all other
nm-errno values. For example, previously negative values indicated error
codes from &lt;errno.h&gt;, but it did not entail error codes from netlink.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: assert against valid ifindex and remove duplicate assertions</title>
<updated>2018-12-03T11:26:16+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-11-29T11:33:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=945c904f956580616f0d71b13c63f525c184060c'/>
<id>945c904f956580616f0d71b13c63f525c184060c</id>
<content type='text'>
We want that all code paths assert strictly and gracefully.

That means, if we have function nm_platform_link_get() which calls
nm_platform_link_get_obj(), then we don't need to assert the same things
twice. Don't have the calling function assert itself, if it is obvious
that the first thing that it does, is calling a function that itself
asserts the same conditions.

On the other hand, it simply indicates a bug passing a non-positive
ifindex to any of these platform functions. No longer let
nm_platform_link_get_obj() handle negative ifindex gracefully. Instead,
let it directly pass it to nmp_cache_lookup_link(), which eventually
does a g_return_val_if_fail() check. This quite possible enables
assertions on a lot of code paths. But note that g_return_val_if_fail()
is graceful and does not lead to a crash (unless G_DEBUG=fatal-criticals
is set for debugging).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We want that all code paths assert strictly and gracefully.

That means, if we have function nm_platform_link_get() which calls
nm_platform_link_get_obj(), then we don't need to assert the same things
twice. Don't have the calling function assert itself, if it is obvious
that the first thing that it does, is calling a function that itself
asserts the same conditions.

On the other hand, it simply indicates a bug passing a non-positive
ifindex to any of these platform functions. No longer let
nm_platform_link_get_obj() handle negative ifindex gracefully. Instead,
let it directly pass it to nmp_cache_lookup_link(), which eventually
does a g_return_val_if_fail() check. This quite possible enables
assertions on a lot of code paths. But note that g_return_val_if_fail()
is graceful and does not lead to a crash (unless G_DEBUG=fatal-criticals
is set for debugging).
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: improve nmtstp_link_delete() for deleting links</title>
<updated>2018-12-03T11:26:16+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-11-29T15:00:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=da39a0ada353f2891dd2dd98479506f92a756526'/>
<id>da39a0ada353f2891dd2dd98479506f92a756526</id>
<content type='text'>
nm_platform_link_delete() will soon assert against positive ifindex
argument.

    nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));

will result in an assertion, if the link does not exist.

Extend nmtstp_link_delete() to gracefully skip deleting the link
so that it can be used in such situations.

Also, rename nmtstp_link_del() to nmtstp_link_delete(), because it's
closer to nm_platform_link_delete().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nm_platform_link_delete() will soon assert against positive ifindex
argument.

    nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));

will result in an assertion, if the link does not exist.

Extend nmtstp_link_delete() to gracefully skip deleting the link
so that it can be used in such situations.

Also, rename nmtstp_link_del() to nmtstp_link_delete(), because it's
closer to nm_platform_link_delete().
</pre>
</div>
</content>
</entry>
<entry>
<title>build: avoid header conflict for &lt;linux/if.h&gt; and &lt;net/if.h&gt; with "nm-platform.h"</title>
<updated>2018-11-12T15:02:35+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-11-12T14:23:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=37e47fbdabd6439c022a5fc3b72176aa6c4e569f'/>
<id>37e47fbdabd6439c022a5fc3b72176aa6c4e569f</id>
<content type='text'>
In the past, the headers "linux/if.h" and "net/if.h" were incompatible.
That means, we can either include one or the other, but not both.
This is fixed in the meantime, however the issue still exists when
building against older kernel/glibc.

That means, including one of these headers from a header file
is problematic. In particular if it's a header like "nm-platform.h",
which itself is dragged in by many other headers.

Avoid that by not including these headers from "platform.h", but instead
from the source files where needed (or possibly from less popular header
files).

Currently there is no problem. However, this allows an unknowing user to
include &lt;net/if.h&gt; at the same time with "nm-platform.h", which is easy
to get wrong.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the past, the headers "linux/if.h" and "net/if.h" were incompatible.
That means, we can either include one or the other, but not both.
This is fixed in the meantime, however the issue still exists when
building against older kernel/glibc.

That means, including one of these headers from a header file
is problematic. In particular if it's a header like "nm-platform.h",
which itself is dragged in by many other headers.

Avoid that by not including these headers from "platform.h", but instead
from the source files where needed (or possibly from less popular header
files).

Currently there is no problem. However, this allows an unknowing user to
include &lt;net/if.h&gt; at the same time with "nm-platform.h", which is easy
to get wrong.
</pre>
</div>
</content>
</entry>
<entry>
<title>all: don't use gchar/gshort/gint/glong but C types</title>
<updated>2018-07-11T10:02:06+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-07-11T05:40:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9'/>
<id>e1c7a2b5d0b142a3d4347ec6f1934f53c4b402a9</id>
<content type='text'>
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.

    $ git grep '\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    587
    $ git grep '\&lt;\(char\|short\|int\|long\|float\|double\)\&gt;' | 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/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;\( [^ ]\)/\1\2/g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;  /\1   /g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;/\1/g' \
      "${FILES[@]}"
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We commonly don't use the glib typedefs for char/short/int/long,
but their C types directly.

    $ git grep '\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;' | wc -l
    587
    $ git grep '\&lt;\(char\|short\|int\|long\|float\|double\)\&gt;' | 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/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;\( [^ ]\)/\1\2/g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;  /\1   /g' \
      -e 's/\&lt;g\(char\|short\|int\|long\|float\|double\)\&gt;/\1/g' \
      "${FILES[@]}"
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: add ip6gre/ip6gretap tunnels support</title>
<updated>2018-07-02T15:55:14+00:00</updated>
<author>
<name>Beniamino Galvani</name>
<email>bgalvani@redhat.com</email>
</author>
<published>2018-06-26T10:06:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=09a868a24e8ca22ef66650e58e7d2b9eeb73aed7'/>
<id>09a868a24e8ca22ef66650e58e7d2b9eeb73aed7</id>
<content type='text'>
Add platform support for IP6GRE and IP6GRETAP tunnels. The former is a
virtual tunnel interface for GRE over IPv6 and the latter is the L2
variant.

The platform code internally reuses and extends the same structure
used by IPv6 tunnels.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add platform support for IP6GRE and IP6GRETAP tunnels. The former is a
virtual tunnel interface for GRE over IPv6 and the latter is the L2
variant.

The platform code internally reuses and extends the same structure
used by IPv6 tunnels.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: support creating non-persistant TUN/TAP devices</title>
<updated>2018-04-09T18:16:31+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T16:23:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=ef93f6caad0552b8bd73057caed52147dac5eda0'/>
<id>ef93f6caad0552b8bd73057caed52147dac5eda0</id>
<content type='text'>
For completeness, extend the API to support non-persistant
device. That requires that nm_platform_link_tun_add()
returns the file descriptor.

While NetworkManager doesn't create such devices itself,
it recognizes the IFLA_TUN_PERSIST / IFF_PERSIST flag.
Since ip-tuntap (obviously) cannot create such devices,
we cannot add a test for how non-persistent devices look
in the platform cache. Well, we could instead add them
with ioctl directly, but instead, just extend the platform
API to allow for that.

Also, use the function from test-lldp.c to (optionally) use
nm_platform_link_tun_add() to create the tap device.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For completeness, extend the API to support non-persistant
device. That requires that nm_platform_link_tun_add()
returns the file descriptor.

While NetworkManager doesn't create such devices itself,
it recognizes the IFLA_TUN_PERSIST / IFF_PERSIST flag.
Since ip-tuntap (obviously) cannot create such devices,
we cannot add a test for how non-persistent devices look
in the platform cache. Well, we could instead add them
with ioctl directly, but instead, just extend the platform
API to allow for that.

Also, use the function from test-lldp.c to (optionally) use
nm_platform_link_tun_add() to create the tap device.
</pre>
</div>
</content>
</entry>
</feed>
