merge in klp-release history after reset to klp-dev
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c
index 8c1a01b..937c423 100644
--- a/libc/netbsd/net/getaddrinfo.c
+++ b/libc/netbsd/net/getaddrinfo.c
@@ -1874,10 +1874,10 @@
 	if (iface == NULL || *iface == '\0') return true;
 
 	if_len = _resolv_get_default_iface(buf, sizeof(buf));
-	if (if_len + 1 <= sizeof(buf)) {
-		if (strcmp(buf, iface) != 0) return false;
+	if (if_len != 0 && if_len + 1 <= sizeof(buf)) {
+		if (strcmp(buf, iface) == 0) return true;
 	}
-	return true;
+	return false;
 }
 
 /*ARGSUSED*/
diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c
index 8e1bd14..8a6dc83 100644
--- a/libc/netbsd/resolv/res_cache.c
+++ b/libc/netbsd/resolv/res_cache.c
@@ -2531,14 +2531,15 @@
             uidiface_info->next = _res_uidiface_list.next;
             _res_uidiface_list.next = uidiface_info;
 
-            XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", low, high, ifname);
+            XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", uid_start, uid_end,
+                    ifname);
         } else {
             XLOG("_resolv_set_iface_for_uid_range failing calloc\n");
             rv = -1;
             errno = EINVAL;
         }
     } else {
-        XLOG("_resolv_set_iface_for_uid_range range [%d,%d] overlaps\n", low, high);
+        XLOG("_resolv_set_iface_for_uid_range range [%d,%d] overlaps\n", uid_start, uid_end);
         rv = -1;
         errno = EINVAL;
     }
@@ -2603,19 +2604,16 @@
 
     char* ifname = _get_default_iface_locked(); // never null, but may be empty
 
-    // if default interface not set. Get first cache with an interface
+    // if default interface not set give up.
     if (ifname[0] == '\0') {
-        ifname = _find_any_iface_name_locked(); // may be null
+        pthread_mutex_unlock(&_res_cache_list_lock);
+        return 0;
     }
 
-    size_t len = 0;
-    // if we got the default iface or if (no-default) the find_any call gave an answer
-    if (ifname) {
-        len = strlen(ifname);
-        if (len < buffLen) {
-            strncpy(buff, ifname, len);
-            buff[len] = '\0';
-        }
+    size_t len = strlen(ifname);
+    if (len < buffLen) {
+        strncpy(buff, ifname, len);
+        buff[len] = '\0';
     } else {
         buff[0] = '\0';
     }
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index d1b49e5..b23eca4 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -1812,14 +1812,14 @@
         } else  dir = tmcomp(&mytm, &yourtm);
         if (dir != 0) {
             if (t == lo) {
-                ++t;
-                if (t <= lo)
+                if (t == time_t_max)
                     return WRONG;
+                ++t;
                 ++lo;
             } else if (t == hi) {
-                --t;
-                if (t >= hi)
+                if (t == time_t_min)
                     return WRONG;
+                --t;
                 --hi;
             }
             if (lo > hi)
diff --git a/libc/tzcode/private.h b/libc/tzcode/private.h
index a31a26e..1a938a2 100644
--- a/libc/tzcode/private.h
+++ b/libc/tzcode/private.h
@@ -304,6 +304,16 @@
 #define TYPE_SIGNED(type) (((type) -1) < 0)
 #endif /* !defined TYPE_SIGNED */
 
+/* The minimum and maximum finite time values.  */
+static time_t const time_t_min =
+  (TYPE_SIGNED(time_t)
+   ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+   : 0);
+static time_t const time_t_max =
+  (TYPE_SIGNED(time_t)
+   ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+   : -1);
+
 /*
 ** Since the definition of TYPE_INTEGRAL contains floating point numbers,
 ** it cannot be used in preprocessor directives.
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 0ad4763..02163a5 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -54,3 +54,16 @@
   ASSERT_EQ(0, broken_down->tm_mon);
   ASSERT_EQ(1970, broken_down->tm_year + 1900);
 }
+
+#ifdef __BIONIC__
+TEST(time, mktime_10310929) {
+  struct tm t;
+  memset(&t, 0, sizeof(tm));
+  t.tm_year = 200;
+  t.tm_mon = 2;
+  t.tm_mday = 10;
+
+  ASSERT_EQ(-1, mktime(&t));
+  ASSERT_EQ(-1, mktime_tz(&t, "UTC"));
+}
+#endif