2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# Shorewall -- /usr/share/shorewall/action.Broadcast
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2018-01-08 00:01:46 +01:00
|
|
|
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2020-03-26 22:58:35 +01:00
|
|
|
# Complete documentation is available at https://shorewall.org
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation.
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2017-03-13 22:54:25 +01:00
|
|
|
# Broadcast[([<action>|[,{audit|-}])]
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
# Default action is DROP
|
2011-07-03 17:58:30 +02:00
|
|
|
#
|
2016-04-05 19:13:55 +02:00
|
|
|
###############################################################################
|
2011-07-03 17:58:30 +02:00
|
|
|
|
|
|
|
DEFAULTS DROP,-
|
|
|
|
|
2016-03-14 23:57:32 +01:00
|
|
|
?if __ADDRTYPE
|
2017-03-13 22:54:25 +01:00
|
|
|
@1 - - - ;; -m addrtype --dst-type BROADCAST
|
|
|
|
@1 - - - ;; -m addrtype --dst-type ANYCAST
|
2017-03-14 00:52:16 +01:00
|
|
|
?else
|
2017-03-13 22:54:25 +01:00
|
|
|
?begin perl;
|
2011-07-03 17:58:30 +02:00
|
|
|
|
2017-03-14 00:52:16 +01:00
|
|
|
use strict;
|
2017-03-13 22:54:25 +01:00
|
|
|
use Shorewall::IPAddrs;
|
|
|
|
use Shorewall::Config;
|
|
|
|
use Shorewall::Chains;
|
2011-07-03 17:58:30 +02:00
|
|
|
|
2017-03-14 00:52:16 +01:00
|
|
|
my ( $action, $audit ) = get_action_params( 2 );
|
2017-03-13 22:54:25 +01:00
|
|
|
my $chainref = get_action_chain;
|
|
|
|
my ( $level, $tag ) = get_action_logging;
|
2017-03-14 00:52:16 +01:00
|
|
|
|
|
|
|
fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit';
|
|
|
|
|
2017-03-13 22:54:25 +01:00
|
|
|
my $target = require_audit ( $action , $audit );
|
2011-07-03 17:58:30 +02:00
|
|
|
|
2017-03-14 00:52:16 +01:00
|
|
|
if ( $family == F_IPV4 ) {
|
2017-03-13 22:54:25 +01:00
|
|
|
add_commands $chainref, 'for address in $ALL_BCASTS; do';
|
2017-03-14 00:52:16 +01:00
|
|
|
} elsif ($family == F_IPV6 ) {
|
2017-03-13 22:54:25 +01:00
|
|
|
add_commands $chainref, 'for address in $ALL_ACASTS; do';
|
|
|
|
}
|
2012-04-24 23:52:57 +02:00
|
|
|
|
2017-03-13 22:54:25 +01:00
|
|
|
incr_cmd_level $chainref;
|
|
|
|
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
|
|
|
|
add_jump $chainref, $target, 0, "-d \$address ";
|
|
|
|
decr_cmd_level $chainref;
|
|
|
|
add_commands $chainref, 'done';
|
2011-07-03 17:58:30 +02:00
|
|
|
|
2017-03-13 22:54:25 +01:00
|
|
|
1;
|
|
|
|
|
|
|
|
?end perl;
|
2016-03-14 23:57:32 +01:00
|
|
|
?endif
|