Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dataplane/src/packet_processor/ipforward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ impl IpForwarder {
net_ext: ArrayVec::default(),
transport: None, /* should be UDP, but it is automatically done */
udp_encap: Some(udp_encap),
embedded_ip: None,
};
VxlanEncap::new(headers).map_err(|e| format!("{e}"))
}
Expand Down
19 changes: 11 additions & 8 deletions net/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::eth::mac::{
use crate::headers::Header;
use crate::ipv4::Ipv4;
use crate::ipv6::Ipv6;
use crate::parse::{DeParse, DeParseError, LengthError, Parse, ParseError, ParsePayload, Reader};
use crate::parse::{DeParse, DeParseError, LengthError, Parse, ParseError, Reader};
use crate::vlan::Vlan;
use etherparse::{EtherType, Ethernet2Header};
use std::num::NonZero;
Expand Down Expand Up @@ -96,6 +96,16 @@ impl Eth {
self.0.ether_type = ether_type.0;
self
}

/// Parse the payload of the ethernet header.
///
/// # Returns
///
/// * `Some(EthNext)` variant if the payload is successfully parsed.
/// * `None` if the payload is not a known Ethernet type.
pub(crate) fn parse_payload(&self, cursor: &mut Reader) -> Option<EthNext> {
parse_from_ethertype(self.0.ether_type, cursor)
}
}

impl Parse for Eth {
Expand Down Expand Up @@ -204,13 +214,6 @@ pub(crate) enum EthNext {
Ipv6(Ipv6),
}

impl ParsePayload for Eth {
type Next = EthNext;
fn parse_payload(&self, cursor: &mut Reader) -> Option<EthNext> {
parse_from_ethertype(self.0.ether_type, cursor)
}
}

impl From<EthNext> for Header {
fn from(value: EthNext) -> Self {
match value {
Expand Down
Loading
Loading