[Xorp-users] Redistributing the system kernel route table into OSPF

Frank E. Renwick frenwick@cengen.com
Fri, 14 Apr 2006 17:05:27 -0700


Pavlin,

I have a couple of questions about the patch:

1) Should this work in a Windows 2003 build of XORP, or is the functionality
of fib2mrib tied to multicast support, and in turn presents a problem?

2)  In the patch you sent me, there are three lines that I believe should be
made into one line:

+    %create: xrl 
+"$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=fib2mrib&varia
+ble:txt=metric&type:txt=u32&access:txt=rw&id:u32=14";

I want to make sure it is accepatble to concatenate these three entries in a
single line.

Thanks,

frank





-----Original Message-----
From: xorp-users-admin@xorp.org [mailto:xorp-users-admin@xorp.org] On Behalf
Of Pavlin Radoslavov
Sent: Tuesday, April 11, 2006 10:36 AM
To: Frank E. Renwick
Cc: xorp-users@xorp.org
Subject: Re: [Xorp-users] Redistributing the system kernel route table into
OSPF 

> I am a new user to XORP and I am attempting to redistribute the system 
> kernel route table into XORP OSPF.  I see redistribution support for 
> connected and static routes, but not for the kernel route table, as is 
> available in Quagga.  In my case, the system kernel route table is 
> being written by another routing protocol (Optimized Link State 
> Routing) into which XORP has no visibility.  The "connected" and 
> "static" features are not sufficient to satisfy my objectives.

You won't be able to do this out-of-the-box, but there is a semi-hackish way
around it. The basic idea is to use the fib2mrib module in XORP.
That module typically is used to snoop the unicast routes from the kernel so
they can be used for multicast purpose (the Reverse Path Forwarding check in
PIM-SM). In your case you will redistribute them to OSPF.

1. Get the latest XORP code from the anonymous CVS, and make sure
   that file xrl/targets/fib2mrib_base.hh is ref. 1.12 (at least).
   The instructions for the anonymous CVS access are available from
   http://www.xorp.org/cvs.html

2. Apply the patch at the end of this email to the checked-out code.
   Basically, this patch adds the necessary hooks to the
   etc/templates/policy.tp and etc/templats/fib2mrib.tp so fib2mrib
   can be used as part of the policy framework.
   Also, it adds a hack to ospf/xrl_target.cc so OSPF will accept
   the routes that would come from fib2mrib. If you want to export
   the fib2mrib routes to some other protocol (BGP or RIP), then you
   may have to apply a similar hack to the particular protocol.

3. You can export the fib2mrib routes by using the following in your
   XORP configuration:

policy {
    policy-statement export_fib2mrib {
        term export {
            from {
                protocol: "fib2mrib"
            }
        }
    }
}

protocols {
    ospf4 {
        export: "export_fib2mrib"
	....
    }
}

protocols {
    fib2mrib {
        disable: false
    }
}

FYI, I tried the above mechanism, and it appears to work for me, but please
let me know if you run into some issues.

Pavlin

Index: etc/templates/fib2mrib.tp
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/etc/templates/fib2mrib.tp,v
retrieving revision 1.10
diff -u -p -r1.10 fib2mrib.tp
--- etc/templates/fib2mrib.tp	22 Feb 2006 02:26:10 -0000	1.10
+++ etc/templates/fib2mrib.tp	11 Apr 2006 17:10:58 -0000
@@ -8,11 +8,22 @@ protocols {
     }
 }
 
+policy {
+    policy-statement @: txt {
+	term @: txt {
+	    from {
+		metric: u32range;
+	    }
+	}
+    }
+}
+
 protocols {
     fib2mrib {
 	%help:		short		"Configure the FIB2MRIB module";
 	%modinfo:	provides	fib2mrib;
 	%modinfo:	depends		rib;
+	%modinfo:	depends		policy;
 	%modinfo:	path		"fib2mrib/xorp_fib2mrib";
 	%modinfo:	default_targetname "fib2mrib";
 	%modinfo:	status_method	xrl
"$(fib2mrib.targetname)/common/0.1/get_status->status:u32&reason:txt";
@@ -43,3 +54,21 @@ protocols {
 	}
     }
 }
+
+policy {
+    %create: xrl
"$(policy.targetname)/policy/0.1/set_proto_target?protocol:txt=fib2mrib&targ
et:txt=fib2mrib";
+    %create: xrl
"$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=fib2mrib&variable:t
xt=network4&type:txt=ipv4net&access:txt=r&id:u32=10";
+    %create: xrl 
+"$(policy.targetname)/policy/0.1/add_varmap?protocol:txt=fib2mrib&varia
+ble:txt=metric&type:txt=u32&access:txt=rw&id:u32=14";
+
+    policy-statement @: txt {
+	term @: txt {
+	    from {
+		metric {
+		    %help: short "Set the metric value";
+		    %set: xrl
"$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-state
ment.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=metric
$(<>) $(@);";
+		    %delete: xrl
"$(policy.targetname)/policy/0.1/update_term_block?policy:txt=$(policy-state
ment.@)&term:txt=$(term.@)&block:u32=0&order:txt=$(#)&statement:txt=";
+		}
+	    }
+	}
+    }
+}
Index: etc/templates/policy.tp
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/etc/templates/policy.tp,v
retrieving revision 1.20
diff -u -p -r1.20 policy.tp
--- etc/templates/policy.tp	3 Apr 2006 23:35:14 -0000	1.20
+++ etc/templates/policy.tp	11 Apr 2006 17:10:58 -0000
@@ -73,6 +73,7 @@ policy {
 		    %help: short "Protocol from which route was learned";
 		    %allow: $(@) "bgp" %help: "BGP routes";
 		    %allow: $(@) "connected" %help: "Directly connected
sub-network routes";
+		    %allow: $(@) "fib2mrib" %help: "FIB2MRIB routes";
 		    %allow: $(@) "ospf4" %help: "OSPF IPv4 routes";
 		    %allow: $(@) "rip" %help: "RIP routes";
 		    %allow: $(@) "ripng" %help: "RIPng routes";
Index: ospf/xrl_target.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/ospf/xrl_target.cc,v
retrieving revision 1.36
diff -u -p -r1.36 xrl_target.cc
--- ospf/xrl_target.cc	28 Mar 2006 03:06:55 -0000	1.36
+++ ospf/xrl_target.cc	11 Apr 2006 17:10:59 -0000
@@ -278,8 +278,10 @@ XrlOspfV2Target::policy_redist4_0_1_add_
 	      cstring(network), cstring(nexthop), pb(unicast),
pb(multicast),
 	      metric);
 
+#if 0
     if (!unicast)
 	return XrlCmdError::OKAY();
+#endif
 
     if (!_ospf.originate_route(network, nexthop, metric, policytags)) {
 	return XrlCmdError::COMMAND_FAILED("Network: " + network.str()); @@
-296,8 +298,10 @@ XrlOspfV2Target::policy_redist4_0_1_dele
     debug_msg("Net: %s Unicast: %s Multicast %s\n",
 	      cstring(network), pb(unicast), pb(multicast));
 
+#if 0
     if (!unicast)
 	return XrlCmdError::OKAY();
+#endif
 
     if (!_ospf.withdraw_route(network)) {
 	return XrlCmdError::COMMAND_FAILED("Network: " + network.str());

_______________________________________________
Xorp-users mailing list
Xorp-users@xorp.org
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-users