diff --git a/src/tc-gen b/src/tc-gen index 64cab92..ffa1ba7 100755 --- a/src/tc-gen +++ b/src/tc-gen @@ -508,6 +508,14 @@ while getopts ":i:u:d:b:f:q:c:C:p:xV" OPT; do esac done +if [[ "${IF_NAME}" = "DEFAULT" ]]; then + IF_NAME="$(ip -j route | jq -r 'map(select(.dst=="default"))[0].dev' 2>&1)" + if [[ "$?" -ne 0 ]]; then + >&2 echo "ERROR: failed to determine the interface name for the default route" + exit 1 + fi +fi + if [[ -z ${IF_NAME} ]]; then print_usage exit 1