Skip to content

update deps; libnet in particular #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 5 additions & 11 deletions ddm/src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dendrite_common::ports::RearPort;
use dpd_client::types;
use dpd_client::Client;
use dpd_client::ClientState;
use libnet::{IpPrefix, Ipv4Prefix, Ipv6Prefix};
use libnet::{IpNet, Ipv4Net, Ipv6Net};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use slog::Logger;
Expand Down Expand Up @@ -94,17 +94,11 @@ impl From<Route> for libnet::route::Route {
}
}

impl From<Route> for IpPrefix {
fn from(r: Route) -> IpPrefix {
impl From<Route> for IpNet {
fn from(r: Route) -> IpNet {
match r.dest {
IpAddr::V4(a) => IpPrefix::V4(Ipv4Prefix {
addr: a,
mask: r.prefix_len,
}),
IpAddr::V6(a) => IpPrefix::V6(Ipv6Prefix {
addr: a,
mask: r.prefix_len,
}),
IpAddr::V4(a) => Ipv4Net::new(a, r.prefix_len).unwrap().into(),
IpAddr::V6(a) => Ipv6Net::new(a, r.prefix_len).unwrap().into(),
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions mg-lower/src/dendrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use dpd_client::Client as DpdClient;
use dpd_client::Ipv4Cidr;
use dpd_client::Ipv6Cidr;
use http::StatusCode;
use libnet::Ipv6Prefix;
use libnet::{get_route, IpPrefix, Ipv4Prefix};
use libnet::{get_route, IpNet};
use rdb::Path;
use rdb::Prefix;
use slog::{error, warn, Logger};
Expand Down Expand Up @@ -333,10 +332,7 @@ fn test_tfport_parser() {
fn get_port_and_link(
nexthop: IpAddr,
) -> Result<(PortId, types::LinkId), Error> {
let prefix = match nexthop {
IpAddr::V4(addr) => IpPrefix::V4(Ipv4Prefix { addr, mask: 32 }),
IpAddr::V6(addr) => IpPrefix::V6(Ipv6Prefix { addr, mask: 128 }),
};
let prefix = IpNet::host_net(nexthop);
let sys_route = get_route(prefix, Some(Duration::from_secs(1)))?;

let ifname = match sys_route.ifx {
Expand Down