Subject: pkg/18631: Zebra missing important point-to-multipoint patch
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dyoung@netbsd.org>
List: netbsd-bugs
Date: 10/12/2002 14:36:36
>Number:         18631
>Category:       pkg
>Synopsis:       Zebra 0.93b missing important point-to-multipoint patch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 12 14:37:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     dyoung@ojctech.com
>Release:        NetBSD 1.6I
>Organization:
     OJC Technologies
>Environment:
NetBSD anoncuw 1.6I NetBSD 1.6I (NET4501) #0: Sat Oct  5 03:00:26 CDT 2002     6
Architecture: i386
Machine: i386
>Description:
  Point-to-multipoint mode is missing from Zebra, in spite of a
  patch (enclosed) being available since June.

  Apparently, patches are NOT making it into Zebra. There is no process
  in place, or the process is slow or broken. Consequently, important
  patches such as this are missing. See discussions on the Zebra mailing
  list for more information.

>How-To-Repeat:
  Try to run an interface in point-to-multipoint mode. You will fail.
  Then, read the source: everywhere point-to-multipoint is supposed to
  be implemented, comments tell that it is not.
>Fix:
  Apply the patch (below), from Roger Venning. But read his caveat:

From r.venning@telstra.com  Tue Jun 18 08:26:44 2002
	by che.onthejob.net (8.9.3/8.9.3) with ESMTP id IAA02627
	for <dyoung@onthejob.net>; Tue, 18 Jun 2002 08:26:43 -0500
	by cali-3.pobox.com (Postfix) with ESMTP id 280823E65F
	for <dyoung@pobox.com>; Tue, 18 Jun 2002 09:26:40 -0400 (EDT)
	by bbs.izone.net.au (8.11.2/8.11.2) with ESMTP id g5IDEAZ17954
	for <dyoung@pobox.com>; Tue, 18 Jun 2002 23:14:11 +1000
Message-ID: <3D0F392E.2090503@telstra.com>
Date: Tue, 18 Jun 2002 23:44:14 +1000
From: Roger Venning <r.venning@telstra.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9+) Gecko/20020411
MIME-Version: 1.0
To: dyoung@pobox.com
Subject: Re: [zebra 14164] point-to-multipoint networks?
References: <20020618044747.A15160@che.onthejob.net>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Content-Length: 1388
Lines: 42


David,

I have made modifications over the last month or so to get Zebra running 
in point-to-multipoint mode. There are still some things that are 
incorrect (neighbour establishment over broadcast networks may have been 
impacted; the next hop resolution during shortest path first calculation 
is wrong but kind of works). You can get the partly working (but a hell 
of a lot more working than the totally 
non-operational-other-than-configurable support in zebra 0.92a) software 
in a mini-tarball from http://users.bigpond.com/r.venning/wireless/ospfd.tgz

I've got to find time to do a little bit more and have it patchable 
against a CSV version before the end of the week, but some things are 
conspiring to give me 12 hour days at work at the moment and this is 
meant to be in my 'free' time - looking at using it for meshed routing 
in 802.11b ad-hoc mode networks.

Roger.

David Young wrote:

>Release-Note:
>Audit-Trail:
>Unformatted:
 >Does Zebra 0.92a support OSPF point-to-multipoint networks in NetBSD
 >1.5 without patches? Does the version in CVS?
 >
 >If Zebra does not support PtMP networks, what in particular do I need
 >to add so that it does?
 >
 >Dave
 >
 >  
 >
 
 
 -- 
 -------------------------------------------------------------
 Roger Venning	\ Do not go gentle into that good night
 Melbourne        \ Rage, rage against the dying of the light.
 Australia <r.venning@telstra.com>                 Dylan Thomas
 
 
 ************* BEGIN PATCH ***************
 *****************************************
 
 diff -c -r zz/zebra-0.93b/ospfd/ospf_lsa.c zebra-0.93b/ospfd/ospf_lsa.c
 *** zz/zebra-0.93b/ospfd/ospf_lsa.c	Thu Jul  4 00:06:41 2002
 --- zebra-0.93b/ospfd/ospf_lsa.c	Sat Oct 12 16:07:17 2002
 ***************
 *** 589,594 ****
 --- 589,633 ----
   
   #define lsa_link_nbma_set(S,O)  lsa_link_broadcast_set (S, O)
   
 + /* this function add for support point-to-multipoint ,see rfc2328 
 + 12.4.1.4.*/
 + /* from "edward rrr" <edward_rrr@hotmail.com>
 +    http://marc.theaimsgroup.com/?l=zebra&m=100739222210507&w=2 */
 + int lsa_link_ptomultip_set (struct stream *s, struct ospf_interface *oi)
 + {
 +   int links = 0;
 +   struct route_node *rn;
 +   struct ospf_neighbor *nbr = NULL;
 +   struct in_addr id, mask;
 + 
 +   mask.s_addr = 0xffffffff;
 +   id.s_addr = oi->address->u.prefix4.s_addr;
 +   link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0, 0);
 +   links++;
 + 
 +   zlog_info ("PointToMultipoint: running ptomultip_set");
 + 
 +   /* Search neighbor, */
 +   for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
 +     if ((nbr = rn->info) != NULL)
 +       /* Ignore myself. */
 +       if (!IPV4_ADDR_SAME (&nbr->router_id, &ospf_top->router_id))
 + 	if (nbr->state == NSM_Full)
 + 
 +     {
 + 
 + 	link_info_set (s, nbr->router_id, oi->address->u.prefix4,
 + 		       LSA_LINK_TYPE_POINTOPOINT, 0, oi->output_cost);
 + 	links++;
 +         zlog_info ("PointToMultipoint: set link to %s",
 + 				inet_ntoa(oi->address->u.prefix4));
 +     }
 + 
 + 
 +    return links;
 + 
 + }
 + 
   /* Set router-LSA link information. */
   int
   router_lsa_link_set (struct stream *s, struct ospf_area *area)
 ***************
 *** 619,625 ****
   		  links += lsa_link_nbma_set (s, oi);
   		  break;
   		case OSPF_IFTYPE_POINTOMULTIPOINT:
 ! 		  /* Not supproted yet. */
   		  break;
   		case OSPF_IFTYPE_VIRTUALLINK:
   		  links += lsa_link_virtuallink_set (s, oi);
 --- 658,664 ----
   		  links += lsa_link_nbma_set (s, oi);
   		  break;
   		case OSPF_IFTYPE_POINTOMULTIPOINT:
 ! 		  links += lsa_link_ptomultip_set (s, oi);
   		  break;
   		case OSPF_IFTYPE_VIRTUALLINK:
   		  links += lsa_link_virtuallink_set (s, oi);
 diff -c -r zz/zebra-0.93b/ospfd/ospf_packet.c zebra-0.93b/ospfd/ospf_packet.c
 *** zz/zebra-0.93b/ospfd/ospf_packet.c	Thu Jul  4 00:06:41 2002
 --- zebra-0.93b/ospfd/ospf_packet.c	Sat Oct 12 16:07:17 2002
 ***************
 *** 3108,3113 ****
 --- 3108,3115 ----
     else if ((oi->type == OSPF_IFTYPE_POINTOPOINT) 
   	   && (flag == OSPF_SEND_PACKET_INDIRECT))
        p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
 +   else if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT)
 +      p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
     else
        p.prefix.s_addr = htonl (OSPF_ALLDROUTERS);
   
 diff -c -r zz/zebra-0.93b/ospfd/ospf_spf.c zebra-0.93b/ospfd/ospf_spf.c
 *** zz/zebra-0.93b/ospfd/ospf_spf.c	Fri Jun 28 08:56:35 2002
 --- zebra-0.93b/ospfd/ospf_spf.c	Sat Oct 12 16:09:18 2002
 ***************
 *** 365,391 ****
   	      
   	      if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT)
   		{
 ! 		  while ((l2 = ospf_get_next_link (w, v, l2)))
 ! 		    {
 ! 		      oi = ospf_if_is_configured (&(l2->link_data));
 ! 		      
 ! 		      if (oi == NULL)
 ! 			continue;
 ! 		      
 ! 		      if (! IPV4_ADDR_SAME (&oi->address->u.prefix4,
 ! 					    &l->link_data))
 ! 			continue;
 ! 		      
 ! 		      break;
 ! 		    }
 ! 		  
 ! 		  if (oi && l2)
 ! 		    {
 ! 		      nh = vertex_nexthop_new (v);
 ! 		      nh->oi = oi;
 ! 		      nh->router = l2->link_data;
 ! 		      listnode_add (w->nexthop, nh);
 ! 		    }
   		}
   	    }
   	}
 --- 365,407 ----
   	      
   	      if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT)
   		{
 ! 		  zlog_info("Have a POINTOPOINT LSA link");
 ! 		  /* is w connected to v via point-to-multipoint network? If it is
 ! 		     then there will be a link of w that has v->link_id as the link_id with the
 ! 		     next hop address we need being found in link_data */
 ! 		  zlog_info("PtMP: Checking to see if %s(link_data) is configured on an interface",
 ! 			    inet_ntoa(l->link_data));
 ! 		  zlog_info("PtMP: (%s is link_id)", inet_ntoa(l->link_id));
 ! 		  oi = ospf_if_is_configured(&l->link_data);
 ! 		  if (oi && oi->type == OSPF_IFTYPE_POINTOMULTIPOINT) {
 ! 		    /* yes, they have us, and we are in point-to-multipoint mode */
 ! 		    zlog_info("Setting PtoMP next hop(1)");
 ! 		    nh = vertex_nexthop_new (v);
 ! 		    nh->oi = oi;
 ! 		    nh->router = l->link_id;
 ! 		    listnode_add (w->nexthop, nh);
 ! 		  } else {                                
 ! 		    while ((l2 = ospf_get_next_link (w, v, l2)))
 ! 		      {
 ! 			oi = ospf_if_is_configured (&(l2->link_data));
 ! 			
 ! 			if (oi == NULL)
 ! 			  continue;
 ! 			
 ! 			if (!IPV4_ADDR_SAME (&oi->address->u.prefix4, &l->link_data))
 ! 			  continue;
 ! 			
 ! 			break;
 ! 		      }
 ! 		    
 ! 		    if (oi)
 ! 		      {
 ! 			nh = vertex_nexthop_new (v);
 ! 			nh->oi = oi;
 ! 			nh->router = l2->link_data;
 ! 			listnode_add (w->nexthop, nh);
 ! 		      }
 ! 		  }
   		}
   	    }
   	}
 
 ************* END PATCH *****************
 *****************************************