Skip to content

Commit

Permalink
Actually build with latest stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtcollins committed Sep 4, 2017
1 parent 2976e37 commit 883c1c8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["Robert Collins <[email protected]>"]

[dependencies]
libc="*"
ipnetwork = "*"
pnetlink= { version="*", git = "https://github.com/rbtcollins/pnetlink" }
siphasher = "~0.1"

Expand All @@ -18,11 +19,11 @@ git = "https://github.com/rbtcollins/netmap-rs"
#features = ["netmap_with_libs"]

[dependencies.pnet]
version = "0.13.0"
version = ">=0.19.0"
#features = ["netmap"]

[replace]
"pnet:0.12.0" = { path = "../libpnet" }
"pnet:0.13.0" = { path = "../libpnet" }
"pnet_macros:0.11.0" = { path = "../libpnet/pnet_macros" }
"pnet_macros_support:0.1.1" = { path = "../libpnet/pnet_macros_support" }
#[replace]
#"pnet:0.12.0" = { path = "../libpnet" }
#"pnet:0.13.0" = { path = "../libpnet" }
#"pnet_macros:0.11.0" = { path = "../libpnet/pnet_macros" }
#"pnet_macros_support:0.1.1" = { path = "../libpnet/pnet_macros_support" }
9 changes: 6 additions & 3 deletions src/arpcache.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright (c) 2016 Robert Collins. Licensed under the Apache-2.0 license.
use std::collections::BTreeMap;
use std::net::Ipv4Addr;
use std::net::{Ipv4Addr, IpAddr};
#[cfg(test)]
use std::str::FromStr;
use std::time::{Duration, SystemTime};

use pnet::util::MacAddr;
use pnetlink::packet::netlink::NetlinkConnection;
use pnetlink::packet::route::addr::IpAddr;
use pnetlink::packet::route::link::Link;

#[cfg(test)]
use pnetlink::packet::route::link::Links;
use pnetlink::packet::route::neighbour::{Neighbour, Neighbours};
#[cfg(test)]
use pnetlink::packet::route::neighbour::Neighbour;
use pnetlink::packet::route::neighbour::Neighbours;

pub struct CacheEntry {
pub mac: MacAddr,
Expand Down
2 changes: 0 additions & 2 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::collections::BTreeMap;
use std::net::Ipv4Addr;
use std::str::FromStr;

use pnet::util::MacAddr;

use super::error;
use super::consistenthash::{Backend, ConsistentHash};

Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ fn examine_one<'a>(rx_slot_buf: RxSlotBuf, routes:&ConsistentHash) -> Result<Dir

} else {
println!("Failed to process GRE packet");
// in future perhaps forward to host?
return Ok(Direction::Drop);
}
// Drop (in future forward
// println!("packet {:?}",
// ip.get_next_level_protocol())
return Ok(Direction::Drop);
}
// Forward non-GRE
_ => return Ok(Direction::Destination),
Expand Down
15 changes: 8 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2016 Robert Collins. Licensed under the Apache-2.0 license.
extern crate libc;

extern crate ipnetwork;
extern crate netmap;
extern crate pnet;
extern crate pnetlink;
Expand All @@ -12,6 +13,7 @@ use std::env;
use std::io;
use std::net::{IpAddr, Ipv4Addr};

use ipnetwork::IpNetwork;
// use netmap::Direction;
use pnet::datalink::{interfaces, NetworkInterface};

Expand Down Expand Up @@ -80,12 +82,10 @@ fn device_name(device: &String, suffix: &str) -> String {

fn extract_ipv4(interface: &NetworkInterface) -> Result<Ipv4Addr, BrokenRail> {

if let Some(ref ips) = interface.ips {
for ip in ips {
if let &IpAddr::V4(ipv4) = ip {
println!("{}", ip);
return Ok(ipv4);
}
for ip in &interface.ips {
if let &IpNetwork::V4(netv4) = ip {
println!("{}", netv4);
return Ok(netv4.ip());
}
}
return Err(BrokenRail::NoIPV4Address);
Expand All @@ -99,7 +99,8 @@ fn stuff() -> Result<(), BrokenRail> {
let interface_names_match = {
|iface: &NetworkInterface| iface.name == config.device
};
let interface = interfaces().into_iter()
let interface = interfaces()
.into_iter()
.filter(interface_names_match)
.next()
.unwrap();
Expand Down
1 change: 0 additions & 1 deletion src/primes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2017 Robert Collins. Licensed under the Apache-2.0 license.
//
// Used in implementing the maglev consistent hash.
extern crate netmap;

#[test]
fn examples() {
Expand Down

0 comments on commit 883c1c8

Please sign in to comment.