Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit b4383fd

Browse files
authored
Change enums to module scoped constants (#20)
Resolves: #19
1 parent b5637ec commit b4383fd

File tree

3 files changed

+33
-314
lines changed

3 files changed

+33
-314
lines changed

crates/tests/benches/csum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn csum_ic(packet: &mut xdp::Packet) -> u16 {
9090

9191
udp_hdr
9292
}
93-
EtherType::Arp => unreachable!(),
93+
_ => unreachable!(),
9494
};
9595

9696
udp_hdr.check = 0;
@@ -152,7 +152,7 @@ fn csum_ep(packet: &mut xdp::Packet) -> u16 {
152152
.unwrap()
153153
.to_be()
154154
}
155-
EtherType::Arp => unreachable!(),
155+
_ => unreachable!(),
156156
}
157157
}
158158

src/packet/csum.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ use crate::packet::net_types as nt;
224224
#[derive(Debug)]
225225
pub enum UdpCalcError {
226226
/// Not an IP packet
227-
NotIp(nt::EtherType),
227+
NotIp(nt::EtherType::Enum),
228228
/// Not a UDP packet
229-
NotUdp(nt::IpProto),
229+
NotUdp(nt::IpProto::Enum),
230230
/// Packet data was invalid/corrupt
231231
Packet(super::PacketError),
232232
}
@@ -350,7 +350,7 @@ impl super::Packet {
350350
(finalize(sum), udp_hdr)
351351
}
352352
}
353-
EtherType::Arp => return Err(UdpCalcError::NotIp(EtherType::Arp)),
353+
invalid => return Err(UdpCalcError::NotIp(invalid)),
354354
};
355355

356356
let checksum = if self.can_offload_checksum() {

0 commit comments

Comments
 (0)