I see your point. In this case we know that gen_subnet and gen_subnetv6 can never both return valid data, but maybe it would have been nicer to implement a gen_subnetv4 which does what my patched version does, and a generic gen_subnet function that return either a v4 or a v6 address?

A similar problem is in the filters.inc file where I made a quick'n'dirty check for the presence of a ':' in the address to see whether it's a v4 or v6 address. I couldn't find a helper function that would be able to tell me the type of address...

/wj

On Feb 19, 2013, at 3:21 PM, bcyrill <notifications@github.com> wrote:

> In usr/local/www/firewall_nat_out_edit.php:
> 
> > @@ -209,7 +209,7 @@
> >  	} else if(is_alias($_POST['source'])) {
> >  		$osn = $_POST['source'];
> >  	} else {
> > -		$osn = gen_subnet($_POST['source'], $_POST['source_subnet']) . "/" . $_POST['source_subnet'];
> > +		$osn = gen_subnet($_POST['source'], $_POST['source_subnet']) . gen_subnetv6($_POST['source'], $_POST['source_subnet']) . "/" . $_POST['source_subnet'];
> I would use an additional condition (source being an IPv6 address) instead of just combining both strings and relying on the fact that one of them is empty.
> 
> —
> Reply to this email directly or view it on GitHub.
> 
>