Skip to content

Commit

Permalink
[fix] samples/bgp could send out an empty IPv6 reachable/unreachable …
Browse files Browse the repository at this point in the history
…list which caused errors in frr
  • Loading branch information
pajama-coder committed Jul 22, 2024
1 parent d372975 commit 4425fab
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions samples/bgp/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,38 +243,41 @@ export default function (config, address) {

// Routes for IPv6 unicast
if (hasIPv6) {
var pathAttributes = [...commonPathAttrs]
if (config.ipv6.reachable.length > 0) {
pathAttributes.push({
// MP_REACH_NLRI
code: 14,
value: new Data([
// IPv6 unicast
0, 2, 1,
// Next Hop
16, ...ipv6(IPV6_NEXT_HOP).data,
// No SNPAs
0,
// NLRI
...config.ipv6.reachable.flatMap(a => ipv6Prefix(a)),
]),
optional: true,
})
}
if (config.ipv6.unreachable.length > 0) {
pathAttributes.push({
// MP_UNREACH_NLRI
code: 15,
value: new Data([
// IPv6 unicast
0, 2, 1,
// NLRI
...config.ipv6.unreachable.flatMap(a => ipv6Prefix(a)),
]),
optional: true,
})
}
messages.push(new Message(null, {
type: 'UPDATE',
body: {
pathAttributes: [
...commonPathAttrs,
{
// MP_REACH_NLRI
code: 14,
value: new Data([
// IPv6 unicast
0, 2, 1,
// Next Hop
16, ...ipv6(IPV6_NEXT_HOP).data,
// No SNPAs
0,
// NLRI
...config.ipv6.reachable.flatMap(a => ipv6Prefix(a)),
]),
optional: true,
},
{
// MP_UNREACH_NLRI
code: 15,
value: new Data([
// IPv6 unicast
0, 2, 1,
// NLRI
...config.ipv6.unreachable.flatMap(a => ipv6Prefix(a)),
]),
optional: true,
}
],
pathAttributes,
withdrawnRoutes: [],
destinations: [],
}
Expand Down

0 comments on commit 4425fab

Please sign in to comment.