mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-02 16:05:39 +02:00
Generate better code during providers file processing
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3847 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
0b7f88d565
commit
654c3b9fa8
@ -1123,7 +1123,7 @@ verify_mark() # $1 = value to test
|
|||||||
#
|
#
|
||||||
setup_providers()
|
setup_providers()
|
||||||
{
|
{
|
||||||
local table number mark duplicate interface gateway options provider address copy route loose addresses rulenum pref echobin=$(mywhich echo) balance save_indent="$INDENT" mask= first=Yes
|
local table number mark duplicate interface gateway options provider address copy route loose addresses rulenum base pref echobin=$(mywhich echo) balance save_indent="$INDENT" mask= first=Yes
|
||||||
|
|
||||||
copy_table() {
|
copy_table() {
|
||||||
indent >&3 << __EOF__
|
indent >&3 << __EOF__
|
||||||
@ -1160,6 +1160,8 @@ __EOF__
|
|||||||
|
|
||||||
balance_default_route() # $1 = weight
|
balance_default_route() # $1 = weight
|
||||||
{
|
{
|
||||||
|
balance=yes
|
||||||
|
|
||||||
if [ -n "$first"]; then
|
if [ -n "$first"]; then
|
||||||
if [ "x$gateway" = xdetect ] ; then
|
if [ "x$gateway" = xdetect ] ; then
|
||||||
save_command "DEFAULT_ROUTE=\"nexthop via \$gateway dev $interface weight $1\""
|
save_command "DEFAULT_ROUTE=\"nexthop via \$gateway dev $interface weight $1\""
|
||||||
@ -1260,11 +1262,9 @@ __EOF__
|
|||||||
ROUTEMARK_INTERFACES="$ROUTEMARK_INTERFACES $interface"
|
ROUTEMARK_INTERFACES="$ROUTEMARK_INTERFACES $interface"
|
||||||
;;
|
;;
|
||||||
balance=*)
|
balance=*)
|
||||||
balance=yes
|
|
||||||
balance_default_route ${option#*=}
|
balance_default_route ${option#*=}
|
||||||
;;
|
;;
|
||||||
balance)
|
balance)
|
||||||
balance=yes
|
|
||||||
balance_default_route 1
|
balance_default_route 1
|
||||||
;;
|
;;
|
||||||
loose)
|
loose)
|
||||||
@ -1280,13 +1280,14 @@ __EOF__
|
|||||||
rulenum=0
|
rulenum=0
|
||||||
|
|
||||||
if [ -z "$loose" ]; then
|
if [ -z "$loose" ]; then
|
||||||
|
base=$(( 20000 + ( 256 * ($number-1) ) ))
|
||||||
indent >&3 << __EOF__
|
indent >&3 << __EOF__
|
||||||
|
|
||||||
rulenum=0
|
rulenum=0
|
||||||
|
|
||||||
find_interface_addresses $interface | while read address; do
|
find_interface_addresses $interface | while read address; do
|
||||||
qt ip rule del from \$address
|
qt ip rule del from \$address
|
||||||
pref=\$((20000 + ($number - 1) * 256 + \$rulenum ))
|
pref=\$(( $base + \$rulenum ))
|
||||||
rulenum=\$((\$rulenum + 1))
|
rulenum=\$((\$rulenum + 1))
|
||||||
run_ip rule add from \$address pref \$pref table $number
|
run_ip rule add from \$address pref \$pref table $number
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user