diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 4ffc66543c..0e27f295c9 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2057,6 +2057,9 @@ function filter_generate_user_rule($rule) { case "inet6": $aline['ipprotocol'] = "inet6"; break; + case "inet46": + $aline['ipprotocol'] = ""; + break; } } diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index c6af424a78..5656de8637 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -712,6 +712,9 @@ if($_REQUEST['undodrag']) { case "inet6": echo "IPv6 "; break; + case "inet46": + echo "IPv4+6 "; + break; } } else { echo "IPv4 "; diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 57f01bf7f1..13f42872d3 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -213,6 +213,9 @@ if ($_POST) { if($_POST['ipprotocol'] == $family) { continue; } + if(($_POST['ipprotocol'] == "inet46") && ($_POST['ipprotocol'] != $family)) { + $input_errors[] = gettext("You can not assign a gateway to a rule that applies to IPv4 and IPv6"); + } if(($_POST['ipprotocol'] == "inet6") && ($_POST['ipprotocol'] != $family)) { $input_errors[] = gettext("You can not assign a IPv4 gateway group on IPv6 Address Family rule"); } @@ -223,6 +226,9 @@ if ($_POST) { } } if (($_POST['ipprotocol'] <> "") && ($_POST['gateway'] <> "") && (is_ipaddr(lookup_gateway_ip_by_name($_POST['gateway'])))) { + if(($_POST['ipprotocol'] == "inet46") && ($_POST['gateway'] <> "")) { + $input_errors[] = gettext("You can not assign a gateway to a rule that applies to IPv4 and IPv6"); + } if(($_POST['ipprotocol'] == "inet6") && (!is_ipaddrv6(lookup_gateway_ip_by_name($_POST['gateway'])))) { $input_errors[] = gettext("You can not assign the IPv4 Gateway to a IPv6 Filter rule"); } @@ -231,6 +237,15 @@ if ($_POST) { } } + if (($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp") && ($_POST['proto'] != "tcp/udp") && ($_POST['proto'] != "icmp")) { + if($_POST['ipprotocol'] == "inet46") + $input_errors[] = gettext("You can not assign a protocol other then ICMP, TCP, UDP or TCP/UDP to a rule that applies to IPv4 and IPv6"); + } + if (($_POST['proto'] == "icmp") && ($_POST['icmptype'] <> "")){ + if($_POST['ipprotocol'] == "inet46") + $input_errors[] = gettext("You can not assign a ICMP type to a rule that applies to IPv4 and IPv6"); + } + if (($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp") && ($_POST['proto'] != "tcp/udp")) { $_POST['srcbeginport'] = 0; $_POST['srcendport'] = 0; @@ -390,6 +405,9 @@ if ($_POST) { $input_errors[] = gettext("You can not use IPv6 addresses in IPv4 rules."); if((is_ipaddrv4($_POST['src']) || is_ipaddrv4($_POST['dst'])) && ($_POST['ipprotocol'] == "inet6")) $input_errors[] = gettext("You can not use IPv4 addresses in IPv6 rules."); + if((is_ipaddr($_POST['src']) || is_ipaddr($_POST['dst'])) && ($_POST['ipprotocol'] == "inet46")) + $input_errors[] = gettext("You can not use a IPv4 or IPv6 address in combined IPv4 + IPv6 rules."); + } if ($_POST['srcbeginport'] > $_POST['srcendport']) { @@ -809,7 +827,7 @@ include("head.inc");