summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgpd.h')
-rw-r--r--bgpd/bgpd.h139
1 files changed, 119 insertions, 20 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 7665d9d0..25838edb 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
/* For union sockunion. */
#include "sockunion.h"
+#include "routemap.h"
/* Typedef BGP specific types. */
typedef u_int32_t as_t;
@@ -62,6 +63,13 @@ struct bgp_master
#define BGP_OPT_NO_LISTEN (1 << 3)
};
+/* BGP route-map structure. */
+struct bgp_rmap
+{
+ char *name;
+ struct route_map *map;
+};
+
/* BGP instance structure. */
struct bgp
{
@@ -104,10 +112,45 @@ struct bgp
as_t *confed_peers;
int confed_peers_cnt;
- struct thread *t_startup;
+ struct thread *t_startup; /* start-up timer on only once at the beginning */
+
+ u_int32_t v_maxmed_onstartup; /* Duration of max-med on start-up */
+#define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */
+ u_int32_t maxmed_onstartup_value; /* Max-med value when active on start-up */
+ struct thread *t_maxmed_onstartup; /* non-null when max-med onstartup is on */
+ u_char maxmed_onstartup_over; /* Flag to make it effective only once */
+
+ u_char v_maxmed_admin; /* 1/0 if max-med administrative is on/off */
+#define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */
+ u_int32_t maxmed_admin_value; /* Max-med value when administrative in on */
+#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
+
+ u_char maxmed_active; /* 1/0 if max-med is active or not */
+ u_int32_t maxmed_value; /* Max-med value when its active */
+
+ /* BGP update delay on startup */
+ struct thread *t_update_delay;
+ struct thread *t_establish_wait;
+ u_char update_delay_over;
+ u_char main_zebra_update_hold;
+ u_char main_peers_update_hold;
+ u_char rsclient_peers_update_hold;
+ u_int16_t v_update_delay;
+ u_int16_t v_establish_wait;
+ char update_delay_begin_time[64];
+ char update_delay_end_time[64];
+ char update_delay_zebra_resume_time[64];
+ char update_delay_peers_resume_time[64];
+ u_int32_t established;
+ u_int32_t restarted_peers;
+ u_int32_t implicit_eors;
+ u_int32_t explicit_eors;
+#define BGP_UPDATE_DELAY_DEF 0
+#define BGP_UPDATE_DELAY_MIN 0
+#define BGP_UPDATE_DELAY_MAX 3600
/* BGP flags. */
- u_int16_t flags;
+ u_int32_t flags;
#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)
#define BGP_FLAG_DETERMINISTIC_MED (1 << 1)
#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)
@@ -124,6 +167,7 @@ struct bgp
#define BGP_FLAG_ASPATH_CONFED (1 << 13)
#define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1 << 14)
#define BGP_FLAG_DELETING (1 << 15)
+#define BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY (1 << 16)
/* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX];
@@ -138,6 +182,9 @@ struct bgp
/* BGP routing information base. */
struct bgp_table *rib[AFI_MAX][SAFI_MAX];
+ /* BGP table route-map. */
+ struct bgp_rmap table_map[AFI_MAX][SAFI_MAX];
+
/* BGP redistribute configuration. */
u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX];
@@ -146,11 +193,12 @@ struct bgp
u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX];
/* BGP redistribute route-map. */
- struct
- {
- char *name;
- struct route_map *map;
- } rmap[AFI_MAX][ZEBRA_ROUTE_MAX];
+ struct bgp_rmap rmap[AFI_MAX][ZEBRA_ROUTE_MAX];
+
+ /* timer to dampen route map changes */
+ struct thread *t_rmap_update; /* Handle route map updates */
+ u_int32_t rmap_update_timer; /* Route map update timer */
+#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
/* BGP distance configuration. */
u_char distance_ebgp;
@@ -172,9 +220,18 @@ struct bgp
struct bgp_maxpaths_cfg {
u_int16_t maxpaths_ebgp;
u_int16_t maxpaths_ibgp;
+ u_int16_t ibgp_flags;
+#define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0)
} maxpaths[AFI_MAX][SAFI_MAX];
+
+ u_int32_t wpkt_quanta; /* per peer packet quanta to write */
+ u_int32_t adv_quanta; /* adv FIFO size that triggers write */
+ u_int32_t wd_quanta; /* withdraw FIFO size that triggers write */
};
+#define BGP_ROUTE_ADV_HOLD(bgp) \
+ (bgp->main_peers_update_hold || bgp->rsclient_peers_update_hold)
+
/* BGP peer-group support. */
struct peer_group
{
@@ -272,6 +329,12 @@ typedef enum
BGP_PEER_CONFED,
} bgp_peer_sort_t;
+/* BGP message header and packet size. */
+#define BGP_MARKER_SIZE 16
+#define BGP_HEADER_SIZE 19
+#define BGP_MAX_PACKET_SIZE 4096
+#define BGP_MAX_PACKET_SIZE_OVERFLOW 1024
+
/* BGP neighbor structure. */
struct peer
{
@@ -320,6 +383,9 @@ struct peer
*/
struct stream *scratch;
+ /* the doppelganger peer structure, due to dual TCP conn setup */
+ struct peer *doppelganger;
+
/* Status of the peer. */
int status;
int ostatus;
@@ -336,15 +402,16 @@ struct peer
unsigned short port; /* Destination port for peer */
char *host; /* Printable address of the peer. */
union sockunion su; /* Sockunion address of the peer. */
+#define BGP_PEER_SU_UNSPEC(peer) (peer->su.sa.sa_family == AF_UNSPEC)
time_t uptime; /* Last Up/Down time */
time_t readtime; /* Last read time */
time_t resettime; /* Last reset time */
ifindex_t ifindex; /* ifindex of the BGP connection. */
+ char *conf_if; /* neighbor interface config name. */
char *ifname; /* bind interface name. */
char *update_if;
union sockunion *update_source;
- struct zlog *log;
union sockunion *su_local; /* Sockunion of local address. */
union sockunion *su_remote; /* Sockunion of remote address. */
@@ -393,6 +460,8 @@ struct peer
#define PEER_FLAG_DISABLE_CONNECTED_CHECK (1 << 6) /* disable-connected-check */
#define PEER_FLAG_LOCAL_AS_NO_PREPEND (1 << 7) /* local-as no-prepend */
#define PEER_FLAG_LOCAL_AS_REPLACE_AS (1 << 8) /* local-as no-prepend replace-as */
+#define PEER_FLAG_DELETE (1 << 9) /* mark the peer for deleting */
+#define PEER_FLAG_CONFIG_NODE (1 << 10) /* the node to update configs on */
/* NSF mode (graceful restart) */
u_char nsf[AFI_MAX][SAFI_MAX];
@@ -417,6 +486,9 @@ struct peer
#define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */
#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */
#define PEER_FLAG_NEXTHOP_SELF_ALL (1 << 17) /* next-hop-self all */
+#define PEER_FLAG_REMOVE_PRIVATE_AS_ALL (1 << 18) /* remove-private-as all */
+#define PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE (1 << 19) /* remove-private-as replace-as */
+#define PEER_FLAG_AS_OVERRIDE (1 << 20) /* as-override */
/* MD5 password */
char *password;
@@ -481,6 +553,8 @@ struct peer
struct thread *t_gr_restart;
struct thread *t_gr_stale;
+ int radv_adjusted; /* flag if MRAI has been adjusted or not */
+
/* workqueues */
struct work_queue *clear_node_queue;
@@ -503,9 +577,13 @@ struct peer
u_int32_t established; /* Established */
u_int32_t dropped; /* Dropped */
+ /* Update delay related fields */
+ u_char update_delay_over; /* When this is set, BGP is no more waiting for EOR */
+
/* Syncronization list and time. */
struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
time_t synctime;
+ time_t last_write; /* timestamp when the last UPDATE msg was written */
/* Send prefix count. */
unsigned long scount[AFI_MAX][SAFI_MAX];
@@ -525,6 +603,12 @@ struct peer
/* ORF Prefix-list */
struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
+ /* Text description of last attribute rcvd */
+ char rcvd_attr_str[BUFSIZ];
+
+ /* Track if we printed the attribute in debugs */
+ int rcvd_attr_printed;
+
/* Prefix count. */
unsigned long pcount[AFI_MAX][SAFI_MAX];
@@ -561,6 +645,8 @@ struct peer
#define PEER_DOWN_PASSIVE_CHANGE 20 /* neighbor passive command */
#define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */
#define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */
+unsigned long last_reset_cause_size;
+u_char last_reset_cause[BGP_MAX_PACKET_SIZE];
/* The kind of route-map Flags.*/
u_char rmap_type;
@@ -600,11 +686,6 @@ struct bgp_nlri
/* Default BGP port number. */
#define BGP_PORT_DEFAULT 179
-/* BGP message header and packet size. */
-#define BGP_MARKER_SIZE 16
-#define BGP_HEADER_SIZE 19
-#define BGP_MAX_PACKET_SIZE 4096
-
/* BGP minimum message size. */
#define BGP_MSG_OPEN_MIN_SIZE (BGP_HEADER_SIZE + 10)
#define BGP_MSG_UPDATE_MIN_SIZE (BGP_HEADER_SIZE + 4)
@@ -742,7 +823,7 @@ struct bgp_nlri
#define BGP_EVENTS_MAX 15
/* BGP timers default value. */
-#define BGP_INIT_START_TIMER 5
+#define BGP_INIT_START_TIMER 1
#define BGP_DEFAULT_HOLDTIME 180
#define BGP_DEFAULT_KEEPALIVE 60
#define BGP_DEFAULT_EBGP_ROUTEADV 30
@@ -826,8 +907,10 @@ enum bgp_clear_type
#define BGP_ERR_TCPSIG_FAILED -29
#define BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK -30
#define BGP_ERR_NO_IBGP_WITH_TTLHACK -31
-#define BGP_ERR_MAX -32
+#define BGP_ERR_NO_INTERFACE_CONFIG -32
#define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS -33
+#define BGP_ERR_AS_OVERRIDE -34
+#define BGP_ERR_MAX -35
extern struct bgp_master *bm;
@@ -842,6 +925,10 @@ extern struct bgp *bgp_get_default (void);
extern struct bgp *bgp_lookup (as_t, const char *);
extern struct bgp *bgp_lookup_by_name (const char *);
extern struct peer *peer_lookup (struct bgp *, union sockunion *);
+extern struct peer *peer_lookup_by_conf_if (struct bgp *, const char *);
+extern struct peer *peer_conf_interface_get(struct bgp *, const char *, afi_t,
+ safi_t);
+extern void bgp_peer_conf_if_to_su_update (struct peer *);
extern struct peer_group *peer_group_lookup (struct bgp *, const char *);
extern struct peer_group *peer_group_get (struct bgp *, const char *);
extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
@@ -860,7 +947,10 @@ extern struct peer *peer_unlock_with_caller(const char *, struct peer *);
extern bgp_peer_sort_t peer_sort (struct peer *peer);
extern int peer_active (struct peer *);
extern int peer_active_nego (struct peer *);
+extern struct peer *peer_create(union sockunion *, const char *, struct bgp *,
+ as_t, as_t, afi_t, safi_t);
extern struct peer *peer_create_accept (struct bgp *);
+extern void peer_xfer_config (struct peer *dst, struct peer *src);
extern char *peer_uptime (time_t, char *, size_t);
extern int bgp_config_write (struct vty *);
extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
@@ -902,9 +992,12 @@ extern int bgp_timers_unset (struct bgp *);
extern int bgp_default_local_preference_set (struct bgp *, u_int32_t);
extern int bgp_default_local_preference_unset (struct bgp *);
+extern int bgp_update_delay_active (struct bgp *);
+extern int bgp_update_delay_configured (struct bgp *);
extern int peer_rsclient_active (struct peer *);
-
-extern int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
+extern void peer_as_change (struct peer *, as_t);
+extern int peer_remote_as (struct bgp *, union sockunion *,const char *, as_t *,
+ afi_t, safi_t);
extern int peer_group_remote_as (struct bgp *, const char *, as_t *);
extern int peer_delete (struct peer *peer);
extern int peer_group_delete (struct peer_group *);
@@ -913,8 +1006,8 @@ extern int peer_group_remote_as_delete (struct peer_group *);
extern int peer_activate (struct peer *, afi_t, safi_t);
extern int peer_deactivate (struct peer *, afi_t, safi_t);
-extern int peer_group_bind (struct bgp *, union sockunion *, struct peer_group *,
- afi_t, safi_t, as_t *);
+extern int peer_group_bind (struct bgp *, union sockunion *, struct peer *,
+ struct peer_group *, afi_t, safi_t, as_t *);
extern int peer_group_unbind (struct bgp *, struct peer *, struct peer_group *,
afi_t, safi_t);
@@ -984,10 +1077,16 @@ extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
extern int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int, u_int16_t);
extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t);
-extern int peer_clear (struct peer *);
+extern int peer_clear (struct peer *, struct listnode **);
extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
extern int peer_ttl_security_hops_set (struct peer *, int);
extern int peer_ttl_security_hops_unset (struct peer *);
+extern int bgp_route_map_update_timer (struct thread *thread);
+extern void bgp_route_map_terminate(void);
+
+extern void bgp_scan_finish (void);
+
+extern int peer_cmp (struct peer *p1, struct peer *p2);
#endif /* _QUAGGA_BGPD_H */