Skip to content

Commit 29c7444

Browse files
committed
Filter out link local address when getting host IPv6
The link local addresses can't be used Signed-off-by: BenjiReis <benjamin.reis@vates.fr>
1 parent 20b0574 commit 29c7444

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ocaml/xapi/xapi_host.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,12 @@ let migrate_receive ~__context ~host ~network ~options:_ =
25272527
let configuration_mode =
25282528
Db.PIF.get_ipv6_configuration_mode ~__context ~self:pif
25292529
in
2530-
match Db.PIF.get_IPv6 ~__context ~self:pif with
2530+
let valid_ipv6s =
2531+
List.filter
2532+
(fun ipv6 -> not (String.starts_with "fe80::" ipv6))
2533+
(Db.PIF.get_IPv6 ~__context ~self:pif)
2534+
in
2535+
match valid_ipv6s with
25312536
| [] ->
25322537
("", configuration_mode)
25332538
| ip :: _ ->

ocaml/xapi/xapi_pif_helpers.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,9 @@ let get_primary_address ~__context ~pif =
262262
match Db.PIF.get_IP ~__context ~self:pif with "" -> None | ip -> Some ip
263263
)
264264
| `IPv6 ->
265-
List.nth_opt (Db.PIF.get_IPv6 ~__context ~self:pif) 0
265+
let valid_ipv6s =
266+
List.filter
267+
(fun ipv6 -> not (String.starts_with "fe80::" ipv6))
268+
(Db.PIF.get_IPv6 ~__context ~self:pif)
269+
in
270+
List.nth_opt valid_ipv6s 0

0 commit comments

Comments
 (0)