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
aa5fc1bf
Commit
aa5fc1bf
authored
Mar 06, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inc/system: tmp_path extermination
parent
a47ad5e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
system.inc
src/etc/inc/system.inc
+16
-18
No files found.
src/etc/inc/system.inc
View file @
aa5fc1bf
...
@@ -385,7 +385,7 @@ function system_routing_configure($interface = '')
...
@@ -385,7 +385,7 @@ function system_routing_configure($interface = '')
$foundgwv6
=
false
;
$foundgwv6
=
false
;
/* tack on all the hard defined gateways as well */
/* tack on all the hard defined gateways as well */
if
(
is_array
(
$config
[
'gateways'
][
'gateway_item'
]))
{
if
(
is_array
(
$config
[
'gateways'
][
'gateway_item'
]))
{
array_map
(
'unlink'
,
glob
(
"
{
$g
[
'tmp_path'
]
}
/*_defaultgw
{
,v6
}
"
,
GLOB_BRACE
));
array_map
(
'unlink'
,
glob
(
'/tmp/*_defaultgw{,v6}'
,
GLOB_BRACE
));
foreach
(
$config
[
'gateways'
][
'gateway_item'
]
as
$gateway
)
{
foreach
(
$config
[
'gateways'
][
'gateway_item'
]
as
$gateway
)
{
if
(
isset
(
$gateway
[
'defaultgw'
]))
{
if
(
isset
(
$gateway
[
'defaultgw'
]))
{
if
(
$gateway
[
'ipprotocol'
]
!=
"inet6"
&&
(
is_ipaddrv4
(
$gateway
[
'gateway'
])
||
$gateway
[
'gateway'
]
==
"dynamic"
))
{
if
(
$gateway
[
'ipprotocol'
]
!=
"inet6"
&&
(
is_ipaddrv4
(
$gateway
[
'gateway'
])
||
$gateway
[
'gateway'
]
==
"dynamic"
))
{
...
@@ -398,7 +398,7 @@ function system_routing_configure($interface = '')
...
@@ -398,7 +398,7 @@ function system_routing_configure($interface = '')
if
(
!
empty
(
$gateway
[
'interface'
]))
{
if
(
!
empty
(
$gateway
[
'interface'
]))
{
$defaultif
=
get_real_interface
(
$gateway
[
'interface'
]);
$defaultif
=
get_real_interface
(
$gateway
[
'interface'
]);
if
(
$defaultif
)
if
(
$defaultif
)
@
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$defaultif
}
_defaultgw"
,
$gateway
[
'gateway'
]);
@
file_put_contents
(
"
/tmp
/
{
$defaultif
}
_defaultgw"
,
$gateway
[
'gateway'
]);
}
}
$foundgw
=
true
;
$foundgw
=
true
;
}
else
if
(
$gateway
[
'ipprotocol'
]
==
"inet6"
&&
(
is_ipaddrv6
(
$gateway
[
'gateway'
])
||
$gateway
[
'gateway'
]
==
"dynamic"
))
{
}
else
if
(
$gateway
[
'ipprotocol'
]
==
"inet6"
&&
(
is_ipaddrv6
(
$gateway
[
'gateway'
])
||
$gateway
[
'gateway'
]
==
"dynamic"
))
{
...
@@ -409,7 +409,7 @@ function system_routing_configure($interface = '')
...
@@ -409,7 +409,7 @@ function system_routing_configure($interface = '')
if
(
!
empty
(
$gateway
[
'interface'
]))
{
if
(
!
empty
(
$gateway
[
'interface'
]))
{
$defaultifv6
=
get_real_interface
(
$gateway
[
'interface'
]);
$defaultifv6
=
get_real_interface
(
$gateway
[
'interface'
]);
if
(
$defaultifv6
)
if
(
$defaultifv6
)
@
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$defaultifv6
}
_defaultgwv6"
,
$gateway
[
'gateway'
]);
@
file_put_contents
(
"
/tmp
/
{
$defaultifv6
}
_defaultgwv6"
,
$gateway
[
'gateway'
]);
}
}
$foundgwv6
=
true
;
$foundgwv6
=
true
;
}
}
...
@@ -422,13 +422,13 @@ function system_routing_configure($interface = '')
...
@@ -422,13 +422,13 @@ function system_routing_configure($interface = '')
$defaultif
=
get_real_interface
(
"wan"
);
$defaultif
=
get_real_interface
(
"wan"
);
$interfacegw
=
"wan"
;
$interfacegw
=
"wan"
;
$gatewayip
=
get_interface_gateway
(
"wan"
);
$gatewayip
=
get_interface_gateway
(
"wan"
);
@
touch
(
"
{
$g
[
'tmp_path'
]
}
/
{
$defaultif
}
_defaultgw"
);
@
touch
(
"
/tmp
/
{
$defaultif
}
_defaultgw"
);
}
}
if
(
$foundgwv6
==
false
)
{
if
(
$foundgwv6
==
false
)
{
$defaultifv6
=
get_real_interface
(
"wan"
);
$defaultifv6
=
get_real_interface
(
"wan"
);
$interfacegwv6
=
"wan"
;
$interfacegwv6
=
"wan"
;
$gatewayipv6
=
get_interface_gateway_v6
(
"wan"
);
$gatewayipv6
=
get_interface_gateway_v6
(
"wan"
);
@
touch
(
"
{
$g
[
'tmp_path'
]
}
/
{
$defaultif
}
_defaultgwv6"
);
@
touch
(
"
/tmp
/
{
$defaultif
}
_defaultgwv6"
);
}
}
$dont_add_route
=
false
;
$dont_add_route
=
false
;
/* if OLSRD is enabled, allow WAN to house DHCP. */
/* if OLSRD is enabled, allow WAN to house DHCP. */
...
@@ -915,8 +915,7 @@ function system_generate_lighty_config(
...
@@ -915,8 +915,7 @@ function system_generate_lighty_config(
{
{
global
$config
,
$g
;
global
$config
,
$g
;
if
(
!
is_dir
(
"
{
$g
[
'tmp_path'
]
}
/lighttpdcompress"
))
@
mkdir
(
'/tmp/lighttpdcompress'
);
mkdir
(
"
{
$g
[
'tmp_path'
]
}
/lighttpdcompress"
);
if
(
$captive_portal
!==
false
)
{
if
(
$captive_portal
!==
false
)
{
$captiveportal
=
",
\"
mod_rewrite
\"
,
\"
mod_evasive
\"
"
;
$captiveportal
=
",
\"
mod_rewrite
\"
,
\"
mod_evasive
\"
"
;
...
@@ -927,16 +926,15 @@ function system_generate_lighty_config(
...
@@ -927,16 +926,15 @@ function system_generate_lighty_config(
$maxprocperip
=
10
;
$maxprocperip
=
10
;
$captive_portal_mod_evasive
=
"evasive.max-conns-per-ip =
{
$maxprocperip
}
"
;
$captive_portal_mod_evasive
=
"evasive.max-conns-per-ip =
{
$maxprocperip
}
"
;
$server_upload_dirs
=
"server.upload-dirs = (
\"
{
$g
[
'tmp_path'
]
}
/captiveportal/
\"
)
\n
"
;
$server_upload_dirs
=
"server.upload-dirs = (
\"
/tmp/captiveportal/
\"
)
\n
"
;
if
(
!
is_dir
(
"
{
$g
[
'tmp_path'
]
}
/captiveportal"
))
@
mkdir
(
'/tmp/captiveportal'
,
0555
);
@
mkdir
(
"
{
$g
[
'tmp_path'
]
}
/captiveportal"
,
0555
);
$server_max_request_size
=
"server.max-request-size = 384"
;
$server_max_request_size
=
"server.max-request-size = 384"
;
$cgi_config
=
""
;
$cgi_config
=
""
;
}
else
{
}
else
{
$captiveportal
=
",
\"
mod_cgi
\"
"
;
$captiveportal
=
",
\"
mod_cgi
\"
"
;
$captive_portal_rewrite
=
""
;
$captive_portal_rewrite
=
""
;
$captive_portal_mod_evasive
=
""
;
$captive_portal_mod_evasive
=
""
;
$server_upload_dirs
=
"server.upload-dirs = (
\"
{
$g
[
'upload_path'
]
}
/
\"
,
\"
{
$g
[
'tmp_path'
]
}
/
\"
,
\"
/var/
\"
)
\n
"
;
$server_upload_dirs
=
"server.upload-dirs = (
\"
{
$g
[
'upload_path'
]
}
/
\"
,
\"
/tmp
/
\"
,
\"
/var/
\"
)
\n
"
;
$server_max_request_size
=
"server.max-request-size = 2097152"
;
$server_max_request_size
=
"server.max-request-size = 2097152"
;
$cgi_config
=
"cgi.assign = (
\"
.cgi
\"
=>
\"\"
)"
;
$cgi_config
=
"cgi.assign = (
\"
.cgi
\"
=>
\"\"
)"
;
}
}
...
@@ -983,12 +981,13 @@ server.errorlog-use-syslog="enable"
...
@@ -983,12 +981,13 @@ server.errorlog-use-syslog="enable"
EOD;
EOD;
}
}
if
(
$captive_portal
!==
false
)
if
(
$captive_portal
!==
false
)
{
$fast_cgi_path
=
"
{
$g
[
'tmp_path'
]
}
/php-fastcgi-
{
$captive_portal
}
.socket"
;
$fast_cgi_path
=
"/tmp/php-fastcgi-
{
$captive_portal
}
.socket"
;
else
}
else
{
$fast_cgi_path
=
"
{
$g
[
'tmp_path'
]
}
/php-fastcgi.socket"
;
$fast_cgi_path
=
"/tmp/php-fastcgi.socket"
;
}
$fastcgi_config
=
<<<EOD
$fastcgi_config
=
<<<EOD
#### fastcgi module
#### fastcgi module
## read fastcgi.txt for more info
## read fastcgi.txt for more info
fastcgi.server = ( ".php" =>
fastcgi.server = ( ".php" =>
...
@@ -1007,7 +1006,6 @@ fastcgi.server = ( ".php" =>
...
@@ -1007,7 +1006,6 @@ fastcgi.server = ( ".php" =>
EOD;
EOD;
$lighty_config
=
<<<EOD
$lighty_config
=
<<<EOD
#
#
# lighttpd configuration file
# lighttpd configuration file
...
@@ -1156,7 +1154,7 @@ debug.log-request-handling = "disable"
...
@@ -1156,7 +1154,7 @@ debug.log-request-handling = "disable"
debug.log-file-not-found = "disable"
debug.log-file-not-found = "disable"
# gzip compression
# gzip compression
compress.cache-dir = "
{$g['tmp_path']}
/lighttpdcompress/"
compress.cache-dir = "
/tmp
/lighttpdcompress/"
compress.filetype = ("text/plain","text/css", "text/xml", "text/javascript" )
compress.filetype = ("text/plain","text/css", "text/xml", "text/javascript" )
{$server_upload_dirs}
{$server_upload_dirs}
...
...
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