<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/src/platform/nm-linux-platform.c, branch lr/python3</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>all: use the elvis operator wherever possible</title>
<updated>2018-05-10T12:36:58+00:00</updated>
<author>
<name>Lubomir Rintel</name>
<email>lkundrak@v3.sk</email>
</author>
<published>2018-04-24T09:20:03+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e69d386975be997d3d840de9045e51521ac4474c'/>
<id>e69d386975be997d3d840de9045e51521ac4474c</id>
<content type='text'>
Coccinelle:

  @@
  expression a, b;
  @@
  -a ? a : b
  +a ?: b

Applied with:

  spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir .

With some manual adjustments on spots that Cocci didn't catch for
reasons unknown.

Thanks to the marvelous effort of the GNU compiler developer we can now
spare a couple of bits that could be used for more important things,
like this commit message. Standards commitees yet have to catch up.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Coccinelle:

  @@
  expression a, b;
  @@
  -a ? a : b
  +a ?: b

Applied with:

  spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir .

With some manual adjustments on spots that Cocci didn't catch for
reasons unknown.

Thanks to the marvelous effort of the GNU compiler developer we can now
spare a couple of bits that could be used for more important things,
like this commit message. Standards commitees yet have to catch up.
</pre>
</div>
</content>
</entry>
<entry>
<title>all: remove consecutive empty lines</title>
<updated>2018-04-30T14:24:52+00:00</updated>
<author>
<name>Beniamino Galvani</name>
<email>bgalvani@redhat.com</email>
</author>
<published>2018-04-30T11:46:24+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=1b5925ce881370a1aba347cea0afe61e6316e81a'/>
<id>1b5925ce881370a1aba347cea0afe61e6316e81a</id>
<content type='text'>
Normalize coding style by removing consecutive empty lines from C
sources and headers.

https://github.com/NetworkManager/NetworkManager/pull/108
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Normalize coding style by removing consecutive empty lines from C
sources and headers.

https://github.com/NetworkManager/NetworkManager/pull/108
</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://trove.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>
<entry>
<title>platform: workaround kernel issue for tun device for first RTM_NETLINK event</title>
<updated>2018-04-09T18:16:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T13:14:10+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=722f79c9c563192a46dddb921bfc00c24687f2ff'/>
<id>722f79c9c563192a46dddb921bfc00c24687f2ff</id>
<content type='text'>
Due to a bug, the current rc-kernel will emit the first netlink
notification about tun devices before the device is initialized.

Hence, the content of the message is bogus. If the message
looks like to be this case, re-request it right away.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Due to a bug, the current rc-kernel will emit the first netlink
notification about tun devices before the device is initialized.

Hence, the content of the message is bogus. If the message
looks like to be this case, re-request it right away.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: refetch TUN link when no type-specific lnk data was received</title>
<updated>2018-04-09T18:16:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T09:35:55+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f76a94668ddd4b5e1385a0daf6c8925674f9ef18'/>
<id>f76a94668ddd4b5e1385a0daf6c8925674f9ef18</id>
<content type='text'>
Now that kernel supports providing information about tun/tap devices
via netlink, make use of it.

Also, enable the hack that:
  - when we first see a link that has no lnk data, we refetch
    it on the assumption, that kernel just didn't send it
    the first time.

For old kernels that do not yet support tun properties on netlink,
this means that we will always refetch the link once, the first
time we see it. I think that is acceptable, and the more correct
behavior for newer kernels that do support it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that kernel supports providing information about tun/tap devices
via netlink, make use of it.

Also, enable the hack that:
  - when we first see a link that has no lnk data, we refetch
    it on the assumption, that kernel just didn't send it
    the first time.

For old kernels that do not yet support tun properties on netlink,
this means that we will always refetch the link once, the first
time we see it. I think that is acceptable, and the more correct
behavior for newer kernels that do support it.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: enable parsing tun/tap properties from netlink</title>
<updated>2018-04-09T18:16:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T09:21:59+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=031e58e1cf41347321b6310830ce053314f076e8'/>
<id>031e58e1cf41347321b6310830ce053314f076e8</id>
<content type='text'>
Now that the kernel patches are merged to mainline (rc), enable accepting
tun/tap link properties from netlink.

https://bugzilla.redhat.com/show_bug.cgi?id=1547213
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that the kernel patches are merged to mainline (rc), enable accepting
tun/tap link properties from netlink.

https://bugzilla.redhat.com/show_bug.cgi?id=1547213
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: refactor fetching links in cache_on_change()</title>
<updated>2018-04-09T18:16:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T13:10:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e8a9bffdb088e0fb07d674ba6daae219d050d094'/>
<id>e8a9bffdb088e0fb07d674ba6daae219d050d094</id>
<content type='text'>
Rework the code to if-else-if, to not schedule the same
DELAYED_ACTION_TYPE_REFRESH_LINK instance multiple times.

Note that delayed_action_schedule() already would check that
no duplicates are scheduled, but we can avoid that.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rework the code to if-else-if, to not schedule the same
DELAYED_ACTION_TYPE_REFRESH_LINK instance multiple times.

Note that delayed_action_schedule() already would check that
no duplicates are scheduled, but we can avoid that.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: assert in nm_platform_link_tun_add() for unsupported options</title>
<updated>2018-04-09T18:16:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-04-05T15:33:21+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=28b5118ad2f35c984ea53e3df817b6cd0a090ab9'/>
<id>28b5118ad2f35c984ea53e3df817b6cd0a090ab9</id>
<content type='text'>
It doesn't make sense that NetworkManager adds non-persist tun
devices, likewise, only the type IFF_TUN or IFF_TAP is supported.

Assert that the values are as expected.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It doesn't make sense that NetworkManager adds non-persist tun
devices, likewise, only the type IFF_TUN or IFF_TAP is supported.

Assert that the values are as expected.
</pre>
</div>
</content>
</entry>
<entry>
<title>core/platform: add support for TUN/TAP netlink support and various cleanup</title>
<updated>2018-03-20T10:59:52+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-03-13T14:29:03+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=39ab38a04d580b3d9eeae0d242b7ac9b4fb53378'/>
<id>39ab38a04d580b3d9eeae0d242b7ac9b4fb53378</id>
<content type='text'>
Kernel recently got support for exposing TUN/TAP information on netlink
[1], [2], [3]. Add support for it to the platform cache.

The advantage of using netlink is that querying sysctl bypasses the
order of events of the netlink socket. It is out of sync and racy. For
example, platform cache might still think that a tun device exists, but
a subsequent lookup at sysfs might fail because the device was deleted
in the meantime. Another point is, that we don't get change
notifications via sysctl and that it requires various extra syscalls
to read the device information. If the tun information is present on
netlink, put it into the cache. This bypasses checking sysctl while
we keep looking at sysctl for backward compatibility until we require
support from kernel.

Notes:

- we had two link types NM_LINK_TYPE_TAP and NM_LINK_TYPE_TUN. This
  deviates from the model of how kernel treats TUN/TAP devices, which
  makes it more complicated. The link type of a NMPlatformLink instance
  should match what kernel thinks about the device. Point in case,
  when parsing RTM_NETLINK messages, we very early need to determine
  the link type (_linktype_get_type()). However, to determine the
  type of a TUN/TAP at that point, we need to look into nested
  netlink attributes which in turn depend on the type (IFLA_INFO_KIND
  and IFLA_INFO_DATA), or even worse, we would need to look into
  sysctl for older kernel vesions. Now, the TUN/TAP type is a property
  of the link type NM_LINK_TYPE_TUN, instead of determining two
  different link types.

- various parts of the API (both kernel's sysctl vs. netlink) and
  NMDeviceTun vs. NMSettingTun disagree whether the PI is positive
  (NM_SETTING_TUN_PI, IFLA_TUN_PI, NMPlatformLnkTun.pi) or inverted
  (NM_DEVICE_TUN_NO_PI, IFF_NO_PI). There is no consistent way,
  but prefer the positive form for internal API at NMPlatformLnkTun.pi.

- previously NMDeviceTun.mode could not change after initializing
  the object. Allow for that to happen, because forcing some properties
  that are reported by kernel to not change is wrong, in case they
  might change. Of course, in practice kernel doesn't allow the device
  to ever change its type, but the type property of the NMDeviceTun
  should not make that assumption, because, if it actually changes, what
  would it mean?

- note that as of now, new netlink API is not yet merged to mainline Linus
  tree. Shortcut _parse_lnk_tun() to not accidentally use unstable API
  for now.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1277457
[2] https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=1ec010e705934c8acbe7dbf31afc81e60e3d828b
[3] https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=118eda77d6602616bc523a17ee45171e879d1818

https://bugzilla.redhat.com/show_bug.cgi?id=1547213
https://github.com/NetworkManager/NetworkManager/pull/77
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Kernel recently got support for exposing TUN/TAP information on netlink
[1], [2], [3]. Add support for it to the platform cache.

The advantage of using netlink is that querying sysctl bypasses the
order of events of the netlink socket. It is out of sync and racy. For
example, platform cache might still think that a tun device exists, but
a subsequent lookup at sysfs might fail because the device was deleted
in the meantime. Another point is, that we don't get change
notifications via sysctl and that it requires various extra syscalls
to read the device information. If the tun information is present on
netlink, put it into the cache. This bypasses checking sysctl while
we keep looking at sysctl for backward compatibility until we require
support from kernel.

Notes:

- we had two link types NM_LINK_TYPE_TAP and NM_LINK_TYPE_TUN. This
  deviates from the model of how kernel treats TUN/TAP devices, which
  makes it more complicated. The link type of a NMPlatformLink instance
  should match what kernel thinks about the device. Point in case,
  when parsing RTM_NETLINK messages, we very early need to determine
  the link type (_linktype_get_type()). However, to determine the
  type of a TUN/TAP at that point, we need to look into nested
  netlink attributes which in turn depend on the type (IFLA_INFO_KIND
  and IFLA_INFO_DATA), or even worse, we would need to look into
  sysctl for older kernel vesions. Now, the TUN/TAP type is a property
  of the link type NM_LINK_TYPE_TUN, instead of determining two
  different link types.

- various parts of the API (both kernel's sysctl vs. netlink) and
  NMDeviceTun vs. NMSettingTun disagree whether the PI is positive
  (NM_SETTING_TUN_PI, IFLA_TUN_PI, NMPlatformLnkTun.pi) or inverted
  (NM_DEVICE_TUN_NO_PI, IFF_NO_PI). There is no consistent way,
  but prefer the positive form for internal API at NMPlatformLnkTun.pi.

- previously NMDeviceTun.mode could not change after initializing
  the object. Allow for that to happen, because forcing some properties
  that are reported by kernel to not change is wrong, in case they
  might change. Of course, in practice kernel doesn't allow the device
  to ever change its type, but the type property of the NMDeviceTun
  should not make that assumption, because, if it actually changes, what
  would it mean?

- note that as of now, new netlink API is not yet merged to mainline Linus
  tree. Shortcut _parse_lnk_tun() to not accidentally use unstable API
  for now.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1277457
[2] https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=1ec010e705934c8acbe7dbf31afc81e60e3d828b
[3] https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=118eda77d6602616bc523a17ee45171e879d1818

https://bugzilla.redhat.com/show_bug.cgi?id=1547213
https://github.com/NetworkManager/NetworkManager/pull/77
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: pre-increment netlink sequence number and add comment</title>
<updated>2018-03-09T16:52:43+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2018-03-09T16:44:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e81224824a1c4275200aa2c95e7adec77d9d08cc'/>
<id>e81224824a1c4275200aa2c95e7adec77d9d08cc</id>
<content type='text'>
Pre-increment. That allows to not explicitly initialize nlh_seq_next
in nm_linux_platform_init().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pre-increment. That allows to not explicitly initialize nlh_seq_next
in nm_linux_platform_init().
</pre>
</div>
</content>
</entry>
</feed>
