mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 17:58:07 +02:00
Allow addition of blackhole routes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
216029c3a9
commit
06e7f297f7
@ -1104,7 +1104,11 @@ sub add_a_route( ) {
|
|||||||
fatal_error 'DEST must be specified' if $dest eq '-';
|
fatal_error 'DEST must be specified' if $dest eq '-';
|
||||||
$dest = validate_net ( $dest, 0 );
|
$dest = validate_net ( $dest, 0 );
|
||||||
|
|
||||||
validate_address ( $gateway, 1 ) if $gateway ne '-';
|
if ( $gateway eq 'blackhole' ) {
|
||||||
|
fatal_error q('blackhole' routes may not specify a DEVICE) unless $device eq '-';
|
||||||
|
} else {
|
||||||
|
validate_address ( $gateway, 1 ) if $gateway ne '-';
|
||||||
|
}
|
||||||
|
|
||||||
my $providerref = $providers{$provider};
|
my $providerref = $providers{$provider};
|
||||||
my $number = $providerref->{number};
|
my $number = $providerref->{number};
|
||||||
@ -1117,6 +1121,9 @@ sub add_a_route( ) {
|
|||||||
if ( $device ne '-' ) {
|
if ( $device ne '-' ) {
|
||||||
push @$routes, qq(run_ip route add $dest via $gateway dev $physical table $number);
|
push @$routes, qq(run_ip route add $dest via $gateway dev $physical table $number);
|
||||||
emit qq(echo "qt \$IP -$family route del $dest via $gateway dev $physical table $number" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
emit qq(echo "qt \$IP -$family route del $dest via $gateway dev $physical table $number" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
|
} elsif ( $gateway eq 'blackhole' ) {
|
||||||
|
push @$routes, qq(run_ip route add blackhole $dest table $number);
|
||||||
|
emit qq(echo "\$IP -$family route del blackhole $dest table $number" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
} else {
|
} else {
|
||||||
push @$routes, qq(run_ip route add $dest via $gateway table $number);
|
push @$routes, qq(run_ip route add $dest via $gateway table $number);
|
||||||
emit qq(echo "\$IP -$family route del $dest via $gateway table $number" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
emit qq(echo "\$IP -$family route del $dest via $gateway table $number" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If specified, gives the IP address of the gateway to the
|
<para>If specified, gives the IP address of the gateway to the
|
||||||
DEST.</para>
|
DEST.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 4.5.15, you may specify blackhole in
|
||||||
|
this column to create a <option>blackhole</option> route. </para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -62,8 +65,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
|
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
|
||||||
given, then the INTERFACE specified for the PROVIDER in <ulink
|
given, then the INTERFACE specified for the PROVIDER in <ulink
|
||||||
url="shorewall-providers.html">shorewall-providers</ulink>
|
url="shorewall-providers.html">shorewall-providers</ulink> (5). This
|
||||||
(5).</para>
|
column must be omitted if <option>blackhole</option> is specified in
|
||||||
|
the GATEWAY column.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If specified, gives the IP address of the gateway to the
|
<para>If specified, gives the IP address of the gateway to the
|
||||||
DEST.</para>
|
DEST.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 4.5.15, you may specify blackhole in
|
||||||
|
this column to create a <option>blackhole</option> route.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -62,8 +65,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
|
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
|
||||||
given, then the INTERFACE specified for the PROVIDER in <ulink
|
given, then the INTERFACE specified for the PROVIDER in <ulink
|
||||||
url="shorewall6-providers.html">shorewall6-providers</ulink>
|
url="shorewall6-providers.html">shorewall6-providers</ulink> (5).
|
||||||
(5).</para>
|
This column must be omitted if <option>blackhole</option> is
|
||||||
|
specified in the GATEWAY column.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user