Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6527dbe6c5
@ -169,7 +169,7 @@ mod tests {
|
|||||||
let invalid_rcodes = [11, 12, 13, 14, 15];
|
let invalid_rcodes = [11, 12, 13, 14, 15];
|
||||||
|
|
||||||
for rcode in invalid_rcodes {
|
for rcode in invalid_rcodes {
|
||||||
dns_query[3] = (rcode as u8) << 0;
|
dns_query[3] = rcode;
|
||||||
|
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for (rcode, parsed_rcode) in valid_rcodes {
|
for (rcode, parsed_rcode) in valid_rcodes {
|
||||||
dns_query[3] = rcode << 0;
|
dns_query[3] = rcode;
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_result?.response_code, parsed_rcode,
|
parse_result?.response_code, parsed_rcode,
|
||||||
@ -362,7 +362,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.authorative_answer, true);
|
assert!(parse_result?.authorative_answer);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.authorative_answer, false);
|
assert!(!parse_result?.authorative_answer);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.truncated, true);
|
assert!(parse_result?.truncated);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.truncated, false);
|
assert!(!parse_result?.truncated);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.recursion_desired, true);
|
assert!(parse_result?.recursion_desired);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.recursion_desired, false);
|
assert!(!parse_result?.recursion_desired);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.recursion_available, true);
|
assert!(parse_result?.recursion_available);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ mod tests {
|
|||||||
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(parse_result?.recursion_available, false);
|
assert!(!parse_result?.recursion_available);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user