$ipaddr vs $netaddr

David Miller justdave at bugzilla.org
Tue Jan 20 22:05:54 UTC 2004


On 1/20/2004 1:17 PM -0800, Jon Wilmoth wrote:

> What's the difference between these two variables?
>
> They are populated in the CGI.pl from 2.17.3 in the following manner.
>
> my $ipaddr = $ENV{'REMOTE_ADDR'};
> my $netaddr = get_netaddr($ipaddr);

get_netaddr uses the loginnetmask param to mask the address for the allowed
subnet the user can access from and still keep their cookies.  So if your
loginnetmask is set to 24, get_netaddr will return the user's IP address
with the last 8 bits removed.  If loginnetmask is 32, it'll return the IP
address unchanged.
-- 
Dave Miller      Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/             http://www.bugzilla.org/



More information about the developers mailing list