File tree 5 files changed +52
-10
lines changed
5 files changed +52
-10
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,15 @@ let refresh_localhost_info ~__context info =
126
126
) else
127
127
Db.Host. remove_from_other_config ~__context ~self: host
128
128
~key: Xapi_globs. host_no_local_storage ;
129
+ let options =
130
+ match Helpers. get_management_iface_primary_address_type with
131
+ | `IPv4 ->
132
+ [" check" ; " 80" ]
133
+ | `IPv6 ->
134
+ [" -6" ; " check" ; " 80" ]
135
+ in
129
136
let script_output =
130
- Helpers. call_script ! Xapi_globs. firewall_port_config_script [ " check " ; " 80 " ]
137
+ Helpers. call_script ! Xapi_globs. firewall_port_config_script options
131
138
in
132
139
try
133
140
let network_state = Scanf. sscanf script_output " Port 80 open: %B" Fun. id in
Original file line number Diff line number Diff line change @@ -165,6 +165,10 @@ let get_localhost ~__context =
165
165
| true ->
166
166
get_localhost_uncached ~__context
167
167
168
+ let get_management_iface_primary_address_type =
169
+ Record_util. primary_address_type_of_string
170
+ (Xapi_inventory. lookup Xapi_inventory. _management_address_type)
171
+
168
172
(* Determine the gateway and DNS PIFs:
169
173
* If one of the PIFs with IP has other_config:defaultroute=true, then
170
174
* pick this one as gateway PIF. If there are multiple, pick a random one of these.
Original file line number Diff line number Diff line change @@ -796,10 +796,17 @@ let bring_pif_up ~__context ?(management_interface = false) (pif : API.ref_PIF)
796
796
| `vxlan ->
797
797
debug
798
798
" Opening VxLAN UDP port for tunnel with protocol 'vxlan'" ;
799
+ let options =
800
+ match Helpers. get_management_iface_primary_address_type with
801
+ | `IPv4 ->
802
+ [" open" ; " 4789" ; " udp" ]
803
+ | `IPv6 ->
804
+ [" -6" ; " open" ; " 4789" ; " udp" ]
805
+ in
799
806
ignore
800
807
@@ Helpers. call_script
801
808
! Xapi_globs. firewall_port_config_script
802
- [ " open " ; " 4789 " ; " udp " ]
809
+ options
803
810
| `gre ->
804
811
()
805
812
)
@@ -857,10 +864,17 @@ let bring_pif_down ~__context ?(force = false) (pif : API.ref_PIF) =
857
864
in
858
865
if no_more_vxlan then (
859
866
debug " Last VxLAN tunnel was closed, closing VxLAN UDP port" ;
867
+ let options =
868
+ match Helpers. get_management_iface_primary_address_type with
869
+ | `IPv4 ->
870
+ [" close" ; " 4789" ; " udp" ]
871
+ | `IPv6 ->
872
+ [" -6" ; " close" ; " 4789" ; " udp" ]
873
+ in
860
874
ignore
861
875
@@ Helpers. call_script
862
876
! Xapi_globs. firewall_port_config_script
863
- [ " close " ; " 4789 " ; " udp " ]
877
+ options
864
878
)
865
879
| `gre ->
866
880
()
Original file line number Diff line number Diff line change @@ -274,9 +274,16 @@ module Daemon = struct
274
274
raise Api_errors. (Server_error (not_implemented, [" Cluster.create" ]))
275
275
) ;
276
276
( try
277
+ let options =
278
+ match Helpers. get_management_iface_primary_address_type with
279
+ | `IPv4 ->
280
+ [" open" ; port]
281
+ | `IPv6 ->
282
+ [" -6" ; " open" ; port]
283
+ in
277
284
maybe_call_script ~__context
278
285
! Xapi_globs. firewall_port_config_script
279
- [ " open " ; port] ;
286
+ options ;
280
287
maybe_call_script ~__context ! Xapi_globs. systemctl [" enable" ; service] ;
281
288
maybe_call_script ~__context ! Xapi_globs. systemctl [" start" ; service]
282
289
with _ ->
@@ -295,9 +302,14 @@ module Daemon = struct
295
302
Atomic. set enabled false ;
296
303
maybe_call_script ~__context ! Xapi_globs. systemctl [" disable" ; service] ;
297
304
maybe_call_script ~__context ! Xapi_globs. systemctl [" stop" ; service] ;
298
- maybe_call_script ~__context
299
- ! Xapi_globs. firewall_port_config_script
300
- [" close" ; port] ;
305
+ let options =
306
+ match Helpers. get_management_iface_primary_address_type with
307
+ | `IPv4 ->
308
+ [" close" ; port]
309
+ | `IPv6 ->
310
+ [" -6" ; " close" ; port]
311
+ in
312
+ maybe_call_script ~__context ! Xapi_globs. firewall_port_config_script options ;
301
313
debug " Cluster daemon: disabled & stopped"
302
314
303
315
let restart ~__context =
Original file line number Diff line number Diff line change @@ -3045,10 +3045,15 @@ let set_https_only ~__context ~self ~value =
3045
3045
let state = match value with true -> " close" | false -> " open" in
3046
3046
match cc_prep () with
3047
3047
| false ->
3048
+ let options =
3049
+ match Helpers. get_management_iface_primary_address_type with
3050
+ | `IPv4 ->
3051
+ [state; " 80" ]
3052
+ | `IPv6 ->
3053
+ [" -6" ; state; " 80" ]
3054
+ in
3048
3055
ignore
3049
- @@ Helpers. call_script
3050
- ! Xapi_globs. firewall_port_config_script
3051
- [state; " 80" ] ;
3056
+ @@ Helpers. call_script ! Xapi_globs. firewall_port_config_script options ;
3052
3057
Db.Host. set_https_only ~__context ~self ~value
3053
3058
| true when value = Db.Host. get_https_only ~__context ~self ->
3054
3059
(* the new value is the same as the old value *)
You can’t perform that action at this time.
0 commit comments