Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

> Users must be able to say: "I had this issue, happy to know it's fixed"

- [Netbox] Fix IP addresses synced with an incorrect, less specific prefix (e.g. `/8` instead of `/24`) when a shorter container prefix also matched [#10240](https://github.com/vatesfr/xen-orchestra/issues/10240) (PR [#10297](https://github.com/vatesfr/xen-orchestra/pull/10297))

### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -31,4 +33,6 @@

<!--packages-start-->

- xo-server-netbox patch

<!--packages-end-->
6 changes: 4 additions & 2 deletions packages/xo-server-netbox/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,8 @@ class Netbox {
let smallestPrefix
let highestBits = 0
nbPrefixes.forEach(({ prefix }) => {
const [range, bits] = prefix.split('/')
const [range, bitsStr] = prefix.split('/')
const bits = Number(bitsStr)
let parsedRange
try {
parsedRange = ipaddr.parse(range)
Expand All @@ -890,7 +891,8 @@ class Netbox {

const xoCompactIp = parsedIp.toString() // use compact notation (e.g. ::1) before ===-comparison
const nbIp = find(nbIpsToCheck, nbIp => {
const [ip, bits] = nbIp.address.split('/')
const [ip, bitsStr] = nbIp.address.split('/')
Comment thread
matlantin marked this conversation as resolved.
const bits = Number(bitsStr)
let nbCompactIp
try {
nbCompactIp = ipaddr.parse(ip).toString()
Expand Down