summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/util.inc
diff options
context:
space:
mode:
authormarjohn56 <martin@queens-park.com>2016-12-27 19:57:04 +0000
committerGitHub <noreply@github.com>2016-12-27 19:57:04 +0000
commit2acedbbf6b51b1068e336193eff1ccada4724c1f (patch)
tree0b612d0e885648aa82dad72caf75645ce7da274a /src/etc/inc/util.inc
parent8212a76549de6101984c2dd66d2b0ce8d921c649 (diff)
downloadpfsense-2acedbbf6b51b1068e336193eff1ccada4724c1f.zip
pfsense-2acedbbf6b51b1068e336193eff1ccada4724c1f.tar.gz
Changes as requested
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r--src/etc/inc/util.inc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index 1bf81da..799bafe 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -2543,7 +2543,6 @@ function validateipaddr(&$addr, $type, $label, &$err_msg, $alias=false) {
return false;
}
-
/* returns true if $dhcp6duid is a valid duid entrry */
function is_duid($dhcp6duid) {
$values = explode(":", $dhcp6duid);
@@ -2578,19 +2577,20 @@ function write_dhcp6_duid($duidstring) {
log_error(gettext("Error: attempting to write DUID file - File write error"));
return false;
}
+
/* returns duid string from 'vardb_path']}/dhcp6c_duid' */
function get_duid_from_file()
{
global $g;
+ $duid_ASCII = "";
$count = 0;
if ($fd = fopen("{$g['vardb_path']}/dhcp6c_duid", "r")) {
if(filesize("{$g['vardb_path']}/dhcp6c_duid")==16) {
- $buffer = fread($fd,filesize("{$g['vardb_path']}/dhcp6c_duid"));
- while($count < 16) {
- $a = $buffer[$count];
- $duid_ASCII .= bin2hex($a);
+ $buffer = fread($fd,16);
+ while($count < 16) {
+ $duid_ASCII .= bin2hex($buffer[$count]);
$count++;
if($count < 16) {
$duid_ASCII .= ":";
@@ -2600,7 +2600,7 @@ function get_duid_from_file()
fclose($fd);
}
//if no file or error with read then the string returns blanked DUID string
- if($count != 16) {
+ if(!is_duid($duid_ASCII)) {
return "--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--";
}
return($duid_ASCII);
OpenPOWER on IntegriCloud