File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -256,23 +256,16 @@ let is_device_underneath_same_type ~__context pif1 pif2 =
256256  get_device_info pif1 =  get_device_info pif2
257257
258258let  get_non_link_ipv6  ~__context  ~pif   = 
259-   let  non_link_ip6s = 
260-     List. map
261-       (fun  ip6  ->
262-         match  Ipaddr.V6.Prefix. of_string ip6 with 
263-         |  Error  _  ->
264-             None 
265-         |  Ok  ip6  ->
266-             let  ip6 =  Ipaddr.V6.Prefix. address ip6 in 
267-             if  Ipaddr.V6. scope ip6 =  Ipaddr. Link  then 
268-               None 
269-             else 
270-               Some  (Ipaddr.V6. to_string ip6)
271-       )
272-       (Db.PIF. get_IPv6 ~__context ~self: pif)
259+   let  valid_nonlink  ipv6  = 
260+     let  open  Ipaddr.V6  in 
261+     ipv6
262+     |>  Prefix. of_string
263+     |>  Result. to_option
264+     |>  Fun. flip Option. bind @@  fun  cidr  ->
265+        let  addr =  Prefix. address cidr in 
266+        match  scope addr with  Ipaddr. Link  ->  None  |  _  ->  Some  (to_string addr)
273267  in 
274-   List. map (Option. fold ~none: " " ~some: Fun. id) non_link_ip6s
275-   |>  List. filter (( <>  ) " " 
268+   List. filter_map valid_nonlink (Db.PIF. get_IPv6 ~__context ~self: pif)
276269
277270let  get_primary_address  ~__context  ~pif   = 
278271  match  Db.PIF. get_primary_address_type ~__context ~self: pif with 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments