Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83c9b4b6 authored by Luke Huang's avatar Luke Huang
Browse files

Set rcode correctly for caching hit

rcode isn't set if RESOLV_CACHE_FOUND in res_nsend.
Use the rcode in cached answer to corrcet it.

Test: built, flashed, booted
      system/netd/tests/runtests.sh pas

Change-Id: Ie40331bb7c9be9a78b209fdeecc2f37965b2b30b
parent 35bfddfb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -385,6 +385,8 @@ int res_nsend(res_state statp, const u_char* buf, int buflen, u_char* ans, int a
    cache_status = _resolv_cache_lookup(statp->netid, buf, buflen, ans, anssiz, &anslen, flags);

    if (cache_status == RESOLV_CACHE_FOUND) {
        HEADER* hp = (HEADER*)(void*)ans;
        *rcode = hp->rcode;
        return anslen;
    } else if (cache_status != RESOLV_CACHE_UNSUPPORTED) {
        // had a cache miss for a known network, so populate the thread private