INFOCOM
DEPARTMENT

 


 

OPTIMIZATION IN THE SHORTEST PATH FIRST COMPUTATION

FOR THE QUAGGA SOFTWARE ROUTING
 V. Eramo, M. Listanti, G. Gasparro, A. Cianfrani
University of Roma “La Sapienza”, INFOCOM Dept.
Via Eudossiana, 18 – 00184 Roma, Italy
Tel: +39 6 44585458; Fax: +39 6 4744481
E-mail: eramo@infocom.uniroma1.it

 


 

/* Lookup a node with a prefix with given length, and

the first bits matching our prefix p.

Multiple matchings are not supported.*/

struct route_node *

route_node_lookup_partial (struct route_table *table, struct prefix *p, u_char length)

{

  struct route_node *node;

  node = table->top;

 

  if (p->prefixlen > length ) return NULL;

 

  while ((  node

         && node->p.prefixlen <= length )

             && (  /* in prefix_match the former prefix must be shorter than the latter */

                   ( node->p.prefixlen <= p->prefixlen && prefix_match (&node->p, p) )

                || ( node->p.prefixlen > p->prefixlen && prefix_match (p, &node->p) )

                )

             )

    {

      if (node->p.prefixlen == length && node->info)

        {

            return route_lock_node (node);

            }

      if (node->p.prefixlen < p->prefixlen)

 

          node = node->link[check_bit(&p->u.prefix, node->p.prefixlen)];

 

      else if (node->p.prefixlen >= p->prefixlen)

           { /* here we've found a node with the first bits matching our prefix, but

                the node has NULL info, or has a too short preefix.

                        That mean that there are multiple matching...

                        If we are looking into the Network Database, this shouldn't happen!

                        However go on searching, taking the first non-NULL link, and good luck */

                 if ( (node = node->link[0]) == NULL ) node = node->link[1];

               }

    }

  return NULL;

}

Figure 9.”route_node_lookup-partial()” function in patchquagga 0.97.3

 

       
Via Cavour 256, 00184, Roma (Italy) - Phone: +39 0647852300  Fax: +39 064744481

 

 

BACK