L2 routing

This commit is contained in:
Dennis Schwerdel 2015-11-23 01:48:50 +01:00
parent 30fab51be6
commit c5d072fa13
2 changed files with 8 additions and 2 deletions

View File

@ -25,7 +25,6 @@ use types::{Error, Behavior, Type, Range, Table};
use cloud::{TapCloud, TunCloud}; use cloud::{TapCloud, TunCloud};
//TODO: L2 routing
//TODO: Implement IPv6 //TODO: Implement IPv6
//TODO: Encryption //TODO: Encryption
//TODO: Call close //TODO: Call close

View File

@ -52,7 +52,14 @@ impl FromStr for Address {
} }
return Ok(Address(res)); return Ok(Address(res));
} }
//FIXME: implement for mac addresses let parts: Vec<&str> = text.split(':').collect();
if parts.len() == 6 {
let mut bytes = Vec::with_capacity(6);
for i in 0..6 {
bytes.push(try!(u8::from_str_radix(&parts[i], 16).map_err(|_| Error::ParseError("Failed to parse mac"))));
}
return Ok(Address(bytes));
}
return Err(Error::ParseError("Failed to parse address")) return Err(Error::ParseError("Failed to parse address"))
} }
} }