[DragonFlyBSD - Bug #2810] (Closed) In kernel file src/sys/netinet6/nd6_nbr.c, two mbuf size comparisons are erroneous

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Wed Jun 1 01:56:46 PDT 2016


Issue #2810 has been updated by swildner.

Status changed from New to Closed

I've pushed the changes. See http://lists.dragonflybsd.org/pipermail/commits/2016-June/500528.html

Thanks
Sascha


----------------------------------------
Bug #2810: In kernel file src/sys/netinet6/nd6_nbr.c, two mbuf size comparisons are erroneous
http://bugs.dragonflybsd.org/issues/2810#change-12908

* Author: fenyo
* Status: Closed
* Priority: Low
* Assignee: 
* Category: Kernel
* Target version: 
----------------------------------------
In src/sys/netinet6/nd6_nbr.c, there are two times the same minor bug:

At first, in this part of the file:
-----------------------------
	if (max_linkhdr + maxlen >= MCLBYTES) {
#ifdef DIAGNOSTIC
		kprintf("nd6_ns_output: max_linkhdr + maxlen >= MCLBYTES "
		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
#endif
		return;
	}
-----------------------------

There is two times the same little mistake in this code: the two ">=" should be changed to ">"
(note that it is correctly written in the last line of the kprintf: "(%d + %d > %d)\n").

This is a bug because if the packet need exactly MCLBYTES, it is possible to process it, but the code returns without having processed the packet.

Anyway, it is a minor bug because this case should never happen since the Neighbor Advertisement and Neighbor Solicitation packets are always small enough to be contained in a single MBUF cluster.
But the code is wrong, it would be nicer if corrected.

Secondly, the same bug appears later in the same file:
-----------------------------------
	if (max_linkhdr + maxlen >= MCLBYTES) {
#ifdef DIAGNOSTIC
		kprintf("nd6_na_output: max_linkhdr + maxlen >= MCLBYTES "
		    "(%d + %d > %d)\n", max_linkhdr, maxlen, MCLBYTES);
#endif
		return;
-----------------------------------

Here again, the two "=>" should be changed to ">".





-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list