Hello!

See attached patch for optionally calling netstat (and awk) based
on existance.
Added bonus is alternative usage of iproute (and awk) for same functionality.

Please review/test.

-- 
Andreas Henriksson
diff --git a/debian/init b/debian/init
index 86f88e2..b9b9c45 100644
--- a/debian/init
+++ b/debian/init
@@ -27,7 +27,11 @@ test -f /etc/default/oidentd && . /etc/default/oidentd
 
 if [ "${OIDENT_BEHIND_PROXY}" = "yes" ]; then
   # If we have a default router, then allow it to proxy auth requests to us
-  GATEWAY=`netstat -nr | awk '/^0.0.0.0/{print $2;}'`
+  if [ -x /bin/netstat ] && [ -x /usr/bin/awk ]; then
+    GATEWAY=`netstat -nr | awk '/^0.0.0.0/{print $2;}'`
+  elif [ -x /bin/ip ] && [ -x /usr/bin/awk ]; then
+    GATEWAY=`ip route show 0.0.0.0/0 | awk '/^default via /{print $3}'`
+  fi
   if [ -n "${GATEWAY}" ]; then
     OIDENT_OPTIONS="${OIDENT_OPTIONS} -P ${GATEWAY}"
   fi

Reply via email to