Author: adrian.chadd
Date: Tue Feb 24 08:43:14 2009
New Revision: 13862

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

Log:
Add a function to mark a route as "historical".



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:43:14 2009
@@ -79,6 +79,28 @@
        return a->origin_as;
  }

+int
+bgp_rib_mark_historical(bgp_rib_head_t *head, struct in_addr addr, int  
masklen)
+{
+       prefix_t * p;
+       radix_node_t *n;
+       bgp_rib_aspath_t *a;
+
+       p = New_Prefix(AF_INET, &addr, masklen, NULL);
+
+       n = radix_search_best(head->rh, p);
+       if (n == NULL) {
+               debug(85, 3) ("bgp_rib_mark_historical: %s/%d: no match\n",  
inet_ntoa(addr), masklen);
+               Deref_Prefix(p);
+               return -1;
+       }
+       debug(85, 3) ("bgp_rib_mark_historical: %s/%d: match; AS %d\n",  
inet_ntoa(addr), masklen, bgp_rib_getasn(n->data));
+       Deref_Prefix(p);
+       a = n->data;
+       a->flags.hist = 1;
+       return 1;
+}
+
  /* initialize the radix tree structure */

  extern int squid_max_keylen;  /* yuck.. this is in lib/radix.c */

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:43:14 2009
@@ -11,6 +11,9 @@
  struct _bgp_rib_aspath {
        u_short origin_as;
        u_short rib_genid;
+       struct {
+               u_short hist;                   /* Is this route entry 
"historical" for the current  
generation? */
+       } flags;
  };
  typedef struct _bgp_rib_aspath bgp_rib_aspath_t;

@@ -18,6 +21,7 @@
  extern int bgp_rib_match_net(bgp_rib_head_t *head, struct in_addr addr,  
int masklen);
  extern int bgp_rib_add_net(bgp_rib_head_t *head, struct in_addr addr, int  
masklen, u_short origin_as);
  extern int bgp_rib_del_net(bgp_rib_head_t *head, struct in_addr addr, int  
masklen);
+extern int bgp_rib_mark_historical(bgp_rib_head_t *head, struct in_addr  
addr, int masklen);
  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);

--~--~---------~--~----~------------~-------~--~----~
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