<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/src/platform/nm-netlink.c, branch th/strsplit</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>platform/netlink: cleanup nlmsg_append() and add nlmsg_append_struct() macro</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-19T15:35:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=815e0329c03505d066ea988126db4ce503aa9143'/>
<id>815e0329c03505d066ea988126db4ce503aa9143</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: add more RTM message types in to-string function nl_nlmsghdr_to_str()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-18T11:07:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=5920f187d31d835093a01a96bd158b327580ecd1'/>
<id>5920f187d31d835093a01a96bd158b327580ecd1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: require valid nla argument for nla_get_u64()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-18T09:05:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=fac357ac8b299af9f042d5303400da16a0244bc2'/>
<id>fac357ac8b299af9f042d5303400da16a0244bc2</id>
<content type='text'>
nla_get_u64() was unlike all other nla_get_u*() implementations, in that it
would allow for a missing/invalid nla argument, and return 0.

Don't do this. For one, don't behave different than other getters.
Also, there really is no space to report errors. Hence, the caller must
make sure that the attribute is present and suitable -- like for other
nla_get_*() functions.

None of the callers relied on being able to pass NULL attribute.

Also, inline the function and use unaligned_read_ne64(). That is our
preferred way for reading unaligned data, not memcpy().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nla_get_u64() was unlike all other nla_get_u*() implementations, in that it
would allow for a missing/invalid nla argument, and return 0.

Don't do this. For one, don't behave different than other getters.
Also, there really is no space to report errors. Hence, the caller must
make sure that the attribute is present and suitable -- like for other
nla_get_*() functions.

None of the callers relied on being able to pass NULL attribute.

Also, inline the function and use unaligned_read_ne64(). That is our
preferred way for reading unaligned data, not memcpy().
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: use designated initializer in nlmsg_alloc_size()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-17T20:41:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=5044c33eade0ce0dc0ffb7bf26620cb17ac13c65'/>
<id>5044c33eade0ce0dc0ffb7bf26620cb17ac13c65</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: assert for valid policy for string attribute in validate_nla</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-21T07:57:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f7df8fda1a880a0922e08302d5666adf2be4ddfb'/>
<id>f7df8fda1a880a0922e08302d5666adf2be4ddfb</id>
<content type='text'>
The policy for strings must indicate a minlen of at least 1.

Everything else is a bug, because the policy contains invalid
data -- and is determined at compile-time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The policy for strings must indicate a minlen of at least 1.

Everything else is a bug, because the policy contains invalid
data -- and is determined at compile-time.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: cleanup nla_memcpy()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-17T18:24:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=82e31b2816149c8dc4cdf5bb50bb1683f3b93ecf'/>
<id>82e31b2816149c8dc4cdf5bb50bb1683f3b93ecf</id>
<content type='text'>
- use size_t arguments for the memory sizes. While sizes from netlink
  API currently are int typed and inherrently limited, use the more
  appropriate data type.

- rename the arguments. The "count" is really the size of the
  destination buffer.

- return how many bytes we wanted to write (like g_strlcpy()).
  That makes more sense than how many bytes we actually wrote
  because previously, we could not detect truncation.
  Anyway, none of the callers cared about the return-value either
  way.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- use size_t arguments for the memory sizes. While sizes from netlink
  API currently are int typed and inherrently limited, use the more
  appropriate data type.

- rename the arguments. The "count" is really the size of the
  destination buffer.

- return how many bytes we wanted to write (like g_strlcpy()).
  That makes more sense than how many bytes we actually wrote
  because previously, we could not detect truncation.
  Anyway, none of the callers cared about the return-value either
  way.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: cleanup nla_strlcpy()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-17T18:06:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=b080146cc6fc9ee4ca269cc3b1ab2d0b0c952a52'/>
<id>b080146cc6fc9ee4ca269cc3b1ab2d0b0c952a52</id>
<content type='text'>
- let nla_strlcpy() return how many bytes we would like to have
  copied. That way, the caller could detect string truncation.
  In practice, no caller cared about that.

- the code before would also fill the entire buffer with zeros first,
  like strncpy(). We still do that. However, only copy the bytes up
  to the first NUL byte. The previous version would have copied
  "a\0b\0" (with srclen 4) as "a\0b". Strip all bytes after the
  first NUL character from src. That seems more correct here.

- accept nla argument as %NULL.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- let nla_strlcpy() return how many bytes we would like to have
  copied. That way, the caller could detect string truncation.
  In practice, no caller cared about that.

- the code before would also fill the entire buffer with zeros first,
  like strncpy(). We still do that. However, only copy the bytes up
  to the first NUL byte. The previous version would have copied
  "a\0b\0" (with srclen 4) as "a\0b". Strip all bytes after the
  first NUL character from src. That seems more correct here.

- accept nla argument as %NULL.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: cleanup nla_parse*() code by using safer macros</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-15T10:33:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=6f8208c0d452c616bae02adff8dd8c707d722a07'/>
<id>6f8208c0d452c616bae02adff8dd8c707d722a07</id>
<content type='text'>
- drop explicit MAX sizes like

      static const struct nla_policy policy[IFLA_INET6_MAX+1] = {

  The compiler will deduce that.

  It saves redundant information (which is possibly wrong). Also,
  the max define might be larger than we actually need it, so we
  just waste a few bytes of static memory and do unnecesary steps
  during validation.

  Also, the compiler will catch bugs, if the array size of policy/tb
  is too short for what we access later (-Warray-bounds).

- avoid redundant size specifiers like:

      static const struct nla_policy policy[IFLA_INET6_MAX+1] = {
      ...
      struct nlattr *tb[IFLA_INET6_MAX+1];
      ...
      err = nla_parse_nested (tb, IFLA_INET6_MAX, attr, policy);

- use the nla_parse*_arr() macros that determine the maxtype
  based on the argument types.

- move declaration of "static const struct nla_policy policy" variable
  to the beginning, before auto variables.

- drop unneeded temporay error variables.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- drop explicit MAX sizes like

      static const struct nla_policy policy[IFLA_INET6_MAX+1] = {

  The compiler will deduce that.

  It saves redundant information (which is possibly wrong). Also,
  the max define might be larger than we actually need it, so we
  just waste a few bytes of static memory and do unnecesary steps
  during validation.

  Also, the compiler will catch bugs, if the array size of policy/tb
  is too short for what we access later (-Warray-bounds).

- avoid redundant size specifiers like:

      static const struct nla_policy policy[IFLA_INET6_MAX+1] = {
      ...
      struct nlattr *tb[IFLA_INET6_MAX+1];
      ...
      err = nla_parse_nested (tb, IFLA_INET6_MAX, attr, policy);

- use the nla_parse*_arr() macros that determine the maxtype
  based on the argument types.

- move declaration of "static const struct nla_policy policy" variable
  to the beginning, before auto variables.

- drop unneeded temporay error variables.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: cleanup unnecessary "goto out" from nla_parse()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-15T10:36:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=6245569c6d3b55a346b48e6c60ea6d8175802096'/>
<id>6245569c6d3b55a346b48e6c60ea6d8175802096</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/netlink: fix _genl_parse_getfamily() for checking error code from genlmsg_parse()</title>
<updated>2019-02-22T08:58:09+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2019-02-15T11:34:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=106e4ebc130ebfb8727cf394239c5bc73d6f59d7'/>
<id>106e4ebc130ebfb8727cf394239c5bc73d6f59d7</id>
<content type='text'>
Errors are negative numbers.

This had no effect however, because currently genlmsg_parse() won't ever return
positive values.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Errors are negative numbers.

This had no effect however, because currently genlmsg_parse() won't ever return
positive values.
</pre>
</div>
</content>
</entry>
</feed>
