瀏覽代碼

Fix IP enum names

thegreathir 1 年之前
父節點
當前提交
19e962f5fc
共有 3 個文件被更改,包括 9 次插入9 次删除
  1. 2 2
      src/iface/interface/tests/ipv6.rs
  2. 4 4
      src/wire/ip.rs
  3. 3 3
      src/wire/ipsec_ah.rs

+ 2 - 2
src/iface/interface/tests/ipv6.rs

@@ -12,8 +12,8 @@ fn parse_ipv6(data: &[u8]) -> crate::wire::Result<IpPacket<'_>> {
         IpProtocol::Udp => todo!(),
         IpProtocol::Ipv6Route => todo!(),
         IpProtocol::Ipv6Frag => todo!(),
-        IpProtocol::Esp => todo!(),
-        IpProtocol::Ah => todo!(),
+        IpProtocol::IpSecEsp => todo!(),
+        IpProtocol::IpSecAh => todo!(),
         IpProtocol::Icmpv6 => {
             let icmp = Icmpv6Repr::parse(
                 &ipv6.src_addr.into(),

+ 4 - 4
src/wire/ip.rs

@@ -55,8 +55,8 @@ enum_with_unknown! {
         Udp       = 0x11,
         Ipv6Route = 0x2b,
         Ipv6Frag  = 0x2c,
-        Esp       = 0x32,
-        Ah        = 0x33,
+        IpSecEsp  = 0x32,
+        IpSecAh   = 0x33,
         Icmpv6    = 0x3a,
         Ipv6NoNxt = 0x3b,
         Ipv6Opts  = 0x3c
@@ -73,8 +73,8 @@ impl fmt::Display for Protocol {
             Protocol::Udp => write!(f, "UDP"),
             Protocol::Ipv6Route => write!(f, "IPv6-Route"),
             Protocol::Ipv6Frag => write!(f, "IPv6-Frag"),
-            Protocol::Esp => write!(f, "IPsec-ESP"),
-            Protocol::Ah => write!(f, "IPsec-AH"),
+            Protocol::IpSecEsp => write!(f, "IPsec-ESP"),
+            Protocol::IpSecAh => write!(f, "IPsec-AH"),
             Protocol::Icmpv6 => write!(f, "ICMPv6"),
             Protocol::Ipv6NoNxt => write!(f, "IPv6-NoNxt"),
             Protocol::Ipv6Opts => write!(f, "IPv6-Opts"),

+ 3 - 3
src/wire/ipsec_ah.rs

@@ -220,7 +220,7 @@ mod test {
     #[test]
     fn test_deconstruct() {
         let packet = Packet::new_unchecked(&PACKET_BYTES1[..]);
-        assert_eq!(packet.next_header(), IpProtocol::Esp);
+        assert_eq!(packet.next_header(), IpProtocol::IpSecEsp);
         assert_eq!(packet.payload_len(), 4);
         assert_eq!(packet.security_parameters_index(), 0x8179b705);
         assert_eq!(packet.sequence_number(), 1);
@@ -234,7 +234,7 @@ mod test {
     fn test_construct() {
         let mut bytes = vec![0xa5; 24];
         let mut packet = Packet::new_unchecked(&mut bytes);
-        packet.set_next_header(IpProtocol::Esp);
+        packet.set_next_header(IpProtocol::IpSecEsp);
         packet.set_payload_len(4);
         packet.clear_reserved();
         packet.set_security_parameters_index(0xba8bd060);
@@ -254,7 +254,7 @@ mod test {
 
     fn packet_repr<'a>() -> Repr<'a> {
         Repr {
-            next_header: IpProtocol::Esp,
+            next_header: IpProtocol::IpSecEsp,
             security_parameters_index: 0xba8bd060,
             sequence_number: 1,
             integrity_check_value: &[