#---------------------------------------------------------------------------- # /var/install/include/nm-get-route - configuration of gateway and additional routes # # Creation : 2025-10-24 hbfl # Last Update: $Id$ # # Copyright (c) 2001-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # # get the route # included from NetworkManager: nm-get-devices, nm-get-bonding, nm-get-brigde, etc.. # get_route() { local filter="${1}" case "${filter}" in ipv4) local route4_n eval route4_n='${IP_ETH_'${idx}'_V4_ROUTE_N}' idxr=1 while [ ${idxr} -le ${route4_n:-0} ] do met='' eval route4='${IP_ETH_'${idx}'_V4_ROUTE_'${idxr}'}' set ${route4} net=${1} netmask=${2} gw=${3} # met=${4} if [ -n "${4}" ] then met=",${4}" fi netmaskbits=$(/usr/bin/netcalc netmaskbits ${net}:${netmask}) if [ "${netmask}" = "0.0.0.0" ] then netmaskbits=32 fi echo "route${idxr}=${net}/${netmaskbits},${gw}${met}" idxr=$((${idxr} +1)) done ;; ipv6) local route6_n eval route6_n='${IP_ETH_'${idx}'_V6_ROUTE_N}' idxr=1 while [ ${idxr} -le ${route6_n:-0} ] do met='' eval route6='${IP_ETH_'${idx}'_V6_ROUTE_'${idxr}'}' set ${route6} net=${1} prefixlenght=${2} gw=${3} # met=${4} if [ -n "${4}" ] then met=",${4}" fi echo "route${idxr}=${net}/${prefixlenght},${gw}${met}" idxr=$((${idxr} +1)) done ;; esac }