From nobody@FreeBSD.ORG  Tue Nov 14 08:57:52 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 167D037B4D7; Tue, 14 Nov 2000 08:57:52 -0800 (PST)
Message-Id: <20001114165752.167D037B4D7@hub.freebsd.org>
Date: Tue, 14 Nov 2000 08:57:52 -0800 (PST)
From: masato-k@is.aist-nara.ac.jp
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: Routed does not reflect preference of Internet Router Discovery Protocol.
X-Send-Pr-Version: www-1.0

>Number:         22846
>Category:       bin
>Synopsis:       Routed does not reflect preference of Internet Router Discovery Protocol.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bms
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 14 09:00:01 PST 2000
>Closed-Date:    Mon Aug 07 14:11:13 GMT 2006
>Last-Modified:  Mon Aug 07 14:11:13 GMT 2006
>Originator:     KAKIUCHI Masatoshi
>Release:        4.1-RELEASE
>Organization:
Nara Institute of Science and Technology
>Environment:
FreeBSD saudec02.aist-nara.ac.jp 4.1-RELEASE FreeBSD 4.1-RELEASE #0: Tue Aug  1 00:24:45 JST 2000     masato-k@saudec02.aist-nara.ac.jp:/usr/src/sys/compile/SAUDEC02  i386
>Description:
Routed does not reflect preference of Internet Router Discovery Protocol.
Solicit: 0 and positive number preference are treated as 1.
Advertise: 0 and positive number preference are treated as -2,147,483,647.

src/sbin/routed/rdisc.c,v 1.3 or later, PREF macro cast dr_recv_pref to int.
But dr_recv_pref is biased unsigned value.
As a result, 0 and positive number preference on network become minus value.

>How-To-Repeat:
There are two router running GateD, preference is 0 and 16.
Connect a host running routed with `-P no_rip', it selects first response for default route.
Routed does not prefer that large preference.

>Fix:
I seem the following patch is proper.
This is diff from src/sbin/routed/rdisc.c,v 1.5

begin 644 routed.diff
M9&EF9B`M8W(@<F]U=&5D+F]R9R]R9&ES8RYC(')O=71E9"]R9&ES8RYC"BHJ
M*B!R;W5T960N;W)G+W)D:7-C+F,)36]N(%-E<"`@-B`P,CHT.3HQ,2`Q.3DY
M"BTM+2!R;W5T960O<F1I<V,N8PE7960@3F]V(#$U(#`Q.C,Q.C(X(#(P,#`*
M*BHJ*BHJ*BHJ*BHJ*BHJ"BHJ*B`Y-RPQ,#,@*BHJ*@H@("-D969I;F4@54Y3
M24=.7U!2148H<"D@4TE'3E]04D5&*'`I"B`@+RH@861J=7-T('5N<VEG;F5D
M('!R969E<F5N8V4@8GD@:6YT97)F86-E(&UE=')I8RP*("`@*B!W:71H;W5T
M(&1R:79I;F<@:70@=&\@:6YF:6YI='D@*B\*(2`C9&5F:6YE(%!2148H<"P@
M:69P*2`H*&EN="DH<"D@/#T@*&EF<"DM/FEN=%]M971R:6,@/R`H*'`I("$]
M(#`@/R`Q(#H@,"D@7`H@(`D)("`@("`@.B`H<"D@+2`H*&EF<"DM/FEN=%]M
M971R:6,I*0H@(`H@('-T871I8R!V;VED(')D:7-C7W-O<G0H=F]I9"D["BTM
M+2`Y-RPQ,#,@+2TM+0H@("-D969I;F4@54Y324=.7U!2148H<"D@4TE'3E]0
M4D5&*'`I"B`@+RH@861J=7-T('5N<VEG;F5D('!R969E<F5N8V4@8GD@:6YT
M97)F86-E(&UE=')I8RP*("`@*B!W:71H;W5T(&1R:79I;F<@:70@=&\@:6YF
M:6YI='D@*B\*(2`C9&5F:6YE(%!2148H<"P@:69P*2`H*'`I(#P]("AI9G`I
M+3YI;G1?;65T<FEC(#\@*"AP*2`A/2`P(#\@,2`Z(#`I(%P*("`)"2`@("`@
M(#H@*'`I("T@*"AI9G`I+3YI;G1?;65T<FEC*2D*("`*("!S=&%T:6,@=F]I
49"!R9&ES8U]S;W)T*'9O:60I.PI?
`
end


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: bms 
Responsible-Changed-When: Tue 25 Nov 2003 09:09:27 PST 
Responsible-Changed-Why:  
This probably wants wider discussion on -net 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 
Responsible-Changed-From-To: freebsd-net->andre 
Responsible-Changed-By: andre 
Responsible-Changed-When: Tue Dec 30 01:59:14 PST 2003 
Responsible-Changed-Why:  
Take over. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 
State-Changed-From-To: open->feedback 
State-Changed-By: andre 
State-Changed-When: Thu Jan 15 05:04:44 PST 2004 
State-Changed-Why:  
From my looking at the fix it seems to be correct and the bug is 
still present in our routed and the newest version (2.27) I've 
found in NetBSD.  I've asked christos@netbsd for the email address 
of the routed maintainer to discuss the bug and fix with him. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 
State-Changed-From-To: feedback->analyzed 
State-Changed-By: andre 
State-Changed-When: Thu Jan 15 05:41:57 PST 2004 
State-Changed-Why:  
My reading of the code confirms the bug.  I've got the maintainer 
information from christos and have contacted maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 

From: Andre Oppermann <andre@freebsd.org>
To: freebsd-gnats-submit@FreeBSD.org, masato-k@is.aist-nara.ac.jp
Cc:  
Subject: Re: bin/22846: Routed does not reflect preference of Internet Router
 Discovery Protocol.
Date: Thu, 15 Jan 2004 23:31:28 +0100

 Maintainer of routed has responded that this is not a bug
 but the way things are supposed to work.  However he notes
 that we don't have the most up to date version of routed
 in our tree and are missing some important other bug fixes.
 
 I'll prepare the import of routed 1.27 soon.
 
 -- 
 Andre
 
Responsible-Changed-From-To: andre->bms 
Responsible-Changed-By: bms 
Responsible-Changed-When: Tue Jun 22 21:38:28 GMT 2004 
Responsible-Changed-Why:  
I'll take this as I did the import last. 
Fix is pending import of next routed release. 
Diff from our off-branch table.c sent to maintainers to minimize diffs 
when that happens. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 
State-Changed-From-To: analyzed->closed 
State-Changed-By: bms 
State-Changed-When: Mon Aug 7 14:10:52 UTC 2006 
State-Changed-Why:  
No response from submitter, and patched version of routed 
has been in the tree for several releases 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22846 
>Unformatted:
