*: downcase log strings

reviewable/pr1357/r15
Tamir Duberstein 2 weeks ago
parent 742f700dcc
commit 75edc3d294
No known key found for this signature in database

@ -435,7 +435,7 @@ impl<'a> EbpfLoader<'a> {
}
}
warn!("Object BTF couldn't be loaded in the kernel: {err}");
warn!("object BTF couldn't be loaded in the kernel: {err}");
None
}

@ -143,7 +143,7 @@ impl MapInfo {
/// for m in loaded_maps() {
/// match m {
/// Ok(map) => println!("{:?}", map.name_as_str()),
/// Err(e) => println!("Error iterating maps: {:?}", e),
/// Err(e) => println!("error iterating maps: {:?}", e),
/// }
/// }
/// ```

@ -73,7 +73,7 @@ use crate::{
/// let mut guard = poll.readable();
/// let ring_buf = guard.inner_mut();
/// while let Some(item) = ring_buf.next() {
/// println!("Received: {:?}", item);
/// println!("received: {:?}", item);
/// }
/// guard.clear_ready();
/// }

@ -270,7 +270,7 @@ pub(crate) use impl_info;
/// for p in loaded_programs() {
/// match p {
/// Ok(program) => println!("{}", String::from_utf8_lossy(program.name())),
/// Err(e) => println!("Error iterating programs: {:?}", e),
/// Err(e) => println!("error iterating programs: {:?}", e),
/// }
/// }
/// ```

@ -1209,7 +1209,7 @@ impl_info!(
///
/// for info in loaded_links() {
/// if let Ok(info) = info {
/// println!("Loaded link: {}", info.id());
/// println!("loaded link: {}", info.id());
/// }
/// }
/// ```

@ -28,7 +28,7 @@ use crate::{
/// match is_program_supported(ProgramType::Xdp) {
/// Ok(true) => println!("XDP supported :)"),
/// Ok(false) => println!("XDP not supported :("),
/// Err(err) => println!("Uh oh! Unexpected error while probing: {:?}", err),
/// Err(err) => println!("unexpected error while probing: {:?}", err),
/// }
/// ```
///
@ -169,7 +169,7 @@ pub fn is_program_supported(program_type: ProgramType) -> Result<bool, ProgramEr
/// match is_map_supported(MapType::HashOfMaps) {
/// Ok(true) => println!("hash_of_maps supported :)"),
/// Ok(false) => println!("hash_of_maps not supported :("),
/// Err(err) => println!("Uh oh! Unexpected error while probing: {:?}", err),
/// Err(err) => println!("unexpected error while probing: {:?}", err),
/// }
/// ```
///

@ -67,7 +67,7 @@ fn use_map_with_rbpf() {
"map_1" => 0,
"map_2" => 1,
"map_pin_by_name" => 2,
n => panic!("Unexpected map: {n}"),
n => panic!("unexpected map: {n}"),
};
let fd = map_id as i32 | 0xCAFE00;

@ -24,50 +24,50 @@ impl NetNsGuard {
let pid = process::id();
let name = format!("aya-test-{pid}-{}", COUNTER.fetch_add(1, Ordering::Relaxed));
// Create and enter netns
let ns = NetNs::new(&name).unwrap_or_else(|e| panic!("Failed to create netns {name}: {e}"));
let netns = Self {
let ns = NetNs::new(&name).unwrap_or_else(|e| panic!("failed to create netns {name}: {e}"));
ns.enter()
.unwrap_or_else(|e| panic!("failed to enter network namespace {name}: {e}"));
println!("entered network namespace {name}");
let ns = Self {
old_ns,
ns: Some(ns),
name,
};
let ns = netns.ns.as_ref().unwrap();
ns.enter()
.unwrap_or_else(|e| panic!("Failed to enter network namespace {}: {e}", netns.name));
println!("Entered network namespace {}", netns.name);
// By default, the loopback in a new netns is down. Set it up.
let lo = CString::new("lo").unwrap();
unsafe {
let idx = if_nametoindex(lo.as_ptr());
if idx == 0 {
panic!(
"Interface `lo` not found in netns {}: {}",
netns.name,
"interface `lo` not found in netns {}: {}",
ns.name,
io::Error::last_os_error()
);
}
netlink_set_link_up(idx as i32)
.unwrap_or_else(|e| panic!("Failed to set `lo` up in netns {}: {e}", netns.name));
.unwrap_or_else(|e| panic!("failed to set `lo` up in netns {}: {e}", ns.name));
}
netns
ns
}
}
impl Drop for NetNsGuard {
fn drop(&mut self) {
// Avoid panic in panic
if let Err(e) = self.old_ns.enter() {
eprintln!("Failed to return to original netns: {e}");
let Self { old_ns, ns, name } = self;
// Avoid panic in panic.
if let Err(e) = old_ns.enter() {
eprintln!("failed to return to original netns: {e}");
}
if let Some(ns) = self.ns.take() {
if let Some(ns) = ns.take() {
if let Err(e) = ns.remove() {
eprintln!("Failed to remove netns {}: {e}", self.name);
eprintln!("failed to remove netns {name}: {e}");
}
}
println!("Exited network namespace {}", self.name);
println!("exited network namespace {name}");
}
}

Loading…
Cancel
Save