Skip to content

Commit

Permalink
Filter out link local address when getting host IPv6
Browse files Browse the repository at this point in the history
The link local addresses can't be used

Signed-off-by: BenjiReis <[email protected]>
  • Loading branch information
benjamreis committed Jun 22, 2023
1 parent 20b0574 commit 604196d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ocaml/xapi/xapi_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,10 @@ let migrate_receive ~__context ~host ~network ~options:_ =
let configuration_mode =
Db.PIF.get_ipv6_configuration_mode ~__context ~self:pif
in
match Db.PIF.get_IPv6 ~__context ~self:pif with
let valid_ipv6s =
List.filter (fun ipv6 -> not (String.starts_with "fe80::" ipv6)) (Db.PIF.get_IPv6 ~__context ~self:pif)
in
match valid_ipv6s with
| [] ->
("", configuration_mode)
| ip :: _ ->
Expand Down
5 changes: 4 additions & 1 deletion ocaml/xapi/xapi_pif_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,7 @@ let get_primary_address ~__context ~pif =
match Db.PIF.get_IP ~__context ~self:pif with "" -> None | ip -> Some ip
)
| `IPv6 ->
List.nth_opt (Db.PIF.get_IPv6 ~__context ~self:pif) 0
let valid_ipv6s =
List.filter (fun ipv6 -> not (String.starts_with "fe80::" ipv6)) (Db.PIF.get_IPv6 ~__context ~self:pif)
in
List.nth_opt valid_ipv6s 0

0 comments on commit 604196d

Please sign in to comment.