@@ -12,36 +12,9 @@ use crate::network::netlink;
1212use crate :: network:: netlink:: Socket ;
1313use ipnet:: IpNet ;
1414use log:: debug;
15- use std:: net:: { IpAddr , Ipv4Addr , Ipv6Addr } ;
15+ use std:: net:: { IpAddr , Ipv4Addr } ;
1616use std:: str:: FromStr ;
1717
18- trait IpConv {
19- fn to_v4 ( & self ) -> Result < & Ipv4Addr , ProxyError > ;
20- fn to_v6 ( & self ) -> Result < & Ipv6Addr , ProxyError > ;
21- }
22-
23- // Simple implementation for converting from IPAddr to
24- // specific IP type
25- impl IpConv for IpAddr {
26- fn to_v4 ( & self ) -> Result < & Ipv4Addr , ProxyError > {
27- match self {
28- IpAddr :: V4 ( ip) => Ok ( ip) ,
29- IpAddr :: V6 ( _) => Err ( ProxyError :: new (
30- "invalid value for ipv4 conversion" . to_string ( ) ,
31- ) ) ,
32- }
33- }
34-
35- fn to_v6 ( & self ) -> Result < & Ipv6Addr , ProxyError > {
36- match self {
37- IpAddr :: V4 ( _) => Err ( ProxyError :: new (
38- "invalid value for ipv6 conversion" . to_string ( ) ,
39- ) ) ,
40- IpAddr :: V6 ( ip) => Ok ( ip) ,
41- }
42- }
43- }
44-
4518/*
4619 Information that came back in the DHCP lease like name_servers,
4720 domain and host names, etc. will be implemented in podman; not here.
@@ -63,7 +36,6 @@ trait Address<T> {
6336 Self : Sized ;
6437 fn add_ip ( & self , nls : & mut Socket ) -> Result < ( ) , ProxyError > ;
6538 fn add_gws ( & self , nls : & mut Socket ) -> Result < ( ) , ProxyError > ;
66- fn remove ( self ) -> Result < ( ) , ProxyError > ;
6739}
6840
6941fn handle_gws ( g : Vec < String > , netmask : & str ) -> Result < Vec < IpNet > , ProxyError > {
@@ -122,7 +94,7 @@ impl Address<Ipv4Addr> for MacVLAN {
12294 let gateways = match handle_gws ( l. gateways . clone ( ) , & l. subnet_mask ) {
12395 Ok ( g) => g,
12496 Err ( e) => {
125- return Err ( ProxyError :: new ( format ! ( "bad gateways: {}" , e. to_string ( ) ) ) ) ;
97+ return Err ( ProxyError :: new ( format ! ( "bad gateways: {}" , e) ) ) ;
12698 }
12799 } ;
128100 let prefix_length = match get_prefix_length_v4 ( & l. subnet_mask ) {
@@ -158,15 +130,6 @@ impl Address<Ipv4Addr> for MacVLAN {
158130 Err ( e) => Err ( ProxyError :: new ( e. to_string ( ) ) ) ,
159131 }
160132 }
161-
162- /*
163- For now, nv will remove the interface; this causes all IP stuff
164- to fold.
165- */
166- fn remove ( self ) -> Result < ( ) , ProxyError > {
167- debug ! ( "removing interface {}" , self . interface) ;
168- todo ! ( )
169- }
170133}
171134
172135// setup takes the DHCP lease and some additional information and
0 commit comments