Skip to content
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

Assorted cleanup #630

Merged
merged 1 commit into from Jul 19, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -32,7 +32,7 @@ pnet_transport = { path = "pnet_transport", version = "0.33.0", optional = true,
pnet_packet = { path = "pnet_packet", version = "0.33.0", default-features = false }

[dev-dependencies]
time = "0.3.17"
time = "0.3.23"

[[example]]
name = "arp_packet"
Expand Down
4 changes: 2 additions & 2 deletions pnet_base/Cargo.toml
Expand Up @@ -13,10 +13,10 @@ edition = "2021"

[dependencies]
no-std-net = { version = "0.6.0", default-features = false }
serde = { version = "1.0.152", optional = true, default-features = false }
serde = { version = "1.0.171", optional = true, default-features = false }

[dev-dependencies]
serde_test = "1.0.152"
serde_test = "1.0.171"

[features]
std = ["no-std-net/std"]
Expand Down
2 changes: 2 additions & 0 deletions pnet_base/src/lib.rs
Expand Up @@ -6,6 +6,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(warnings)]

#![cfg_attr(all(not(test), not(feature = "std")), no_std)]

#[cfg(feature = "serde")]
Expand Down
6 changes: 3 additions & 3 deletions pnet_datalink/Cargo.toml
Expand Up @@ -17,14 +17,14 @@ std = ["pnet_base/std"]
default = ["std"]

[dependencies]
libc = "0.2.139"
libc = "0.2.147"
ipnetwork = "0.20.0"
pnet_base = { path = "../pnet_base", version = "0.33.0", default-features = false }
pnet_sys = { path = "../pnet_sys", version = "0.33.0" }

pcap = { version = "1.0.0", optional = true }
pcap = { version = "1.1.0", optional = true }
netmap_sys = { version = "0.1.4", optional = true, features = ["netmap_with_libs"] }
serde = { version = "1.0.152", optional = true, default-features = false, features = [ "derive" ] }
serde = { version = "1.0.171", optional = true, default-features = false, features = [ "derive" ] }

[target.'cfg(windows)'.dependencies]
winapi = "0.3.9"
Expand Down
2 changes: 2 additions & 0 deletions pnet_datalink/src/lib.rs
Expand Up @@ -8,6 +8,8 @@

//! Support for sending and receiving data link layer packets.

#![deny(warnings)]

extern crate ipnetwork;
extern crate libc;
extern crate pnet_base;
Expand Down
10 changes: 5 additions & 5 deletions pnet_macros/Cargo.toml
Expand Up @@ -20,10 +20,10 @@ travis = []

[dev-dependencies]
pnet_macros_support = { path = "../pnet_macros_support", version = "0.33.0" }
trybuild = "1.0.77"
trybuild = "1.0.81"

[dependencies]
proc-macro2 = "1.0.50"
quote = "1.0.23"
syn = { version = "2.0.25", features = ["full"] }
regex = "1.7.1"
proc-macro2 = "1.0.66"
quote = "1.0.31"
syn = { version = "2.0.26", features = ["full"] }
regex = "1.9.1"
4 changes: 1 addition & 3 deletions pnet_macros/src/lib.rs
Expand Up @@ -136,9 +136,7 @@
//! `#[construct_with(...)]` attribute, and in the `new` method.

#![deny(missing_docs)]
// #![cfg_attr(feature = "clippy", feature(plugin))]
// #![cfg_attr(feature = "clippy", plugin(clippy))]
// #![cfg_attr(feature = "clippy", allow(let_and_return))]
#![deny(warnings)]

use proc_macro::TokenStream;
use quote::quote;
Expand Down
1 change: 1 addition & 0 deletions pnet_macros_support/src/lib.rs
Expand Up @@ -11,6 +11,7 @@
//! This exists to remove the need for the plugin_as_library feature, and allow for static linking.

#![deny(missing_docs)]
#![deny(warnings)]
#![no_std]

extern crate pnet_base;
Expand Down
4 changes: 2 additions & 2 deletions pnet_macros_support/src/packet.rs
Expand Up @@ -39,12 +39,12 @@ impl<T: Packet> Packet for alloc::boxed::Box<T> {
impl<T: Packet> Packet for &T {
/// Retrieve the underlying buffer for the packet.
fn packet(&self) -> &[u8] {
self.deref().packet()
(*self).packet()
}

/// Retrieve the payload for the packet.
fn payload(&self) -> &[u8] {
self.deref().payload()
(*self).payload()
}
}

Expand Down
2 changes: 1 addition & 1 deletion pnet_packet/Cargo.toml
Expand Up @@ -22,7 +22,7 @@ default = ["std"]

[dev-dependencies]
hex = "0.4.3"
criterion = { version = "0.4.0", features = ["html_reports"] } #added HTML feature becuase of the annoying warnings when running the tests
criterion = { version = "0.5.1", features = ["html_reports"] } #added HTML feature becuase of the annoying warnings when running the tests

[build-dependencies]
glob = "0.3.1"
Expand Down
1 change: 1 addition & 0 deletions pnet_packet/src/lib.rs
Expand Up @@ -8,6 +8,7 @@

//! Provides interfaces for interacting with packets and headers.
#![allow(missing_docs)]
#![deny(warnings)]
#![no_std]
#![macro_use]

Expand Down
2 changes: 1 addition & 1 deletion pnet_packet/src/sll2.rs
Expand Up @@ -15,7 +15,7 @@ pub struct SLL2 {
pub protocol_type: EtherType,

#[construct_with(u16)]
pub reserverd: u16be,
pub reserved: u16be,

#[construct_with(u32)]
pub interface_index: u32be,
Expand Down
2 changes: 1 addition & 1 deletion pnet_sys/Cargo.toml
Expand Up @@ -12,7 +12,7 @@ categories = ["network-programming"]
edition = "2021"

[dependencies]
libc = "0.2.139"
libc = "0.2.147"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = [ "winsock2", "ws2ipdef" ] }
1 change: 1 addition & 0 deletions pnet_sys/src/lib.rs
Expand Up @@ -6,6 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(warnings)]
extern crate libc;

use std::io;
Expand Down
4 changes: 2 additions & 2 deletions pnet_sys/src/windows.rs
Expand Up @@ -71,7 +71,7 @@ pub mod public {

pub fn make_in6_addr(segments: [u16; 8]) -> In6Addr {
unsafe {
let mut val: In6Addr = mem::MaybeUninit::uninit().assume_init();
let mut val: In6Addr = mem::zeroed();
*val.u.Word_mut() = [
htons(segments[0]),
htons(segments[1]),
Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn ipv4_addr(addr: InAddr) -> u32 {
#[inline(always)]
pub fn mk_inaddr(addr: u32) -> InAddr {
unsafe {
let mut val: InAddr = mem::MaybeUninit::uninit().assume_init();
let mut val: InAddr = mem::zeroed();
*val.S_un.S_addr_mut() = addr as minwindef::ULONG;

val
Expand Down
2 changes: 1 addition & 1 deletion pnet_transport/Cargo.toml
Expand Up @@ -12,7 +12,7 @@ categories = ["network-programming"]
edition = "2021"

[dependencies]
libc = "0.2.139"
libc = "0.2.147"
pnet_base = { path = "../pnet_base", version = "0.33.0", default-features = false }
pnet_sys = { path = "../pnet_sys", version = "0.33.0" }
pnet_packet = { path = "../pnet_packet", version = "0.33.0" }
Expand Down
3 changes: 3 additions & 0 deletions pnet_transport/src/lib.rs
Expand Up @@ -16,6 +16,7 @@
//! X and FreeBSD, it is impossible to implement protocols which are already
//! implemented in the kernel such as TCP and UDP.

#![deny(warnings)]
#![macro_use]

extern crate libc;
Expand All @@ -34,10 +35,12 @@ use pnet_packet::Packet;

use std::io;
use std::io::Error;
#[cfg(unix)]
use std::io::ErrorKind;
use std::mem;
use std::net::{self, IpAddr};
use std::sync::Arc;
#[cfg(unix)]
use std::time::Duration;

/// Represents a transport layer protocol.
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Expand Up @@ -7,6 +7,8 @@
// except according to those terms.

#![deny(missing_docs)]
#![deny(warnings)]

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(custom_attribute, plugin))]
#![cfg_attr(feature = "nightly", plugin(pnet_macros_plugin))]
Expand All @@ -15,7 +17,6 @@
#![cfg_attr(feature = "clippy", plugin(clippy))]
// We can't implement Iterator since we use streaming iterators
#![cfg_attr(feature = "clippy", allow(should_implement_trait))]
#![cfg_attr(any(feature = "appveyor", feature = "travis"), deny(warnings))]

//! # libpnet
//!
Expand Down