Subject: kern/31051: can't find the device from Macintosh through AppleTalk(Netatalk) in the network including a seed router
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <Kousaku.Nakahara@rsi.ricoh.co.jp>
List: netbsd-bugs
Date: 08/24/2005 01:40:00
>Number:         31051
>Category:       kern
>Synopsis:       can't find the device from Macintosh through AppleTalk(Netatalk) in the network including a seed router
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 24 01:40:00 +0000 2005
>Originator:     Kousaku Nakahara
>Release:        1.5.2
>Organization:
Ricoh Software Inc.
>Environment:
>Description:
About at_ifawithnet() in /src/sys/netatalk/aarp.c, there is the following code.
if ((nr->nr_phase == 2)
    && (nr->nr_firstnet <= sat->sat_addr.s_net)
    && (nr->nr_lastnet >= sat->sat_addr.s_net))
	break;
"nr->nr_firstnet", "sat->sat_addr.s_net", "nr->nr_lastnet" and "sat->sat_addr.s_net" are the value of network-byte-order and 2 bytes. If it works in x86 architecture (little endian), there are cases we can't judge correctly.

In this part, we check the Network-number of destination(client) whether it is in the range that is orderd from seed router or not.
>How-To-Repeat:
One of the example as follows.
We set the range of Network-number from 0x0110 to 0x0200 at the seed router.
>Fix:
About at_ifawithnet() in /src/sys/netatalk/aarp.c, we must modify as follows.
if ((nr->nr_phase == 2)
    && (ntohs(nr->nr_firstnet) <= ntohs(sat->sat_addr.s_net))
    && (ntohs(nr->nr_lastnet) >= ntohs(sat->sat_addr.s_net)))
	break;

Original current Netatalk has been modified already.