Joakim Tjernlund | 2 Aug 2012 23:08
Picon

[quagga-dev 9618] [PATCH] ospfd: Fix new nexthop calculation for PtP over LAN.

RFC 5309 adds the possibility to use LANs as PtP links. The new nexthop
code to support unnumbered PtP links broke such links as such links
need a nexthop address.
This restores the PtP LAN functionality to the point it was before
the unnumbered changes.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund <at> transmode.se>
---

OK, so I had to finish this so here goes.

 ospfd/ospf_spf.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 706ca67..ffac985 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
 <at>  <at>  -555,8 +555,25  <at>  <at>  ospf_nexthop_calculation (struct ospf_area *area, struct vertex *v,
               */
 	      if (oi->type == OSPF_IFTYPE_POINTOPOINT)
 		{
+		  struct prefix_ipv4 la;
+
 		  added = 1;
 		  nexthop.s_addr = 0; /* Nexthop not required */
+		  /* As some PtP links(ethernet used as PtP) really needs
+		     a nexthop address, try find one */
+		  la.family = AF_INET;
+		  la.prefixlen = IPV4_MAX_PREFIXLEN;
+		  while ((l2 = ospf_get_next_link(w, v, l2)))
+		    {
+		      la.prefix = l2->link_data;
+		      /* check that IP lies within the peer subnet */
+		      if (!prefix_match(CONNECTED_PREFIX(oi->connected),
+				       (struct prefix *)&la))
+			continue;
+
+		      nexthop = l2->link_data;
+		      break;
+		    }
 		}
 	      else if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT)
 		{
--

-- 
1.7.3.4


Gmane