Subject: bin/8003: routed not processing variable subnets correctly via rip_v2
To: None <gnats-bugs@gnats.netbsd.org, system@nagler-consult.com>
From: Frank Kardel <kardel@janus.nagler-consult.com>
List: netbsd-bugs
Date: 07/15/1999 06:30:56
>Number:         8003
>Category:       bin
>Synopsis:       routed not processing variable subnets correctly via rip_v2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 15 06:05:00 1999
>Last-Modified:
>Originator:     Frank Kardel
>Organization:
	Dr. Nagler & Cie. Consult GmbH
>Release:        1.4 ALPHA 99-04-18 and current-99-07-12
>Environment:
System: NetBSD janus 1.4_ALPHA NetBSD 1.4_ALPHA (PIP) #3: Sun Apr 18 10:19:27 MEST 1999 kardel@pip:/usr/src.133K/sys/arch/i386/compile/PIP i386


>Description:
	when using rip_v2 in a variably subnetted environment routed fails
	to propagate certain subnet routes. Thus routing fails if NetBSD
	is the central router.

>How-To-Repeat:
	Setup:
		if 0: ip 200.200.200.0   netmask 200.200.200.192 serving network 0
		if 1: ip 200.200.200.192 netmask 200.200.200.192 serving network 1

	 	in network 1 additionally
			a cisco router having a link to the network 3 ip 200.200.200.128 netmask 200.200.200.224

		in network 0 additionally
			a cisco router having a link to the ISP and thus seeding the
				0.0.0.0/0 default route

		all routers use RIP V2 to exchange routing information.

		routed on the netbsd machine will happily announce its local interfaces and the
		default route to the external cisco as routes. All information about the network 3
		is not supplied except for a short period after startup. Kernel routes entered at
		startup will be removed after 3 minutes. The network route to network 3 is
		invisible afterwards.
		
>Fix:
	Analysis shows that routed still has the information in its raw routing table that is
	fed by external announcements. The routing information is lost during the aggregation
	process. The aggregation code in ag_flush() (output.c) infers that the route to network
	3 on the router on network 1 is suppressed by the default route. This wrong suppression
	stems from a bug in output.c where the gateway to the router is not passed to ag_check()
	in walk_supply(). Instead the 0.0.0.0 address is passed. Subsequent aggregation must now
	infer that the default route shadows the network 3 route. Thus the fix is to supply
	the original gateway address. This then leads to the survival of the subnet route and to
	a working variably subnettet network. (pls vrfy above reasoning - our network works though 8-)

	Patch for routed/output.c:
*** output.c    Tue Jul 13 15:04:31 1999
--- output.c.bad        Thu Jul 15 14:55:04 1999
***************
*** 658,664 ****
                metric = HOPCNT_INFINITY;
        }

!       ag_check(dst, RT->rt_mask, RT->rt_gate, nhop, metric, pref,
                 RT->rt_seqno, RT->rt_tag, ags, supply_out);
        return 0;
  #undef RT
--- 658,664 ----
                metric = HOPCNT_INFINITY;
        }

!       ag_check(dst, RT->rt_mask, 0, nhop, metric, pref,
                 RT->rt_seqno, RT->rt_tag, ags, supply_out);
        return 0;
  #undef RT

>Audit-Trail:
>Unformatted: