forked from extern/shorewall_code
Cleanup if IPv6 provider work
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
d3d9380df5
commit
4b419f7497
@ -217,6 +217,9 @@ sub balance_default_route( $$$$ ) {
|
||||
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# IPv6 doesn't support multi-hop routes
|
||||
#
|
||||
if ( $gateway ) {
|
||||
emit "DEFAULT_ROUTE=\"via $gateway dev $interface $realm\"";
|
||||
} else {
|
||||
@ -251,6 +254,9 @@ sub balance_fallback_route( $$$$ ) {
|
||||
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# IPv6 doesn't support multi-hop routes
|
||||
#
|
||||
if ( $gateway ) {
|
||||
emit "FALLBACK_ROUTE=\"via $gateway dev $interface $realm\"";
|
||||
} else {
|
||||
@ -657,6 +663,9 @@ sub add_a_provider( $$ ) {
|
||||
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# IPv6 doesn't support multi-hop routes
|
||||
#
|
||||
if ( $gateway ) {
|
||||
emit qq(add_gateway "via $gateway dev $physical $realm" ) . $tbl;
|
||||
} else {
|
||||
@ -737,7 +746,7 @@ sub add_a_provider( $$ ) {
|
||||
$via = "dev $physical";
|
||||
}
|
||||
|
||||
$via .= " weight $weight" unless $weight < 0 or $family == F_IPV6;
|
||||
$via .= " weight $weight" unless $weight < 0 or $family == F_IPV6; # IPv6 doesn't support route weights
|
||||
$via .= " $realm" if $realm;
|
||||
|
||||
emit( qq(delete_gateway "$via" $tbl $physical) );
|
||||
|
@ -5,7 +5,21 @@
|
||||
# Give Usage Information
|
||||
#
|
||||
usage() {
|
||||
echo "Usage: $0 [ options ] [ start|stop|clear|down|reset|refresh|restart|status|up|version ]"
|
||||
echo "Usage: $0 [ options ] <command>"
|
||||
echo
|
||||
echo "<command> is one of:"
|
||||
echo " start"
|
||||
echo " stop"
|
||||
echo " clear"
|
||||
echo " disable <interface>"
|
||||
echo " down <interface>"
|
||||
echo " enable <interface>"
|
||||
echo " reset"
|
||||
echo " refresh"
|
||||
echo " restart"
|
||||
echo " status"
|
||||
echo " up <interface>"
|
||||
echo " version"
|
||||
echo
|
||||
echo "Options are:"
|
||||
echo
|
||||
@ -330,6 +344,26 @@ case "$COMMAND" in
|
||||
updown $1
|
||||
status=0
|
||||
;;
|
||||
enable)
|
||||
[ $# -eq 1 ] && exit 0
|
||||
shift
|
||||
[ $# -ne 1 ] && usage 2
|
||||
if shorewall6_is_started; then
|
||||
detect_configuration
|
||||
enable_provider $1
|
||||
fi
|
||||
status=0
|
||||
;;
|
||||
disable)
|
||||
[ $# -eq 1 ] && exit 0
|
||||
shift
|
||||
[ $# -ne 1 ] && usage 2
|
||||
if shorewall6_is_started; then
|
||||
detect_configuration
|
||||
disable_provider $1
|
||||
fi
|
||||
status=0
|
||||
;;
|
||||
version)
|
||||
[ $# -ne 1 ] && usage 2
|
||||
echo $SHOREWALL_VERSION
|
||||
|
@ -196,6 +196,35 @@ find_interface_full_addresses() # $1 = interface
|
||||
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 ' | sed 's/\s*inet6 //;s/ scope.*//;s/ peer.*//'
|
||||
}
|
||||
|
||||
#
|
||||
# Add an additional gateway to the default route
|
||||
#
|
||||
add_gateway() # $1 = Delta $2 = Table Number
|
||||
{
|
||||
local route
|
||||
local weight
|
||||
local delta
|
||||
local dev
|
||||
|
||||
run_ip route add default scope global table $2 $1
|
||||
}
|
||||
|
||||
#
|
||||
# Remove a gateway from the default route
|
||||
#
|
||||
delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
|
||||
{
|
||||
local route
|
||||
local gateway
|
||||
local dev
|
||||
|
||||
route=`$IP -6 -o route ls table $2 | grep ^default | sed 's/[\]//g'`
|
||||
gateway=$1
|
||||
|
||||
dev=$(find_device $route)
|
||||
[ "$dev" = "$3" ] && run_ip route delete default table $2
|
||||
}
|
||||
|
||||
#
|
||||
# echo the list of networks routed out of a given interface
|
||||
#
|
||||
|
@ -141,6 +141,30 @@
|
||||
embedded whitespace.</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">balance</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.4.25. Causes a default route to
|
||||
this provider's gateway to be added to the <emphasis
|
||||
role="bold">main</emphasis> routing table (USE_DEFAULT_RT=No)
|
||||
or to the <emphasis role="bold">balance</emphasis> routing
|
||||
table (USE_DEFAULT_RT=Yes). At most one provider can specify
|
||||
this option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">fallback</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.4.25. Causes a default route to
|
||||
this provider's gateway to be added to the <emphasis
|
||||
role="bold">default</emphasis> routing table.At most one
|
||||
provider can specify this option.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">track</emphasis></term>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user