mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
bgpd: fix nexthop resolution of ipv4-mapped ipv6
Fix nexthop resolution of ipv4-mapped ipv6 nexthop addresses.
Fixes: 5dd731af84
("bgpd: prefer link-local to a ipv4-mapped ipv6 global")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
15fb7209ee
commit
6e8897fcf5
@ -351,7 +351,9 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (afi == AFI_IP6 && p.family == AF_INET)
|
||||||
|
/* IPv4 mapped IPv6 nexthop address */
|
||||||
|
afi = AFI_IP;
|
||||||
srte_color = bgp_attr_get_color(pi->attr);
|
srte_color = bgp_attr_get_color(pi->attr);
|
||||||
|
|
||||||
} else if (peer) {
|
} else if (peer) {
|
||||||
@ -1078,14 +1080,25 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
|
|||||||
&ipv4);
|
&ipv4);
|
||||||
p->u.prefix4 = ipv4;
|
p->u.prefix4 = ipv4;
|
||||||
p->prefixlen = IPV4_MAX_BITLEN;
|
p->prefixlen = IPV4_MAX_BITLEN;
|
||||||
|
p->family = AF_INET;
|
||||||
} else
|
} else
|
||||||
p->u.prefix6 =
|
p->u.prefix6 =
|
||||||
pi->attr->mp_nexthop_global;
|
pi->attr->mp_nexthop_global;
|
||||||
} else
|
} else
|
||||||
p->u.prefix6 =
|
p->u.prefix6 =
|
||||||
pi->attr->mp_nexthop_local;
|
pi->attr->mp_nexthop_local;
|
||||||
} else
|
} else {
|
||||||
p->u.prefix6 = pi->attr->mp_nexthop_global;
|
if (IS_MAPPED_IPV6(
|
||||||
|
&pi->attr->mp_nexthop_global)) {
|
||||||
|
ipv4_mapped_ipv6_to_ipv4(&pi->attr->mp_nexthop_global,
|
||||||
|
&ipv4);
|
||||||
|
p->u.prefix4 = ipv4;
|
||||||
|
p->prefixlen = IPV4_MAX_BITLEN;
|
||||||
|
p->family = AF_INET;
|
||||||
|
} else
|
||||||
|
p->u.prefix6 =
|
||||||
|
pi->attr->mp_nexthop_global;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user