[Xorp-users] [Xorp-hackers] ospfv3 for IPv6 ospf - oddity

Eric S. Johnson esj at cs.fiu.edu
Tue May 1 07:47:07 PDT 2012


Answering myself. 

I kinda decided it is a bug. Everybody else doing V6 ospf seems
to send metrics with Intra-Area prefix LSA, and everybody else
seems to want to see them to give a cost to a link.

(everybody else == cisco and quagga :)

Here is a patch a worked up that seems to let xorp
"do the right thing". 

I left in the sending of /128 interface prefix along with 
the /64 network prefix becuase I have no "virtual links" nor 
experience with them. I kinda think that those /128's should be 
advertised ONLY on virtual links and certainly not on broadcast 
networks... But haven't worked that out yet.

Patch is against a git pull on 4-29-2012 but applies clean to 
1.8.5 also.

C++ is not my native language, and  I am not certain on some OSPF3 
things still, so I would appreciate some feedback.

Thoughts?

Anyone out there acutally trying to use xorp ospf6 besides me? :)

E






esj at cs.fiu.edu said:
> I started playing vith ospf for v6 recently. I have noticed an
> oddity. I am curious if I have something miss-configured  or I have
> found a bug.

> OSPFv3 for ipv6 has a couple new link-state adv types.  The one I am
> running into interoperability issues with is  the Intra-area prefix
> type. 

> It appears that xorp is sending these out with a cost of zero. No
> matter what the config file cost setting is. 

> This causes all the other ospf3 impelmentations it talks to (well,
> ok, cisco IOS and quagga are the only ones I have tested) to count
> the cost to that network as zero. 

> xorp sends the ole fashioned router lsa's with the appropriate
> costs.  But not the new fangled intra-area prefix costs.

> xorp also seems to send a /128 IA prefix LSA with the address of
> the interface also with metric of 0. This doesn't impact things as
> much as the network prefixs being 0, but seems odd too.

> I have verified with wireshark that it is sending the IA prefix
> lsa's with cost 0.

> Below are relavant snips of my configs.

> Xorp showing this behavior is 1.8.5 and git pulled on 2012-04-19
> Running on centos 5.6 (RHEL 5).  Linux test-router 2.6.18-164.6.1.el5
>  #1 SMP Tue Nov 3 16:18:27 EST 2009 i686 i686 i386 GNU/Linux

> Am I missing something? Or is this a bug?

> E 





diff -r -U5 /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/area_router.cc ./area_router.cc
--- /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/area_router.cc      2012-04-29 08:34:47.000000000 -0400
+++ ./area_router.cc    2012-04-29 09:01:10.000000000 -0400
@@ -3444,11 +3444,10 @@
                        if (prefix.get_nu_bit() /*|| prefix.get_la_bit()*/)
                            continue;
                        if (prefix.get_network().masked_addr().
                            is_linklocal_unicast())
                            continue;
-                       prefix.set_metric(0);
                        prefixes.push_back(prefix);
                    }
                }
            } else if (configured_virtual_link()) {
                uint32_t interface_id = pm.get_interface_id(i->first);
diff -r -U5 /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer.cc ./peer.cc
--- /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer.cc     2012-04-29 08:34:47.000000000 -0400
+++ ./peer.cc   2012-04-29 08:50:33.000000000 -0400
@@ -706,18 +706,18 @@
     return _areas[area]->get_attached_routers(routers);
 }
 
 template <typename A>
 bool
-PeerOut<A>::add_advertise_net(OspfTypes::AreaID area, A addr, uint32_t prefix)
+PeerOut<A>::add_advertise_net(OspfTypes::AreaID area, A addr, uint32_t prefix, uint16_t interface_cost)
 {
     if (0 == _areas.count(area)) {
        XLOG_ERROR("Unknown Area %s", pr_id(area).c_str());
        return false;
     }
 
-    return _areas[area]->add_advertise_net(addr, prefix);
+    return _areas[area]->add_advertise_net(addr, prefix, interface_cost);
 }
 
 template <typename A>
 bool
 PeerOut<A>::remove_all_nets(OspfTypes::AreaID area)
@@ -3220,37 +3220,39 @@
     return _hello_packet.get_interface_id();
 }
 
 template <>
 bool
-Peer<IPv4>::add_advertise_net(IPv4 /*addr*/, uint32_t /*prefix_length*/)
+Peer<IPv4>::add_advertise_net(IPv4 /*addr*/, uint32_t /*prefix_length*/, uint16_t /*cost*/ )
 {
     XLOG_FATAL("Only IPv6 not IPv4");
 
     return true;
 }
 
 template <>
 bool
-Peer<IPv6>::add_advertise_net(IPv6 addr, uint32_t prefix_length)
+Peer<IPv6>::add_advertise_net(IPv6 addr, uint32_t prefix_length, uint16_t interface_cost)
 {
     XLOG_ASSERT(OspfTypes::VirtualLink != get_linktype());
 
     LinkLsa *llsa = dynamic_cast<LinkLsa *>(_link_lsa.get());
     XLOG_ASSERT(llsa);
 
     if (addr.is_linklocal_unicast())
        return false;
 
-    IPv6Prefix prefix(_ospf.get_version());
+    IPv6Prefix prefix(_ospf.get_version(), true);
     prefix.set_network(IPNet<IPv6>(addr, prefix_length));
+    prefix.set_metric(interface_cost);
     llsa->get_prefixes().push_back(prefix);
 
     // Add a host route that can be used if necessary to advertise a
     // virtual link endpoint.
-    IPv6Prefix host_prefix(_ospf.get_version());
+    IPv6Prefix host_prefix(_ospf.get_version(), true);
     host_prefix.set_network(IPNet<IPv6>(addr, IPv6::ADDR_BITLEN));
+    host_prefix.set_metric(interface_cost);
     host_prefix.set_la_bit(true);
     llsa->get_prefixes().push_back(host_prefix);
 
     return true;
 }
diff -r -U5 /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer.hh ./peer.hh
--- /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer.hh     2012-04-29 08:34:47.000000000 -0400
+++ ./peer.hh   2012-04-29 08:43:09.000000000 -0400
@@ -327,11 +327,11 @@
                              list<RouterInfo>& routes);
 
     /**
      * Set a network to advertise OSPFv3 only.
      */
-    bool add_advertise_net(OspfTypes::AreaID area, A addr, uint32_t prefix);
+    bool add_advertise_net(OspfTypes::AreaID area, A addr, uint32_t prefix, uint16_t interface_cost);
 
     /**
      * Remove all the networks that are being advertised OSPFv3 only.
      */
     bool remove_all_nets(OspfTypes::AreaID area);
@@ -1110,11 +1110,11 @@
     uint32_t get_interface_id() const;
 
     /**
      * Set a network to advertise OSPFv3 only.
      */
-    bool add_advertise_net(A addr, uint32_t prefix);
+    bool add_advertise_net(A addr, uint32_t prefix, uint16_t interface_cost);
 
     /**
      * Remove all the networks that are being advertised OSPFv3 only.
      */
     bool remove_all_nets();
diff -r -U5 /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer_manager.cc ./peer_manager.cc
--- /opt/router/src/xorp.ct.20120429.orig/xorp/ospf/peer_manager.cc     2012-04-29 08:34:47.000000000 -0400
+++ ./peer_manager.cc   2012-04-29 08:57:46.000000000 -0400
@@ -704,10 +704,11 @@
        XLOG_ERROR("Unknown PeerID %u", peerid);
        return false;
     }
 
     set<AddressInfo<A> >& info = _peers[peerid]->get_address_info(area);
+    uint16_t interface_cost = _peers[peerid]->get_interface_cost() ;
     
     // Unconditionally remove all the global addresses that are being
     // advertised.
     _peers[peerid]->remove_all_nets(area);
 
@@ -739,21 +740,21 @@
                                         interface_prefix_length)) {
                XLOG_ERROR("Unable to get prefix length for %s", cstring(*i));
                continue;
            }
            if (!_peers[peerid]->add_advertise_net(area, (*i),
-                                                  interface_prefix_length)) {
+                                                  interface_prefix_length,interface_cost)) {
                XLOG_WARNING("Unable to advertise %s in Link-LSA\n",
                             cstring(*i));
            }
        }
     } else {
        typename set<AddressInfo<A> >::iterator i;
        for (i = info.begin(); i != info.end(); i++) {
            if ((*i)._enabled) {
                if (!_peers[peerid]->add_advertise_net(area, (*i)._address,
-                                                     (*i)._prefix)) {
+                                                     (*i)._prefix,interface_cost)) {
                    XLOG_WARNING("Unable to advertise %s in Link-LSA\n",
                                 cstring((*i)._address));
                }
            }
        }







More information about the Xorp-users mailing list