Author: adrian.chadd
Date: Mon Feb 23 06:03:43 2009
New Revision: 13852
Modified:
playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_rib.c
Log:
BGPv4 (rfc4271) allows for routes to be replaced, versus requiring explicit
withdraw/update.
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 Mon Feb 23 06:03:43 2009
@@ -80,6 +80,13 @@
head->num_prefixes = 0;
}
+static void
+bgp_rib_clear_node(bgp_rib_head_t *head, radix_node_t *n)
+{
+ bgp_rib_asn_free(n, NULL);
+ radix_remove(head->rh, n);
+ head->num_prefixes--;
+}
int
bgp_rib_add_net(bgp_rib_head_t *head, struct in_addr addr, int masklen,
u_short origin_as)
@@ -92,9 +99,8 @@
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;
+ debug(85, 1) ("bgp_rib_add_net: %s/%d: removing before
re-adding\n",
inet_ntoa(addr), masklen);
+ bgp_rib_clear_node(head, n);
}
n = radix_lookup(head->rh, p);
@@ -124,10 +130,7 @@
Deref_Prefix(p);
return 0;
}
- /* XXX clear data associated with this prefix! */
- bgp_rib_asn_free(n, NULL);
- radix_remove(head->rh, n);
+ bgp_rib_clear_node(head, n);
Deref_Prefix(p);
- head->num_prefixes--;
return 1;
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---