summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.h
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-09-07 00:24:49 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-09-07 00:24:49 +0000
commit1a392d46db1917dfca2ddd06d7f0021396f8ecfa (patch)
tree8dec4a2e583c9a1890fd62d647dcd5a27d14bde1 /bgpd/bgp_route.h
parentff7924f6c0437e2f3cc3710570414ae87a828724 (diff)
[bgpd] Handle pcount as flags are changed, fixing pcount issues
2006-09-06 Paul Jakma <paul.jakma@sun.com> * (general) Squash any and all prefix-count issues by abstracting route flag changes, and maintaining count as and when flags are modified (rather than relying on explicit modifications of count being sprinkled in just the right places throughout the code). * bgp_route.c: (bgp_pcount_{dec,inc}rement) removed. (bgp_pcount_adjust) new, update prefix count as needed for a given route. (bgp_info_{uns,s}et_flag) set/unset a BGP_INFO route status flag, calling previous function when appropriate. (general) Update all set/unsets of flags to use previous. Remove pcount_{dec,inc}rement calls. No need to unset BGP_INFO_VALID in places where bgp_info_delete is called, it does that anyway. * bgp_{damp,nexthop}.c: Update to use bgp_info_{un,}set_flag. * bgp_route.h: Export bgp_info_{un,}set_flag. Add a 'meta' BGP_INFO flag, BGP_INFO_UNUSEABLE. Move BGP_INFO_HOLDDOWN macro to here from bgpd.h
Diffstat (limited to 'bgpd/bgp_route.h')
-rw-r--r--bgpd/bgp_route.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index e5f3ae59..b0c2fccf 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -105,6 +105,17 @@ struct bgp_static
u_char tag[3];
};
+/* Flags which indicate a route is unuseable in some form */
+#define BGP_INFO_UNUSEABLE \
+ (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED)
+/* Macro to check BGP information is alive or not. Sadly,
+ * not equivalent to just checking previous, because of the
+ * sense of the additional VALID flag.
+ */
+#define BGP_INFO_HOLDDOWN(BI) \
+ (! CHECK_FLAG ((BI)->flags, BGP_INFO_VALID) \
+ || CHECK_FLAG ((BI)->flags, BGP_INFO_UNUSEABLE))
+
#define DISTRIBUTE_IN_NAME(F) ((F)->dlist[FILTER_IN].name)
#define DISTRIBUTE_IN(F) ((F)->dlist[FILTER_IN].alist)
#define DISTRIBUTE_OUT_NAME(F) ((F)->dlist[FILTER_OUT].name)
@@ -151,6 +162,8 @@ extern struct bgp_info *bgp_info_lock (struct bgp_info *);
extern struct bgp_info *bgp_info_unlock (struct bgp_info *);
extern void bgp_info_add (struct bgp_node *rn, struct bgp_info *ri);
extern void bgp_info_delete (struct bgp_node *rn, struct bgp_info *ri);
+extern void bgp_info_set_flag (struct bgp_node *, struct bgp_info *, u_int32_t);
+extern void bgp_info_unset_flag (struct bgp_node *, struct bgp_info *, u_int32_t);
extern int bgp_nlri_sanity_check (struct peer *, int, u_char *, bgp_size_t);
extern int bgp_nlri_parse (struct peer *, struct attr *, struct bgp_nlri *);