HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/webmin/nftables/delete_chains.cgi
#!/usr/bin/perl
# delete_chains.cgi
# Delete selected nftables chains

require './nftables-lib.pl';    ## no critic
use strict;
use warnings;
our (%in, %text);
ReadParse();
error_setup($text{'delete_chains_err'});
assert_acl('delete');

my @tables = get_nftables_save();
my $table_idx = $in{'table'};
my $table;
if (defined($in{'table_family'}) && defined($in{'table_name'})) {
	for (my $i = 0 ; $i <= $#tables ; $i++) {
		if ($tables[$i]->{'family'} eq $in{'table_family'} &&
			$tables[$i]->{'name'} eq $in{'table_name'})
		{
			$table_idx = $i;
			$table = $tables[$i];
			last;
			}
		}
	}
$table ||= $tables[$table_idx];
$table || error($text{'chain_notable'});
assert_table_acl($table);

my @chains = split(/\0/, $in{'d'} || "");
my %seen;
@chains = grep { defined($_) && $_ ne '' && !$seen{$_}++ } @chains;
@chains || error($text{'delete_chains_enone'});

foreach my $c (@chains) {
	$table->{'chains'}->{$c} || error(text('delete_chains_nochain', $c));
	}

my %delete = map { $_ => 1 } @chains;
my @refs = grep {
	!$delete{$_->{'chain'}} &&
	    (($_->{'jump'} && $delete{$_->{'jump'}}) ||
		($_->{'goto'} && $delete{$_->{'goto'}}))
		} @{$table->{'rules'}};
@refs && error(text('delete_chains_inuse', scalar(@refs)));

@{$table->{'rules'}} = grep { !$delete{$_->{'chain'}} } @{$table->{'rules'}};
foreach my $c (@chains) {
	delete($table->{'chains'}->{$c});
	}

my $err = save_table_configuration($table, @tables);
error(text('delete_chains_failed', $err)) if ($err);
webmin_log(
	"delete", "chains",
	scalar(@chains),
	{
		'table' => $table->{'name'},
		'family' => $table->{'family'}
	}
);
redirect("index.cgi?table_family=".
	    urlize($table->{'family'}).
	    "&table_name=".
	    urlize($table->{'name'}));