-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from reticulis/sll2
Add LINKTYPE_LINUX_SLL2 support and fix link to SLL
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,7 @@ pub mod tcp; | |
pub mod udp; | ||
pub mod usbpcap; | ||
pub mod vlan; | ||
pub mod sll; | ||
pub mod sll2; | ||
|
||
pub mod util; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//! A Linux cooked-mode capture v2 (LINKTYPE_LINUX_SLL2) packet abstraction. | ||
// ref: https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL2.html | ||
|
||
use alloc::vec::Vec; | ||
|
||
use pnet_macros::packet; | ||
use pnet_macros_support::types::*; | ||
|
||
use super::ethernet::EtherType; | ||
|
||
/// Represents an SLL2 packet (LINKTYPE_LINUX_SLL2). | ||
#[packet] | ||
pub struct SLL2 { | ||
#[construct_with(u16)] | ||
pub protocol_type: EtherType, | ||
|
||
#[construct_with(u16)] | ||
pub reserverd: u16be, | ||
|
||
#[construct_with(u32)] | ||
pub interface_index: u32be, | ||
|
||
#[construct_with(u16)] | ||
pub arphrd_type: u16be, | ||
|
||
#[construct_with(u8)] | ||
pub packet_type: u8, | ||
|
||
#[construct_with(u8)] | ||
pub link_layer_address_length: u8, | ||
|
||
#[construct_with(u8, u8, u8, u8, u8, u8, u8, u8)] | ||
#[length = "8"] | ||
pub link_layer_address: Vec<u8>, | ||
|
||
#[payload] | ||
pub payload: Vec<u8> | ||
} |