<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/net/batman-adv/network-coding.c, branch v5.7-rc6</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v5.7-rc6</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v5.7-rc6'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2020-04-21T08:08:04+00:00</updated>
<entry>
<title>batman-adv: fix batadv_nc_random_weight_tq</title>
<updated>2020-04-21T08:08:04+00:00</updated>
<author>
<name>George Spelvin</name>
<email>lkml@sdf.org</email>
</author>
<published>2020-03-08T13:44:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=fd0c42c4dea54335967c5a86f15fc064235a2797'/>
<id>urn:sha1:fd0c42c4dea54335967c5a86f15fc064235a2797</id>
<content type='text'>
and change to pseudorandom numbers, as this is a traffic dithering
operation that doesn't need crypto-grade.

The previous code operated in 4 steps:

1. Generate a random byte 0 &lt;= rand_tq &lt;= 255
2. Multiply it by BATADV_TQ_MAX_VALUE - tq
3. Divide by 255 (= BATADV_TQ_MAX_VALUE)
4. Return BATADV_TQ_MAX_VALUE - rand_tq

This would apperar to scale (BATADV_TQ_MAX_VALUE - tq) by a random
value between 0/255 and 255/255.

But!  The intermediate value between steps 3 and 4 is stored in a u8
variable.  So it's truncated, and most of the time, is less than 255, after
which the division produces 0.  Specifically, if tq is odd, the product is
always even, and can never be 255.  If tq is even, there's exactly one
random byte value that will produce a product byte of 255.

Thus, the return value is 255 (511/512 of the time) or 254 (1/512
of the time).

If we assume that the truncation is a bug, and the code is meant to scale
the input, a simpler way of looking at it is that it's returning a random
value between tq and BATADV_TQ_MAX_VALUE, inclusive.

Well, we have an optimized function for doing just that.

Fixes: 3c12de9a5c75 ("batman-adv: network coding - code and transmit packets if possible")
Signed-off-by: George Spelvin &lt;lkml@sdf.org&gt;
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Update copyright years for 2020</title>
<updated>2019-12-31T23:00:33+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2019-12-31T23:00:01+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=68e039f966cb577c91649a02591646ac3919f8c9'/>
<id>urn:sha1:68e039f966cb577c91649a02591646ac3919f8c9</id>
<content type='text'>
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: no need to check return value of debugfs_create functions</title>
<updated>2019-06-27T17:25:04+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-06-14T07:11:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3bcacd1e067266173c35628df96be7819ab3d64a'/>
<id>urn:sha1:3bcacd1e067266173c35628df96be7819ab3d64a</id>
<content type='text'>
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Because we don't care if debugfs works or not, this trickles back a bit
so we can clean things up by making some functions return void instead
of an error value that is never going to fail.

Cc: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Cc: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
Cc: Antonio Quartulli &lt;a@unstable.cc&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: b.a.t.m.a.n@lists.open-mesh.org
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
[sven@narfation.org: drop unused variables]
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Drop license boilerplate</title>
<updated>2019-03-25T08:31:35+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2019-03-03T14:52:07+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=0d5f20c42b24adffa1505ec3d4930d11dfaea82f'/>
<id>urn:sha1:0d5f20c42b24adffa1505ec3d4930d11dfaea82f</id>
<content type='text'>
All files got a SPDX-License-Identifier with commit 7db7d9f369a4
("batman-adv: Add SPDX license identifier above copyright header"). All the
required information about the license conditions can be found in
LICENSES/.

Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Update copyright years for 2019</title>
<updated>2019-01-04T10:04:24+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2018-12-31T22:59:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=7a79d717e0817610932ce3b7b6033ea06ee1d577'/>
<id>urn:sha1:7a79d717e0817610932ce3b7b6033ea06ee1d577</id>
<content type='text'>
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Prevent duplicated nc_node entry</title>
<updated>2018-09-06T11:55:58+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2018-08-12T19:04:42+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=fa122fec8640eb7186ce5a41b83a4c1744ceef8f'/>
<id>urn:sha1:fa122fec8640eb7186ce5a41b83a4c1744ceef8f</id>
<content type='text'>
The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
to the in_coding_list and out_coding_list. It first checks whether the
entry already is in the list or not. If it is, then the creation of a new
entry is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Acked-by: Marek Lindner &lt;mareklindner@neomailbox.ch&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Update copyright years for 2018</title>
<updated>2018-02-26T16:57:39+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2017-12-31T23:00:00+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=6b1aea8cf2c8618146edaf6b35775ab55f7cafe5'/>
<id>urn:sha1:6b1aea8cf2c8618146edaf6b35775ab55f7cafe5</id>
<content type='text'>
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Convert packet.h to uapi header</title>
<updated>2017-12-21T20:35:53+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven.eckelmann@openmesh.com</email>
</author>
<published>2017-12-21T09:17:41+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=fec149f5d3234c037ec761d1db4cc8c0550e9964'/>
<id>urn:sha1:fec149f5d3234c037ec761d1db4cc8c0550e9964</id>
<content type='text'>
The header file is used by different userspace programs to inject packets
or to decode sniffed packets. It should therefore be available to them as
userspace header.

Also other components in the kernel (like the flow dissector) require
access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
packets.

Signed-off-by: Sven Eckelmann &lt;sven.eckelmann@openmesh.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>batman-adv: Use parentheses in function kernel-doc</title>
<updated>2017-12-15T16:29:20+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2017-12-02T18:51:47+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=7e9a8c2ce7c5f8745c003e2ba4758c21c38a0419'/>
<id>urn:sha1:7e9a8c2ce7c5f8745c003e2ba4758c21c38a0419</id>
<content type='text'>
The documentation describing kernel-doc comments for functions ("How to
format kernel-doc comments") uses parentheses at the end of the function
name. Using this format allows to use a consistent style when adding
documentation to a function and when referencing this function in a
different kernel-doc section.

Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
<entry>
<title>batman-adv: Include net.h for net_ratelimited_function</title>
<updated>2017-12-15T16:29:17+00:00</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2017-11-19T16:12:04+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3a64469e4fddeeca8e6fba7ea4e9558a4af3a1c8'/>
<id>urn:sha1:3a64469e4fddeeca8e6fba7ea4e9558a4af3a1c8</id>
<content type='text'>
The linux/net.h provides the net_ratelimited_function. It should
therefore be included directly before it is used.

Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Simon Wunderlich &lt;sw@simonwunderlich.de&gt;
</content>
</entry>
</feed>
