Subject: bin/32681: Possible error in usr.sbin/arp/arp.c ?
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <yves-emmanuel.jutard@fr.thalesgroup.com>
List: netbsd-bugs
Date: 01/31/2006 16:50:00
>Number:         32681
>Category:       bin
>Synopsis:       Possible error in usr.sbin/arp/arp.c ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 31 16:50:00 +0000 2006
>Originator:     Yves-Emmanuel JUTARD
>Release:        3.0.0
>Organization:
THALES Communication
>Environment:
custom environment : recompiled from /src, only some parts of NetBSD are used (TCP/IP stack and some parts of the kernel)
>Description:
While reading file usr.sbin/arp/arp.c, v 1.41, I've encountered a strange line which I do not understand fully but I find suspicious.
line 338, one can see :
	if (info && strncmp(info, "pro", 3) )
since it's well known that 'strncmp' return '0' on match (equivalent to false), this test actually check that 'info' is NOT EQUAL to "pro" and set the variable 'export_only' then.

However, in the remaining of the file, the variable 'export_only' looks associated with special proxy stuff (meaning of the 'pro' keyword).

So I wonder if the correct test line 338 shouldn't be :
	if (info && (strncmp(info, "pro", 3) == 0) )

matching only if the 'pro' option is here.

I warn again that I do not understand exactly how it works. It's only a suspicion, based on the fact that it's easy to forget that strcmp return false on match.
>How-To-Repeat:
Try doing some proxy stuff with arp
>Fix:
Either fix the test or add a comment confirming that it's not a bug, so readers like me won't report it again ;-)