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
410a8bc5
Commit
410a8bc5
authored
Apr 01, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: remove the need for PHP's posix extension
parent
3bb1d29e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
23 deletions
+26
-23
interfaces.inc
src/etc/inc/interfaces.inc
+12
-8
ipsec.attributes.php
src/etc/inc/ipsec.attributes.php
+1
-1
openvpn.attributes.php
src/etc/inc/openvpn.attributes.php
+1
-3
openvpn.inc
src/etc/inc/openvpn.inc
+5
-3
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+3
-3
rc.php_ini_setup
src/etc/rc.php_ini_setup
+0
-3
interfaces.php
src/www/interfaces.php
+4
-2
No files found.
src/etc/inc/interfaces.inc
View file @
410a8bc5
...
...
@@ -1296,8 +1296,9 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
case
"slaac"
:
case
"dhcp6"
:
$pidv6
=
find_dhcp6c_process
(
$realif
);
if
(
$pidv6
)
posix_kill
(
$pidv6
,
SIGTERM
);
if
(
$pidv6
)
{
sigkillbypid
(
$pidv6
,
'TERM'
);
}
sleep
(
3
);
unlink_if_exists
(
"
{
$g
[
'varetc_path'
]
}
/dhcp6c_
{
$interface
}
.conf"
);
if
(
does_interface_exist
(
$realifv6
))
{
...
...
@@ -2777,15 +2778,17 @@ function find_dhclient_process($interface) {
return
intval
(
$pid
);
}
function
kill_dhclient_process
(
$interface
)
{
if
(
empty
(
$interface
)
||
!
does_interface_exist
(
$interface
))
function
kill_dhclient_process
(
$interface
)
{
if
(
empty
(
$interface
)
||
!
does_interface_exist
(
$interface
))
{
return
;
}
$i
=
0
;
while
(((
$pid
=
find_dhclient_process
(
$interface
))
!=
0
)
&&
(
$i
<
3
))
{
/* 3rd time make it die for sure */
$sig
=
(
$i
==
2
?
SIGKILL
:
SIGTERM
);
posix_kill
(
$pid
,
$sig
);
$sig
=
(
$i
==
2
?
'KILL'
:
'TERM'
);
sigkillbypid
(
$pid
,
$sig
);
sleep
(
1
);
$i
++
;
}
...
...
@@ -3217,8 +3220,9 @@ function interface_track6_configure($interface = "lan", $wancfg, $linkupevent =
*/
$parentrealif
=
get_real_interface
(
$wancfg
[
'track6-interface'
]);
$pidv6
=
find_dhcp6c_process
(
$parentrealif
);
if
(
$pidv6
)
posix_kill
(
$pidv6
,
SIGHUP
);
if
(
$pidv6
)
{
sigkillbypid
(
$pidv6
,
'HUP'
);
}
}
break
;
}
...
...
src/etc/inc/ipsec.attributes.php
View file @
410a8bc5
...
...
@@ -176,7 +176,7 @@ function parse_cisco_acl($attribs) {
$rules
=
parse_cisco_acl
(
$attributes
);
if
(
!
empty
(
$rules
))
{
$pid
=
posix_get
pid
();
$pid
=
getmy
pid
();
@
file_put_contents
(
"/tmp/ipsec_
{
$pid
}{
$common_name
}
.rules"
,
$rules
);
mwexec
(
"/sbin/pfctl -a "
.
escapeshellarg
(
"ipsec/
{
$common_name
}
"
)
.
" -f /tmp/ipsec_
{
$pid
}
"
.
escapeshellarg
(
$common_name
)
.
".rules"
);
@
unlink
(
"/tmp/ipsec_
{
$pid
}{
$common_name
}
.rules"
);
...
...
src/etc/inc/openvpn.attributes.php
View file @
410a8bc5
...
...
@@ -178,10 +178,8 @@ function parse_cisco_acl($attribs) {
$rules
=
parse_cisco_acl
(
$attributes
);
if
(
!
empty
(
$rules
))
{
$pid
=
posix_get
pid
();
$pid
=
getmy
pid
();
@
file_put_contents
(
"/tmp/ovpn_
{
$pid
}{
$common_name
}
.rules"
,
$rules
);
mwexec
(
"/sbin/pfctl -a "
.
escapeshellarg
(
"openvpn/
{
$common_name
}
"
)
.
" -f /tmp/ovpn_
{
$pid
}
"
.
escapeshellarg
(
$common_name
)
.
".rules"
);
@
unlink
(
"/tmp/ovpn_
{
$pid
}{
$common_name
}
.rules"
);
}
?>
src/etc/inc/openvpn.inc
View file @
410a8bc5
...
...
@@ -33,6 +33,7 @@ require_once('config.inc');
require_once
(
'certs.inc'
);
require_once
(
'pfsense-utils.inc'
);
require_once
(
'auth.inc'
);
require_once
(
'util.inc'
);
global
$openvpn_prots
;
$openvpn_prots
=
array
(
"UDP"
,
"UDP6"
,
"TCP"
,
"TCP6"
);
...
...
@@ -824,11 +825,12 @@ function openvpn_restart($mode, $settings) {
unlink
(
$pfile
);
/* send a term signal to the process */
posix_kill
(
$pid
,
SIGTERM
);
sigkillbypid
(
$pid
,
'TERM'
);
/* wait until the process exits */
while
(
posix_kill
(
$pid
,
0
))
while
(
isvalidpid
(
$pid
))
{
usleep
(
250000
);
}
}
if
(
isset
(
$settings
[
'disable'
]))
...
...
@@ -881,7 +883,7 @@ function openvpn_delete($mode, & $settings) {
unlink
(
$pfile
);
/* send a term signal to the process */
posix_kill
(
$pid
,
SIGTERM
);
sigkillbypid
(
$pid
,
'TERM'
);
}
/* remove the device from the openvpn group */
...
...
src/etc/inc/pfsense-utils.inc
View file @
410a8bc5
...
...
@@ -768,11 +768,11 @@ function is_serial_enabled()
function
reload_ttys
()
{
// Send a HUP signal to init will make it reload /etc/ttys
posix_kill
(
1
,
SIGHUP
);
/* Send a HUP signal to init will make it reload /etc/ttys */
require_once
(
'util.inc'
);
sigkillbypid
(
1
,
'HUP'
);
}
/* DHCP enabled on any interfaces? */
function
is_dhcp_server_enabled
()
{
global
$config
;
...
...
src/etc/rc.php_ini_setup
View file @
410a8bc5
...
...
@@ -48,9 +48,6 @@ PHPMODULES="$PHPMODULES hash"
PHPMODULES
=
"
$PHPMODULES
mcrypt"
# Regexs, PERL style!
PHPMODULES
=
"
$PHPMODULES
pcre"
# The mighty posix!
PHPMODULES
=
"
$PHPMODULES
posix"
PHPMODULES
=
"
$PHPMODULES
readline"
# Login sessions
PHPMODULES
=
"
$PHPMODULES
session"
# Extra sanity seatbelts
...
...
src/www/interfaces.php
View file @
410a8bc5
...
...
@@ -38,6 +38,7 @@ require_once("filter.inc");
require_once
(
"shaper.inc"
);
require_once
(
"rrd.inc"
);
require_once
(
"vpn.inc"
);
require_once
(
"util.inc"
);
require_once
(
"xmlparse_attr.inc"
);
$referer
=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/interfaces.php'
);
...
...
@@ -787,8 +788,9 @@ if ($_POST['apply']) {
}
if
(
$wancfg
[
'ipaddrv6'
]
==
"dhcp6"
)
{
$pid
=
find_dhcp6c_process
(
$wancfg
[
'if'
]);
if
(
$pid
)
posix_kill
(
$pid
,
SIGTERM
);
if
(
$pid
)
{
sigkillbypid
(
$pid
,
'TERM'
);
}
}
}
$ppp
=
array
();
...
...
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