[pve-devel] [PATCH] Added ipv4 validation, forbid network and broadcast addresses

Dietmar Maurer dietmar at proxmox.com
Tue Feb 26 18:06:47 CET 2013


> +    my $binip = Net::IP::ip_iptobin($param->{address}, 4);
> +    my $binmask = Net::IP::ip_iptobin($param->{netmask}, 4);
> +    my $broadcast = Net::IP::ip_to_bin('255.255.255.255', 4);

That is not the broadcast address - you need to compute that (depends on IP/mask)

from wikipedia:
A broadcast address is an address that allows information to be sent to all interfaces in a given subnet, rather than a specific machine. Generally, the broadcast address is found by obtaining the bit complement of the subnet mask and performing a bitwise OR operation with the network identifier. In other words, the broadcast address is the last address in the address range of the subnet.




More information about the pve-devel mailing list