diff --git a/nl-sys/src/bridge.c b/nl-sys/src/bridge.c index 7cabed6..c03b2f5 100644 --- a/nl-sys/src/bridge.c +++ b/nl-sys/src/bridge.c @@ -19,7 +19,4 @@ int netlink_route() { return NETLINK_ROUTE; -} -int netlink_fib_lookup() { - return NETLINK_FIB_LOOKUP; } \ No newline at end of file diff --git a/nl-sys/src/lib.rs b/nl-sys/src/lib.rs index 9335930..e8bcda8 100644 --- a/nl-sys/src/lib.rs +++ b/nl-sys/src/lib.rs @@ -13,8 +13,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use std::net::Ipv4Addr; - pub mod nl_ffi; pub mod netlink; pub mod route; @@ -23,7 +21,6 @@ pub mod error; // from bridge.c extern "C" { pub(crate) fn netlink_route() -> libc::c_int; - pub(crate) fn netlink_fib_lookup() -> libc::c_int; } /* fn main() -> error::Result<()> { diff --git a/nl-sys/src/netlink.rs b/nl-sys/src/netlink.rs index dc8817d..2fead51 100644 --- a/nl-sys/src/netlink.rs +++ b/nl-sys/src/netlink.rs @@ -23,22 +23,8 @@ pub struct Socket { pub(crate) sock: *mut nl_sock } -pub enum SocketType { - Routing, - Lookup -} - -impl SocketType { - pub fn to_proto(&self) -> i32 { - unsafe { match self { - Self::Routing => crate::netlink_route(), - Self::Lookup => crate::netlink_fib_lookup() - } } - } -} - impl Socket { - pub fn new(stype: SocketType) -> error::Result { + pub fn new() -> error::Result { unsafe { let sock = Socket { sock: nl_socket_alloc() }; @@ -124,13 +110,6 @@ where } impl> Cache { - pub(crate) fn new(cache: *mut nl_cache) -> Cache { - Cache { - cache, - dt: PhantomData - } - } - pub fn iter(&self) -> CacheIter<'_, T> { let cache_size = unsafe { nl_cache_nitems(self.cache) diff --git a/nl-sys/src/route.rs b/nl-sys/src/route.rs index 29575c2..e3fdf4f 100644 --- a/nl-sys/src/route.rs +++ b/nl-sys/src/route.rs @@ -15,9 +15,9 @@ use std::{ffi::{CStr, CString}, net::Ipv4Addr}; -use libc::{c_int, AF_INET, AF_UNIX, AF_UNSPEC, c_uint}; +use libc::{c_int, AF_INET, c_uint}; -use crate::{error, netlink::{Cache, Socket}}; +use crate::{error, netlink::Cache}; use super::nl_ffi::*;