summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.h
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-03-22 15:00:07 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-03-22 18:16:49 +0100
commit1e37e35c3ea88672c677ea7ac63fe0b9df609b0c (patch)
tree8400d1b28ae6d4d0146ad1573c7ebd3653152ace /proto/bgp/bgp.h
parentead7b8f498ddefc0b7373cbba78f9a7ba1dddaa9 (diff)
BGP: Support for MPLS labels and VPN SAFI
Basic support for SAFI 4 and 128 (MPLS labeled IP and VPN) for IPv4 and IPv6. Should work for route reflector, but does not properly handle originating routes with next hop self. Based on patches from Jan Matejka.
Diffstat (limited to 'proto/bgp/bgp.h')
-rw-r--r--proto/bgp/bgp.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index e7647625..36fd39e8 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -31,6 +31,8 @@ struct eattr;
#define BGP_SAFI_UNICAST 1
#define BGP_SAFI_MULTICAST 2
+#define BGP_SAFI_MPLS 4
+#define BGP_SAFI_MPLS_VPN 128
#define BGP_SAFI_FLOW 133
/* Internal AF codes */
@@ -43,6 +45,10 @@ struct eattr;
#define BGP_AF_IPV6 BGP_AF( BGP_AFI_IPV6, BGP_SAFI_UNICAST )
#define BGP_AF_IPV4_MC BGP_AF( BGP_AFI_IPV4, BGP_SAFI_MULTICAST )
#define BGP_AF_IPV6_MC BGP_AF( BGP_AFI_IPV6, BGP_SAFI_MULTICAST )
+#define BGP_AF_IPV4_MPLS BGP_AF( BGP_AFI_IPV4, BGP_SAFI_MPLS )
+#define BGP_AF_IPV6_MPLS BGP_AF( BGP_AFI_IPV6, BGP_SAFI_MPLS )
+#define BGP_AF_VPN4_MPLS BGP_AF( BGP_AFI_IPV4, BGP_SAFI_MPLS_VPN )
+#define BGP_AF_VPN6_MPLS BGP_AF( BGP_AFI_IPV6, BGP_SAFI_MPLS_VPN )
#define BGP_AF_FLOW4 BGP_AF( BGP_AFI_IPV4, BGP_SAFI_FLOW )
#define BGP_AF_FLOW6 BGP_AF( BGP_AFI_IPV6, BGP_SAFI_FLOW )
@@ -55,6 +61,7 @@ struct bgp_bucket;
struct bgp_af_desc {
u32 afi;
u32 net;
+ int mpls;
const char *name;
uint (*encode_nlri)(struct bgp_write_state *s, struct bgp_bucket *buck, byte *buf, uint size);
void (*decode_nlri)(struct bgp_parse_state *s, byte *pos, uint len, rta *a);
@@ -308,6 +315,7 @@ struct bgp_export_state {
struct bgp_proto *src;
rte *route;
+ int mpls;
u32 attrs_seen[1];
uint err_withdraw;
@@ -320,8 +328,10 @@ struct bgp_write_state {
int as4_session;
int add_path;
+ int mpls;
eattr *mp_next_hop;
+ adata *mpls_labels;
};
struct bgp_parse_state {
@@ -331,14 +341,13 @@ struct bgp_parse_state {
int as4_session;
int add_path;
+ int mpls;
u32 attrs_seen[256/32];
u32 mp_reach_af;
u32 mp_unreach_af;
- mpls_label_stack mls;
-
uint attr_len;
uint ip_reach_len;
uint ip_unreach_len;
@@ -359,6 +368,9 @@ struct bgp_parse_state {
uint err_subcode;
jmp_buf err_jmpbuf;
+ struct hostentry *hostentry;
+ adata *mpls_labels;
+
/* Cached state for bgp_rte_update() */
u32 last_id;
struct rte_src *last_src;
@@ -392,6 +404,7 @@ bgp_parse_error(struct bgp_parse_state *s, uint subcode)
}
extern struct linpool *bgp_linpool;
+extern struct linpool *bgp_linpool2;
void bgp_start_timer(struct timer *t, int value);
@@ -528,6 +541,9 @@ void bgp_update_next_hop(struct bgp_export_state *s, eattr *a, ea_list **to);
#define BA_AS4_AGGREGATOR 0x12 /* RFC 6793 */
#define BA_LARGE_COMMUNITY 0x20 /* RFC 8092 */
+/* Bird's private internal BGP attributes */
+#define BA_MPLS_LABEL_STACK 0xfe /* MPLS label stack transfer attribute */
+
/* BGP connection states */
#define BS_IDLE 0