Author: adrian.chadd
Date: Tue Feb 24 08:40:41 2009
New Revision: 13861

Modified:
    playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_core.h
    playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c
    playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.h

Log:
Include the RIB generation ID stuff in the rib structs.



Modified: playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_core.h
==============================================================================
--- playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_core.h  (original)
+++ playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_core.h  Tue Feb 24 08:40:41 2009
@@ -42,8 +42,6 @@
                int clear_rib_on_withdraw;
        } cfg;

-       int rib_genid;                  /* A sequence number which is 
incremented each time a  
new BGP connection is established */
-
        /* The AS path table */

        /* The RIB */

Modified: playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c
==============================================================================
--- playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c   (original)
+++ playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c   Tue Feb 24 08:40:41 2009
@@ -52,6 +52,7 @@
        }
        debug(85, 3) ("bgp_rib_match_host: %s: match; AS %d\n", 
inet_ntoa(addr),  
bgp_rib_getasn(n->data));
        Deref_Prefix(p);
+       /* XXX this is where we'd do a "fresh or stale" return check */
        a = n->data;
        return a->origin_as;
  }
@@ -94,7 +95,6 @@
  {
        debug(85, 1) ("bgp_rib_destroy: %p: called\n", head);
        bzero(head, sizeof(*head));
-       
  }

  void
@@ -105,8 +105,16 @@
        Destroy_Radix(head->rh, bgp_rib_asn_free, NULL);
        head->rh = New_Radix();
        head->num_prefixes = 0;
+       bgp_rib_bump_genid(head);
  }

+void
+bgp_rib_bump_genid(bgp_rib_head_t *head)
+{
+       head->rib_genid++;
+}
+
+
  static void
  bgp_rib_clear_node(bgp_rib_head_t *head, radix_node_t *n)
  {
@@ -136,6 +144,7 @@
        Deref_Prefix(p);
        a = xcalloc(1, sizeof(bgp_rib_aspath_t));
        a->origin_as = origin_as;
+       a->rib_genid = head->rib_genid;
        n->data = a;
        head->num_prefixes++;
        return 1;

Modified: playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.h
==============================================================================
--- playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.h   (original)
+++ playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.h   Tue Feb 24 08:40:41 2009
@@ -4,11 +4,13 @@
  struct _bgp_rib_head {
        radix_tree_t    *rh;
        int num_prefixes;
+        u_short rib_genid;             /* A sequence number which is 
incremented each  
time a new BGP connection is established */
  };
  typedef struct _bgp_rib_head bgp_rib_head_t;

  struct _bgp_rib_aspath {
        u_short origin_as;
+       u_short rib_genid;
  };
  typedef struct _bgp_rib_aspath bgp_rib_aspath_t;

@@ -19,5 +21,6 @@
  extern void bgp_rib_init(bgp_rib_head_t *head);
  extern void bgp_rib_destroy(bgp_rib_head_t *head);
  extern void bgp_rib_clean(bgp_rib_head_t *head);
+extern void bgp_rib_bump_genid(bgp_rib_head_t *head);

  #endif

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to