Home » Networking » Net_IPv4 » Bug #2324
The Broadcast Is Calculated wrong.
Details
| Submitted | 2004-09-13 23:50 UTC |
|---|---|
| From | brandon at osuosl dot org |
| Assigned | ekilfoil |
| Status | Suspended |
| Package | Net_IPv4 |
| PHP Version | 5.0.1 |
| OS | Debian Unstable |
| Roadmaps | (Not assigned) |
Comments
[2004-09-13 23:50 UTC] brandon at osuosl dot org
Description:
------------
Using the example code for calculate:
http://dev2.osuosl.org/~philips/ip/
I get a broadcast that doesnt make sense.
Thanks.
Patch (/tmp/IPv4.php == PEAR official version)
*** /tmp/IPv4.php Mon Sep 13 16:48:17 2004
--- /usr/share/php/Net/IPv4.php Mon Sep 13 16:49:09 2004
***************
*** 269,275 ****
}
$this->network = long2ip(ip2long($this->ip) & ip2long($this->netmask));
$this->broadcast = long2ip(ip2long($this->ip) |
! (ip2long($this->netmask) ^ ip2long("255.255.255.255")));
return(TRUE);
}
--- 269,275 ----
}
$this->network = long2ip(ip2long($this->ip) & ip2long($this->netmask));
$this->broadcast = long2ip(ip2long($this->ip) |
! (~(ip2long($this->netmask))));
return(TRUE);
}
Reproduce code:
---------------
http://dev2.osuosl.org/~philips/ip/index.phps
Expected result:
----------------
Your network address: 192.168.1.0
Your netmask address: 255.255.255.128
Your broadcast address: 192.168.1.127
Actual result:
--------------
Your network address: 192.168.1.0
Your netmask address: 255.255.255.128
Your broadcast address: 255.255.255.138