@@ -342,6 +342,8 @@ pub struct NetworkInterface {
342342 pub mac : String ,
343343 /// IP address.
344344 pub ip : String ,
345+ /// IP prefix.
346+ pub prefix : String ,
345347 /// Interface speed.
346348 pub speed : Option < String > ,
347349 /// Interface type.
@@ -2621,6 +2623,7 @@ impl ServerInfo {
26212623 name : name. clone ( ) ,
26222624 mac : data. get ( "mac" ) . cloned ( ) . unwrap_or ( "Unknown" . to_string ( ) ) ,
26232625 ip : data. get ( "ip" ) . cloned ( ) . unwrap_or ( "Unknown" . to_string ( ) ) ,
2626+ prefix : data. get ( "prefix" ) . cloned ( ) . unwrap_or ( "Unknown" . to_string ( ) ) ,
26242627 speed : Self :: estimate_macos_interface_speed ( & name, & interface_type) ,
26252628 type_ : interface_type,
26262629 vendor : vendor. to_string ( ) ,
@@ -2684,6 +2687,10 @@ impl ServerInfo {
26842687 . get ( "ip" )
26852688 . cloned ( )
26862689 . unwrap_or ( "Unknown" . to_string ( ) ) ,
2690+ prefix : ifconfig_info
2691+ . get ( "prefix" )
2692+ . cloned ( )
2693+ . unwrap_or ( "Unknown" . to_string ( ) ) ,
26872694 speed : Self :: estimate_macos_interface_speed ( name, & interface_type) ,
26882695 type_ : interface_type,
26892696 vendor : vendor. to_string ( ) ,
@@ -2900,12 +2907,14 @@ impl ServerInfo {
29002907
29012908 let mac = iface[ "address" ] . as_str ( ) . unwrap_or ( "" ) . to_string ( ) ;
29022909 let mut ip = String :: new ( ) ;
2910+ let mut prefix: String = String :: new ( ) ;
29032911
29042912 // Get IP address
29052913 if let Some ( addr_info) = iface[ "addr_info" ] . as_array ( ) {
29062914 for addr in addr_info {
29072915 if addr[ "family" ] . as_str ( ) == Some ( "inet" ) {
29082916 ip = addr[ "local" ] . as_str ( ) . unwrap_or ( "" ) . to_string ( ) ;
2917+ prefix = addr[ "prefixlen" ] . as_str ( ) . unwrap_or ( "" ) . to_string ( ) ;
29092918 break ;
29102919 }
29112920 }
@@ -2950,6 +2959,7 @@ impl ServerInfo {
29502959 name : name. to_string ( ) ,
29512960 mac,
29522961 ip,
2962+ prefix,
29532963 speed,
29542964 type_ : iface[ "link_type" ] . as_str ( ) . unwrap_or ( "" ) . to_string ( ) ,
29552965 vendor,
0 commit comments