forked from extern/shorewall_code
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
732ae3ce19 | ||
|
9cbcb328af | ||
|
82e84f724d | ||
|
23cf8328d5 | ||
|
7c31f70dc8 | ||
|
ec21b03c5b | ||
|
25dcf8c5d6 | ||
|
c02b71b530 | ||
|
78269d57bc | ||
|
fc91648315 | ||
|
067f435ac5 |
@@ -3775,7 +3775,7 @@ ipcalc_command() {
|
||||
elif [ $# -eq 3 ]; then
|
||||
address=$2
|
||||
vlsm=$(ip_vlsm $3)
|
||||
elif [ $# -eq 0 ]; then
|
||||
elif [ $# -eq 1 ]; then
|
||||
missing_argument
|
||||
else
|
||||
too_many_arguments $4
|
||||
@@ -3864,7 +3864,7 @@ noiptrace_command() {
|
||||
verify_firewall_script() {
|
||||
if [ ! -f $g_firewall ]; then
|
||||
echo " ERROR: $g_product is not properly installed" >&2
|
||||
if [ -L $g_firewall ]; then
|
||||
if [ -h $g_firewall ]; then
|
||||
echo " $g_firewall is a symbolic link to a" >&2
|
||||
echo " non-existant file" >&2
|
||||
else
|
||||
|
@@ -751,6 +751,8 @@ mutex_on()
|
||||
lockf=${LOCKFILE:=${VARDIR}/lock}
|
||||
local lockpid
|
||||
local lockd
|
||||
local lockbin
|
||||
local openwrt
|
||||
|
||||
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
|
||||
|
||||
@@ -760,29 +762,33 @@ mutex_on()
|
||||
|
||||
[ -d "$lockd" ] || mkdir -p "$lockd"
|
||||
|
||||
lockbin=$(mywhich lock)
|
||||
[ -n "$lockbin" -a -h "$lockbin" ] && openwrt=Yes
|
||||
|
||||
if [ -f $lockf ]; then
|
||||
lockpid=`cat ${lockf} 2> /dev/null`
|
||||
if [ -z "$lockpid" ] || [ $lockpid = 0 ]; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} removed"
|
||||
elif [ $lockpid -eq $$ ]; then
|
||||
return 0
|
||||
elif ! ps | grep -v grep | qt grep ${lockpid}; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||
elif [ -z "$openwrt" ]; then
|
||||
if [ $lockpid -eq $$ ]; then
|
||||
fatal_error "Mutex_on confusion"
|
||||
elif ! qt ps --pid ${lockpid}; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if qt mywhich lockfile; then
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
|
||||
if [ -n "$openwrt" ]; then
|
||||
lock ${lockf} || fatal_error "Can't lock ${lockf}"
|
||||
g_havemutex="lock -u ${lockf}"
|
||||
elif qt mywhich lockfile; then
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf} || fatal_error "Can't lock ${lockf}"
|
||||
g_havemutex="rm -f ${lockf}"
|
||||
chmod u+w ${lockf}
|
||||
echo $$ > ${lockf}
|
||||
chmod u-w ${lockf}
|
||||
elif qt mywhich lock; then
|
||||
lock ${lockf}
|
||||
g_havemutex="lock -u ${lockf} && rm -f ${lockf}"
|
||||
chmod u=r ${lockf}
|
||||
else
|
||||
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
||||
sleep 1
|
||||
|
@@ -60,7 +60,7 @@ mywhich() {
|
||||
remove_file() # $1 = file to remove
|
||||
{
|
||||
if [ -n "$1" ] ; then
|
||||
if [ -f $1 -o -L $1 ] ; then
|
||||
if [ -f $1 -o -h $1 ] ; then
|
||||
rm -f $1
|
||||
echo "$1 Removed"
|
||||
fi
|
||||
@@ -84,7 +84,7 @@ remove_file_with_wildcard() # $1 = file with wildcard to remove
|
||||
if [ -d $f ] ; then
|
||||
rm -rf $f
|
||||
echo "$f Removed"
|
||||
elif [ -f $f -o -L $f ] ; then
|
||||
elif [ -f $f -o -h $f ] ; then
|
||||
rm -f $f
|
||||
echo "$f Removed"
|
||||
fi
|
||||
|
@@ -151,7 +151,7 @@ fi
|
||||
|
||||
remove_file ${SBINDIR}/$PRODUCT
|
||||
|
||||
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
|
||||
if [ -h ${SHAREDIR}/$PRODUCT/init ]; then
|
||||
if [ $HOST = openwrt ]; then
|
||||
if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then
|
||||
/etc/init.d/$PRODUCT disable
|
||||
|
@@ -425,7 +425,7 @@ our $VERSION = 'MODULEVERSION';
|
||||
# Established - ^<z1-z2>
|
||||
# Related - +<z1-z2>
|
||||
# Invalid - _<z1-z2>
|
||||
# Untracked - &<z1-z2>
|
||||
# Untracked - =<z1-z2>
|
||||
#
|
||||
our %chain_table;
|
||||
our $raw_table;
|
||||
@@ -2269,7 +2269,7 @@ sub invalid_chain($$) {
|
||||
# Name of the untracked chain between an ordered pair of zones
|
||||
#
|
||||
sub untracked_chain($$) {
|
||||
'&' . &rules_chain(@_);
|
||||
'=' . &rules_chain(@_);
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -2529,6 +2529,10 @@ sub split_rawline2( $$;$$$ ) {
|
||||
# Delete trailing comment
|
||||
#
|
||||
$currentline =~ s/\s*#.*//;
|
||||
#
|
||||
# Convert ${...} to $...
|
||||
#
|
||||
$currentline =~ s/\$\{(.*?)\}/\$$1/g;
|
||||
|
||||
my @result = &split_line2( @_ );
|
||||
|
||||
@@ -5459,7 +5463,7 @@ sub update_config_file( $ ) {
|
||||
update_default( 'BLACKLIST_DEFAULT', 'AllowICMPs,dropBcasts,dropNotSyn,dropInvalid' );
|
||||
}
|
||||
|
||||
for ( qw/DROP_DEFAULT REJECT_DEFAULT/ ) {
|
||||
for ( qw/DROP_DEFAULT REJECT_DEFAULT BLACKLIST_DEFAULT/ ) {
|
||||
my $policy = $config{ $_ };
|
||||
|
||||
if ( $policy =~ /\bA_(?:Drop|Reject)\b/ ) {
|
||||
@@ -6599,7 +6603,7 @@ sub get_configuration( $$$ ) {
|
||||
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
|
||||
default_yes_no 'USE_NFLOG_SIZE' , '';
|
||||
|
||||
if ( ( $val = $config{AUTOMAKE} ) !~ /^[Rr]ecursive$/ ) {
|
||||
if ( ( $val = ( $config{AUTOMAKE} || '' ) ) !~ /^[Rr]ecursive$/ ) {
|
||||
default_yes_no( 'AUTOMAKE' , '' ) unless $val && $val =~ /^\d{1,2}$/;
|
||||
}
|
||||
|
||||
|
@@ -810,7 +810,7 @@ sub add_common_rules ( $ ) {
|
||||
$dbl_dst_target = $dbl_src_target;
|
||||
}
|
||||
} elsif ( $dbl_level ) {
|
||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = $dbl_dst_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||
|
||||
log_rule_limit( $dbl_level,
|
||||
$chainref,
|
||||
|
@@ -675,7 +675,7 @@ interface_is_usable() # $1 = interface
|
||||
status=0
|
||||
|
||||
if ! loopback_interface $1; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ] && [ -z "$($IP -$g_family link list dev $1 2> /dev/null | fgrep 'state DOWN')" ]; then
|
||||
if [ "$COMMAND" != enable ]; then
|
||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
||||
status=$?
|
||||
@@ -1101,7 +1101,7 @@ interface_is_usable() # $1 = interface
|
||||
status=0
|
||||
|
||||
if [ "$1" != lo ]; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ] && [ -z "$($IP -$g_family link list dev $1 2> /dev/null | fgrep 'state DOWN')" ]; then
|
||||
if [ "$COMMAND" != enable ]; then
|
||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
||||
status=$?
|
||||
|
@@ -151,7 +151,7 @@ fi
|
||||
|
||||
remove_file ${SBINDIR}/$PRODUCT
|
||||
|
||||
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
|
||||
if [ -h ${SHAREDIR}/$PRODUCT/init ]; then
|
||||
FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
|
||||
elif [ -n "$INITFILE" ]; then
|
||||
FIREWALL=${INITDIR}/${INITFILE}
|
||||
|
Reference in New Issue
Block a user