Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
de6ef316
Commit
de6ef316
authored
Mar 31, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rmeove unused functions from util.inc
parent
b02cb058
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
106 deletions
+0
-106
util.inc
src/etc/inc/util.inc
+0
-106
No files found.
src/etc/inc/util.inc
View file @
de6ef316
...
...
@@ -148,12 +148,6 @@ function unlock($cfglckkey = 0)
fclose
(
$cfglckkey
);
}
/* unlock forcefully configuration file */
function
unlock_force
(
$lock
)
{
@
unlink
(
"/tmp/
{
$lock
}
.lock"
);
}
function
send_event
(
$cmd
)
{
require_once
(
"script/load_phalcon.php"
);
...
...
@@ -167,61 +161,6 @@ function refcount_init($reference) {
@
shmop_close
(
$shmid
);
}
function
refcount_reference
(
$reference
)
{
/* Take out a lock across the shared memory read, increment, write sequence to make it atomic. */
$shm_lck
=
lock
(
"shm
{
$reference
}
"
,
LOCK_EX
);
try
{
/* NOTE: A warning is generated when shared memory does not exist */
$shmid
=
@
shmop_open
(
$reference
,
"w"
,
0
,
0
);
if
(
!
$shmid
)
{
refcount_init
(
$reference
);
$shmid
=
@
shmop_open
(
$reference
,
"w"
,
0
,
0
);
if
(
!
$shmid
)
{
log_error
(
gettext
(
"Could not open shared memory
{
$reference
}
"
));
unlock
(
$shm_lck
);
return
;
}
}
$shm_data
=
@
shmop_read
(
$shmid
,
0
,
10
);
$shm_data
=
intval
(
$shm_data
)
+
1
;
@
shmop_write
(
$shmid
,
str_pad
(
$shm_data
,
10
,
"
\x0
"
,
STR_PAD_RIGHT
),
0
);
@
shmop_close
(
$shmid
);
unlock
(
$shm_lck
);
}
catch
(
Exception
$e
)
{
log_error
(
$e
->
getMessage
());
unlock
(
$shm_lck
);
}
return
$shm_data
;
}
function
refcount_unreference
(
$reference
)
{
/* Take out a lock across the shared memory read, decrement, write sequence to make it atomic. */
$shm_lck
=
lock
(
"shm
{
$reference
}
"
,
LOCK_EX
);
try
{
$shmid
=
@
shmop_open
(
$reference
,
"w"
,
0
,
0
);
if
(
!
$shmid
)
{
refcount_init
(
$reference
);
log_error
(
gettext
(
"Could not open shared memory
{
$reference
}
"
));
unlock
(
$shm_lck
);
return
;
}
$shm_data
=
@
shmop_read
(
$shmid
,
0
,
10
);
$shm_data
=
intval
(
$shm_data
)
-
1
;
if
(
$shm_data
<
0
)
{
//debug_backtrace();
log_error
(
sprintf
(
gettext
(
"Reference %s is going negative, not doing unreference."
),
$reference
));
}
else
@
shmop_write
(
$shmid
,
str_pad
(
$shm_data
,
10
,
"
\x0
"
,
STR_PAD_RIGHT
),
0
);
@
shmop_close
(
$shmid
);
unlock
(
$shm_lck
);
}
catch
(
Exception
$e
)
{
log_error
(
$e
->
getMessage
());
unlock
(
$shm_lck
);
}
return
$shm_data
;
}
function
refcount_read
(
$reference
)
{
/* This function just reads the current value of the refcount for information. */
...
...
@@ -558,16 +497,6 @@ function is_subnetv6($subnet) {
return
(
is_subnet
(
$subnet
)
==
6
);
}
/* returns true if $subnet is a valid subnet in CIDR format or an alias thereof */
function
is_subnetoralias
(
$subnet
)
{
global
$aliastable
;
if
(
isset
(
$aliastable
[
$subnet
])
&&
is_subnet
(
$aliastable
[
$subnet
]))
return
true
;
else
return
is_subnet
(
$subnet
);
}
/* returns true if $hostname is a valid hostname */
function
is_hostname
(
$hostname
)
{
if
(
!
is_string
(
$hostname
))
...
...
@@ -1215,16 +1144,6 @@ function subnet_size($subnet) {
}
}
function
subnet_expand
(
$subnet
)
{
if
(
is_subnetv4
(
$subnet
))
{
return
subnetv4_expand
(
$subnet
);
}
else
if
(
is_subnetv6
(
$subnet
))
{
return
subnetv6_expand
(
$subnet
);
}
else
{
return
$subnet
;
}
}
function
subnetv4_expand
(
$subnet
)
{
$result
=
array
();
list
(
$ip
,
$bits
)
=
explode
(
"/"
,
$subnet
);
...
...
@@ -1288,23 +1207,6 @@ function ip_in_subnet($addr,$subnet) {
}
}
/* obtain MAC address given an IP address by looking at the ARP table */
function
arp_get_mac_by_ip
(
$ip
)
{
mwexec
(
"/sbin/ping -c 1 -t 1 "
.
escapeshellarg
(
$ip
),
true
);
$arpoutput
=
""
;
exec
(
"/usr/sbin/arp -n "
.
escapeshellarg
(
$ip
),
$arpoutput
);
if
(
$arpoutput
[
0
])
{
$arpi
=
explode
(
" "
,
$arpoutput
[
0
]);
$macaddr
=
$arpi
[
3
];
if
(
is_macaddr
(
$macaddr
))
return
$macaddr
;
else
return
false
;
}
return
false
;
}
/* return a fieldname that is safe for xml usage */
function
xml_safe_fieldname
(
$fieldname
)
{
...
...
@@ -1678,14 +1580,6 @@ function is_URL($url) {
return
false
;
}
function
is_file_included
(
$file
=
""
)
{
$files
=
get_included_files
();
if
(
in_array
(
$file
,
$files
))
return
true
;
return
false
;
}
/*
* Replace a value on a deep associative array using regex
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment