Merge "Revert^2 "[ST02.2] Use the getters of DnsHeader""

This commit is contained in:
Junyu Lai
2022-09-22 02:39:42 +00:00
committed by Gerrit Code Review
3 changed files with 5 additions and 5 deletions

View File

@@ -1762,7 +1762,7 @@ public class EthernetTetheringTest {
final TestDnsPacket dnsQuery = TestDnsPacket.getTestDnsPacket(buf); final TestDnsPacket dnsQuery = TestDnsPacket.getTestDnsPacket(buf);
assertNotNull(dnsQuery); assertNotNull(dnsQuery);
Log.d(TAG, "Forwarded UDP source port: " + udpHeader.srcPort + ", DNS query id: " Log.d(TAG, "Forwarded UDP source port: " + udpHeader.srcPort + ", DNS query id: "
+ dnsQuery.getHeader().id); + dnsQuery.getHeader().getId());
// [2] Send DNS reply. // [2] Send DNS reply.
// DNS server --> upstream --> dnsmasq forwarding --> downstream --> tethered device // DNS server --> upstream --> dnsmasq forwarding --> downstream --> tethered device
@@ -1772,7 +1772,7 @@ public class EthernetTetheringTest {
final Inet4Address remoteIp = (Inet4Address) TEST_IP4_DNS; final Inet4Address remoteIp = (Inet4Address) TEST_IP4_DNS;
final Inet4Address tetheringUpstreamIp = (Inet4Address) TEST_IP4_ADDR.getAddress(); final Inet4Address tetheringUpstreamIp = (Inet4Address) TEST_IP4_ADDR.getAddress();
sendDownloadPacketDnsV4(remoteIp, tetheringUpstreamIp, DNS_PORT, sendDownloadPacketDnsV4(remoteIp, tetheringUpstreamIp, DNS_PORT,
(short) udpHeader.srcPort, (short) dnsQuery.getHeader().id, tester); (short) udpHeader.srcPort, (short) dnsQuery.getHeader().getId(), tester);
} }
@NonNull @NonNull

View File

@@ -542,7 +542,7 @@ public final class DnsResolver {
DnsAddressAnswer(@NonNull byte[] data) throws ParseException { DnsAddressAnswer(@NonNull byte[] data) throws ParseException {
super(data); super(data);
if ((mHeader.flags & (1 << 15)) == 0) { if ((mHeader.getFlags() & (1 << 15)) == 0) {
throw new ParseException("Not an answer packet"); throw new ParseException("Not an answer packet");
} }
if (mHeader.getRecordCount(QDSECTION) == 0) { if (mHeader.getRecordCount(QDSECTION) == 0) {

View File

@@ -200,13 +200,13 @@ public class DnsResolverTest {
super(data); super(data);
// Check QR field.(query (0), or a response (1)). // Check QR field.(query (0), or a response (1)).
if ((mHeader.flags & (1 << 15)) == 0) { if ((mHeader.getFlags() & (1 << 15)) == 0) {
throw new DnsParseException("Not an answer packet"); throw new DnsParseException("Not an answer packet");
} }
} }
int getRcode() { int getRcode() {
return mHeader.rcode; return mHeader.getFlags() & 0x0F;
} }
int getANCount() { int getANCount() {