if ($q->param('add')) { # seems that user has requested a new rule my $proto = $q->param('proto'); my $port = $q->param('port'); my $ip = $q->param('ip'); # set up rule hash's for NAT and FILTER Tables my %addrule_nat = ( protocol => "$proto", "destination-port" => "$port", jump => "DNAT", "to-destination" => "$ip", ); my %addrule_for = ( protocol => $proto, "in-interface" => 'eth0', "out-interface" => 'eth1', "destination-port" => $port, jump => "ACCEPT", ); my %addrule_inp = ( protocol => $proto, "destination-port" => $port, jump => "ACCEPT", ); my $erfolg_nat = $nat->append_entry('PREROUTING', \%addrule_nat) || die "NAT: $!"; my $erfolg_for = $filter->insert_entry('FORWARD', \%addrule_for, 0) || die "FORWARD: $!"; my $erfolg_inp = $filter->insert_entry('INPUT', \%addrule_inp, 0) || die "INPUT: $!"; # now commit our work my $commit_nat = $nat->commit(); my $commit_filter = $filter->commit(); # tell the user it is done an refresh in 5sec _cut_ }