Fix bugs in IPv6 update routine.
Signed-off-by: Benjamin Cama <benoar@dolka.fr>
This commit is contained in:
parent
7e1e91ef98
commit
350b06e6f4
1 changed files with 16 additions and 7 deletions
17
bgp.c
17
bgp.c
|
|
@ -1665,10 +1665,19 @@ static int bgp_send_update6(struct bgp_peer *peer)
|
||||||
if (!(unf_len || add))
|
if (!(unf_len || add))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (unf_len)
|
||||||
|
{
|
||||||
/* go back and insert MP unf_len */
|
/* go back and insert MP unf_len */
|
||||||
unf_len += sizeof(struct bgp_attr_mp_unreach_nlri_partial);
|
unf_len += sizeof(struct bgp_attr_mp_unreach_nlri_partial);
|
||||||
unf_len = htons(unf_len);
|
unf_len = htons(unf_len);
|
||||||
memcpy(&unreach_len, &unf_len, sizeof(unf_len));
|
memcpy(unreach_len, &unf_len, sizeof(unf_len));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* we can remove this attribute, then */
|
||||||
|
data -= BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
|
||||||
|
len -= BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
{
|
{
|
||||||
|
|
@ -1690,9 +1699,9 @@ static int bgp_send_update6(struct bgp_peer *peer)
|
||||||
BGP_PATH_ATTR_MP_REACH_NLRI_PARTIAL_SIZE);
|
BGP_PATH_ATTR_MP_REACH_NLRI_PARTIAL_SIZE);
|
||||||
/* with proper len */
|
/* with proper len */
|
||||||
reach_len = BGP_IP_PREFIX_SIZE(add->dest);
|
reach_len = BGP_IP_PREFIX_SIZE(add->dest);
|
||||||
data[2] = reach_len;
|
data[2] = sizeof(struct bgp_attr_mp_reach_nlri_partial) + reach_len;
|
||||||
data += BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
|
data += BGP_PATH_ATTR_MP_REACH_NLRI_PARTIAL_SIZE;
|
||||||
len += BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
|
len += BGP_PATH_ATTR_MP_REACH_NLRI_PARTIAL_SIZE;
|
||||||
|
|
||||||
memcpy(data, &add->dest, reach_len);
|
memcpy(data, &add->dest, reach_len);
|
||||||
data += reach_len;
|
data += reach_len;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue