mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
MRT: Fix IPv6 table dumps
Add fake MP_REACH_NLRI attribute with BGP next hop when encoding MRT table dumps for IPv6 routes. That is necessary to encode next hop as NEXT_HOP attribute is not used for MP-BGP. Thanks to Santiago Aggio for the bugreport.
This commit is contained in:
@@ -683,6 +683,37 @@ bgp_format_cluster_list(const eattr *a, byte *buf, uint size)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bgp_encode_mp_reach_mrt(struct bgp_write_state *s UNUSED, eattr *a, byte *buf, uint size)
|
||||
{
|
||||
/*
|
||||
* Limited version of MP_REACH_NLRI used for MRT table dumps (IPv6 only):
|
||||
*
|
||||
* 3 B MP_REACH_NLRI header
|
||||
* 1 B MP_REACH_NLRI data - Length of Next Hop Network Address
|
||||
* var MP_REACH_NLRI data - Network Address of Next Hop
|
||||
*/
|
||||
|
||||
ip_addr *nh = (void *) a->u.ptr->data;
|
||||
uint len = a->u.ptr->length;
|
||||
|
||||
ASSERT((len == 16) || (len == 32));
|
||||
|
||||
if (size < (3+1+len))
|
||||
return -1;
|
||||
|
||||
bgp_put_attr_hdr3(buf, BA_MP_REACH_NLRI, BAF_OPTIONAL, 1+len);
|
||||
buf[3] = len;
|
||||
buf += 4;
|
||||
|
||||
put_ip6(buf, ipa_to_ip6(nh[0]));
|
||||
|
||||
if (len == 32)
|
||||
put_ip6(buf+16, ipa_to_ip6(nh[1]));
|
||||
|
||||
return 3+1+len;
|
||||
}
|
||||
|
||||
static inline u32
|
||||
get_af3(byte *buf)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user