Package: auto-apt-proxy
Version: 11
Tags: patch
Severity: minor

Hi,

I noticed that auto-apt-proxy sometimes gets the parsing of the gateway
wrong. Consider the following routing table (from an incus container):

    default via 192.168.77.1 dev host0 proto dhcp src 192.168.77.179 metric 1024
    default dev host0 proto static scope link metric 2048

The parsing code is

    ip route | awk '/default/ { print($3) }'

and what you get here is "192.168.77.1" and "host0". That host0 is not a
gateway but a network interface.

Consider using:

    ip route | awk '/^default via / { print($3) }'

Now you may ask how one spots this kind of problem. Turns out that
auto-apt-proxy in bullseye works the same as the sid version except that
it doesn not cache its results. Hence it resolves host0 using LLMNR and
therefore takes five seconds per http request making autopkgtest time
out the testbed setup if you end up installing more than 1000 packages.

Anyway, can we fix the gateway parsing?

Helmut
diff --minimal -Nru auto-apt-proxy-16.7/auto-apt-proxy 
auto-apt-proxy-16.7+nmu1/auto-apt-proxy
--- auto-apt-proxy-16.7/auto-apt-proxy  2025-05-19 04:20:27.000000000 +0200
+++ auto-apt-proxy-16.7+nmu1/auto-apt-proxy     2025-06-18 21:28:18.000000000 
+0200
@@ -254,7 +254,7 @@
 
 find_gateway() {
   local gateway
-  $ip "$@" route | awk '/default/ { print($3) }'
+  $ip "$@" route | awk '/^default via / { print($3) }'
 }
 
 resolve_getent() {
diff --minimal -Nru auto-apt-proxy-16.7/debian/changelog 
auto-apt-proxy-16.7+nmu1/debian/changelog
--- auto-apt-proxy-16.7/debian/changelog        2025-05-19 04:20:27.000000000 
+0200
+++ auto-apt-proxy-16.7+nmu1/debian/changelog   2025-06-18 21:28:19.000000000 
+0200
@@ -1,3 +1,10 @@
+auto-apt-proxy (16.7+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix default route parsing. (Closes: #-1)
+
+ -- Helmut Grohne <[email protected]>  Wed, 18 Jun 2025 21:28:19 +0200
+
 auto-apt-proxy (16.7) unstable; urgency=medium
 
   * Disable logging by default.

Reply via email to