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

Commit 4a8bcdef authored by Erik Kline's avatar Erik Kline
Browse files

Log NAT update descriptions when receiving netlink errors

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - new logging messages observed

    2017-10-06T13:15:25.190 - [OffloadController] ERROR Error updating NAT conntrack entry >TCP (192.168.43.222, 58054) -> (198.35.26.112, 443)<: android.system.ErrnoException: NetlinkErrorMessage{...
Bug: 29337859
Bug: 32163131
Bug: 64976634
Bug: 67396342

Merged-In: Ia1f0b97f89a9848a64099d01184fcbc2056a1b34
Merged-In: I426b0a0545d56aba7924c416799b37731e7e4b18
Change-Id: Ie05d4e6588d75f8a9798f40b68a317e24b3b5050
(cherry picked from commit a5ae9056)
parent b7dc3a3b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -596,9 +596,10 @@ public class OffloadController {
        }

        mNatUpdateCallbacksReceived++;
        final String natDescription = String.format("%s (%s, %s) -> (%s, %s)",
                protoName, srcAddr, srcPort, dstAddr, dstPort);
        if (DBG) {
            mLog.log(String.format("NAT timeout update: %s (%s, %s) -> (%s, %s)",
                     protoName, srcAddr, srcPort, dstAddr, dstPort));
            mLog.log("NAT timeout update: " + natDescription);
        }

        final int timeoutSec = connectionTimeoutUpdateSecondsFor(proto);
@@ -609,7 +610,7 @@ public class OffloadController {
            NetlinkSocket.sendOneShotKernelMessage(OsConstants.NETLINK_NETFILTER, msg);
        } catch (ErrnoException e) {
            mNatUpdateNetlinkErrors++;
            mLog.e("Error updating NAT conntrack entry: " + e
            mLog.e("Error updating NAT conntrack entry >" + natDescription + "<: " + e
                    + ", msg: " + NetlinkConstants.hexify(msg));
            mLog.log("NAT timeout update callbacks received: " + mNatUpdateCallbacksReceived);
            mLog.log("NAT timeout update netlink errors: " + mNatUpdateNetlinkErrors);