mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-20 10:08:43 +00:00
BGP: Add support for SAFI 129 (VPN multicast)
Which, in contrast to SAFI 128, does not use MPLS labels.
This commit is contained in:
parent
ffb38dfb8b
commit
711d617dc1
@ -33,6 +33,7 @@ struct eattr;
|
||||
#define BGP_SAFI_MULTICAST 2
|
||||
#define BGP_SAFI_MPLS 4
|
||||
#define BGP_SAFI_MPLS_VPN 128
|
||||
#define BGP_SAFI_VPN_MULTICAST 129
|
||||
#define BGP_SAFI_FLOW 133
|
||||
|
||||
/* Internal AF codes */
|
||||
@ -49,6 +50,8 @@ struct eattr;
|
||||
#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_VPN4_MC BGP_AF( BGP_AFI_IPV4, BGP_SAFI_VPN_MULTICAST )
|
||||
#define BGP_AF_VPN6_MC BGP_AF( BGP_AFI_IPV6, BGP_SAFI_VPN_MULTICAST )
|
||||
#define BGP_AF_FLOW4 BGP_AF( BGP_AFI_IPV4, BGP_SAFI_FLOW )
|
||||
#define BGP_AF_FLOW6 BGP_AF( BGP_AFI_IPV6, BGP_SAFI_FLOW )
|
||||
|
||||
|
@ -135,16 +135,18 @@ bgp_proto:
|
||||
;
|
||||
|
||||
bgp_afi:
|
||||
IPV4 { $$ = BGP_AF_IPV4; }
|
||||
| IPV6 { $$ = BGP_AF_IPV6; }
|
||||
| IPV4 MULTICAST { $$ = BGP_AF_IPV4_MC; }
|
||||
| IPV6 MULTICAST { $$ = BGP_AF_IPV6_MC; }
|
||||
| IPV4 MPLS { $$ = BGP_AF_IPV4_MPLS; }
|
||||
| IPV6 MPLS { $$ = BGP_AF_IPV6_MPLS; }
|
||||
| VPN4 MPLS { $$ = BGP_AF_VPN4_MPLS; }
|
||||
| VPN6 MPLS { $$ = BGP_AF_VPN6_MPLS; }
|
||||
| FLOW4 { $$ = BGP_AF_FLOW4; }
|
||||
| FLOW6 { $$ = BGP_AF_FLOW6; }
|
||||
IPV4 { $$ = BGP_AF_IPV4; }
|
||||
| IPV6 { $$ = BGP_AF_IPV6; }
|
||||
| IPV4 MULTICAST { $$ = BGP_AF_IPV4_MC; }
|
||||
| IPV6 MULTICAST { $$ = BGP_AF_IPV6_MC; }
|
||||
| IPV4 MPLS { $$ = BGP_AF_IPV4_MPLS; }
|
||||
| IPV6 MPLS { $$ = BGP_AF_IPV6_MPLS; }
|
||||
| VPN4 MPLS { $$ = BGP_AF_VPN4_MPLS; }
|
||||
| VPN6 MPLS { $$ = BGP_AF_VPN6_MPLS; }
|
||||
| VPN4 MULTICAST { $$ = BGP_AF_VPN4_MC; }
|
||||
| VPN6 MULTICAST { $$ = BGP_AF_VPN6_MC; }
|
||||
| FLOW4 { $$ = BGP_AF_FLOW4; }
|
||||
| FLOW6 { $$ = BGP_AF_FLOW6; }
|
||||
;
|
||||
|
||||
bgp_channel_start: bgp_afi
|
||||
|
@ -289,8 +289,8 @@ bgp_write_capabilities(struct bgp_conn *conn, byte *buf)
|
||||
/* Create capability list in buffer */
|
||||
|
||||
/*
|
||||
* Note that max length is ~ 20+14*af_count. With max 10 channels that is
|
||||
* 160. Option limit is 253 and buffer size is 4096, so we cannot overflow
|
||||
* Note that max length is ~ 20+14*af_count. With max 12 channels that is
|
||||
* 188. Option limit is 253 and buffer size is 4096, so we cannot overflow
|
||||
* unless we add new capabilities or more AFs.
|
||||
*/
|
||||
|
||||
@ -1386,7 +1386,8 @@ bgp_encode_nlri_vpn4(struct bgp_write_state *s, struct bgp_bucket *buck, byte *b
|
||||
ADVANCE(pos, size, 1);
|
||||
|
||||
/* Encode MPLS labels */
|
||||
bgp_encode_mpls_labels(s, s->mpls_labels, &pos, &size, pos - 1);
|
||||
if (s->mpls)
|
||||
bgp_encode_mpls_labels(s, s->mpls_labels, &pos, &size, pos - 1);
|
||||
|
||||
/* Encode route distinguisher */
|
||||
put_u64(pos, net->rd);
|
||||
@ -1430,7 +1431,8 @@ bgp_decode_nlri_vpn4(struct bgp_parse_state *s, byte *pos, uint len, rta *a)
|
||||
bgp_parse_error(s, 1);
|
||||
|
||||
/* Decode MPLS labels */
|
||||
bgp_decode_mpls_labels(s, &pos, &len, &l, a);
|
||||
if (s->mpls)
|
||||
bgp_decode_mpls_labels(s, &pos, &len, &l, a);
|
||||
|
||||
/* Decode route distinguisher */
|
||||
if (l < 64)
|
||||
@ -1824,6 +1826,26 @@ static const struct bgp_af_desc bgp_af_table[] = {
|
||||
.decode_next_hop = bgp_decode_next_hop_vpn,
|
||||
.update_next_hop = bgp_update_next_hop_ip,
|
||||
},
|
||||
{
|
||||
.afi = BGP_AF_VPN4_MC,
|
||||
.net = NET_VPN4,
|
||||
.name = "vpn4-mc",
|
||||
.encode_nlri = bgp_encode_nlri_vpn4,
|
||||
.decode_nlri = bgp_decode_nlri_vpn4,
|
||||
.encode_next_hop = bgp_encode_next_hop_vpn,
|
||||
.decode_next_hop = bgp_decode_next_hop_vpn,
|
||||
.update_next_hop = bgp_update_next_hop_ip,
|
||||
},
|
||||
{
|
||||
.afi = BGP_AF_VPN6_MC,
|
||||
.net = NET_VPN6,
|
||||
.name = "vpn6-mc",
|
||||
.encode_nlri = bgp_encode_nlri_vpn6,
|
||||
.decode_nlri = bgp_decode_nlri_vpn6,
|
||||
.encode_next_hop = bgp_encode_next_hop_vpn,
|
||||
.decode_next_hop = bgp_decode_next_hop_vpn,
|
||||
.update_next_hop = bgp_update_next_hop_ip,
|
||||
},
|
||||
{
|
||||
.afi = BGP_AF_FLOW4,
|
||||
.net = NET_FLOW4,
|
||||
|
Loading…
Reference in New Issue
Block a user