Author: adrian.chadd
Date: Sun Feb 22 20:46:36 2009
New Revision: 13841

Modified:
    playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c

Log:
Add debugging; and include checks to see whether entries exist/don't exist  
before they're added/removed.A



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   Sun Feb 22 20:46:36 2009
@@ -32,9 +32,11 @@

        n = radix_search_best(head->rh, p);
        if (n == NULL) {
+               debug(85, 1) ("bgp_rib_match_net: %s/%d: no match\n", 
inet_ntoa(addr),  
masklen);
                Deref_Prefix(p);
                return 0;
        }
+       debug(85, 1) ("bgp_rib_match_net: %s/%d: match\n", inet_ntoa(addr),  
masklen);
        Deref_Prefix(p);
        return 1;
  }
@@ -68,7 +70,15 @@
        prefix_t * p;
        radix_node_t *n;

+       debug(85, 1) ("bgp_rib_add_net: %s/%d\n", inet_ntoa(addr), masklen);
        p = New_Prefix(AF_INET, &addr, masklen, NULL);
+       n = radix_search_exact(head->rh, p);
+       if (n != NULL) {
+               debug(85, 1) ("bgp_rib_add_net: %s/%d: FOUND?!\n", 
inet_ntoa(addr),  
masklen);
+               Deref_Prefix(p);
+               return 0;
+       }
+
        n = radix_lookup(head->rh, p);
        /* XXX should verify? */
        /* XXX should add some path data, etc? */
@@ -82,10 +92,13 @@
        prefix_t * p;
        radix_node_t *n;

+       debug(85, 1) ("bgp_rib_del_net: %s/%d\n", inet_ntoa(addr), masklen);
+
        p = New_Prefix(AF_INET, &addr, masklen, NULL);

        n = radix_search_exact(head->rh, p);
        if (n == NULL) {
+               debug(85, 1) ("bgp_rib_del_net: %s/%d: NOT FOUND?!\n", 
inet_ntoa(addr),  
masklen);
                Deref_Prefix(p);
                return 0;
        }

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