+This started as a tool for easily creating new ng_eiface nodes conneced to a named ng_bridge, for use as part of a custom jail setup with networking provided via Netgraph. Bindgen is used to wrap the Netgraph API, and and Rust wrappers have been written for part of the API. Given a Netgraph path, the tool will check that it is a bridge, find the first available link# hook, attach a new ng_eiface's ether hook to it, and return the interface name of the new ng_eiface. This interface can then be given to a jail via vnet, optionally renaming the interface and/or node for convenience.
diff --git a/build.rs b/crates/ng/build.rs
similarity index 87%
rename from build.rs
rename to crates/ng/build.rs
index 9e20d8f..62ad211 100644
--- a/build.rs
+++ b/crates/ng/build.rs
@@ -1,34 +1,34 @@
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
// Tell cargo to tell rustc to link the system bzip2
// shared library.
println!("cargo:rustc-link-lib=netgraph");
// Tell cargo to invalidate the built crate whenever the wrapper changes
unsafe { ng_send_msg(csock, &cpath, NGM_GENERIC_COOKIE as c_int, NGM_MKPEER as c_int, pnewpeer as *const c_void, size_of::<ngm_mkpeer>() as u64).map_err(Error::SystemError)? };
unsafe { ng_send_msg(csock, &cfrom_path, NGM_GENERIC_COOKIE as c_int, NGM_CONNECT as c_int, pconnect_msg as *const c_void, size_of::<ngm_connect>() as u64).map_err(Error::SystemError)? };