diff --git a/src/main.rs b/src/main.rs index 6f2a70e..4dc6b62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,6 @@ use types::{Error, Behavior, Type, Range, Table}; use cloud::{TapCloud, TunCloud}; -//TODO: L2 routing //TODO: Implement IPv6 //TODO: Encryption //TODO: Call close diff --git a/src/types.rs b/src/types.rs index 5a2796b..87b4ec2 100644 --- a/src/types.rs +++ b/src/types.rs @@ -52,7 +52,14 @@ impl FromStr for Address { } 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")) } }