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
7bcc88ce
Commit
7bcc88ce
authored
Jun 18, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system: there is no dnscache
parent
a9c0cd37
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
53 deletions
+9
-53
ipsec.inc
src/etc/inc/ipsec.inc
+0
-1
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+0
-33
system.inc
src/etc/inc/system.inc
+9
-19
No files found.
src/etc/inc/ipsec.inc
View file @
7bcc88ce
...
@@ -525,7 +525,6 @@ function ipsec_configure()
...
@@ -525,7 +525,6 @@ function ipsec_configure()
if
(
!
is_ipaddr
(
$rg
))
{
if
(
!
is_ipaddr
(
$rg
))
{
$filterdns_list
[]
=
"
{
$rg
}
"
;
$filterdns_list
[]
=
"
{
$rg
}
"
;
add_hostname_to_watch
(
$rg
);
if
(
!
file_exists
(
"/var/run/booting"
))
{
if
(
!
file_exists
(
"/var/run/booting"
))
{
$rg
=
resolve_retry
(
$rg
);
$rg
=
resolve_retry
(
$rg
);
}
}
...
...
src/etc/inc/pfsense-utils.inc
View file @
7bcc88ce
...
@@ -215,39 +215,6 @@ function reload_ttys()
...
@@ -215,39 +215,6 @@ function reload_ttys()
exec
(
'/bin/kill -HUP 1'
);
exec
(
'/bin/kill -HUP 1'
);
}
}
function
add_hostname_to_watch
(
$hostname
)
{
if
(
!
is_dir
(
"/var/db/dnscache"
))
{
mkdir
(
"/var/db/dnscache"
);
}
$result
=
array
();
if
((
is_fqdn
(
$hostname
))
&&
(
!
is_ipaddr
(
$hostname
)))
{
$domrecords
=
array
();
$domips
=
array
();
exec
(
"host -t A "
.
escapeshellarg
(
$hostname
),
$domrecords
,
$rethost
);
if
(
$rethost
==
0
)
{
foreach
(
$domrecords
as
$domr
)
{
$doml
=
explode
(
" "
,
$domr
);
$domip
=
$doml
[
3
];
/* fill array with domain ip addresses */
if
(
is_ipaddr
(
$domip
))
{
$domips
[]
=
$domip
;
}
}
}
sort
(
$domips
);
$contents
=
""
;
if
(
!
empty
(
$domips
))
{
foreach
(
$domips
as
$ip
)
{
$contents
.=
"
$ip
\n
"
;
}
}
file_put_contents
(
"/var/db/dnscache/
$hostname
"
,
$contents
);
/* Remove empty elements */
$result
=
array_filter
(
explode
(
"
\n
"
,
$contents
),
'strlen'
);
}
return
$result
;
}
function
is_fqdn
(
$fqdn
)
{
function
is_fqdn
(
$fqdn
)
{
$hostname
=
false
;
$hostname
=
false
;
if
(
preg_match
(
"/[-A-Z0-9\.]+\.[-A-Z0-9\.]+/i"
,
$fqdn
))
{
if
(
preg_match
(
"/[-A-Z0-9\.]+\.[-A-Z0-9\.]+/i"
,
$fqdn
))
{
...
...
src/etc/inc/system.inc
View file @
7bcc88ce
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/*
/*
Copyright (C) 2016 Franco Fichtner <franco@opnsense.org>
Copyright (C) 2016 Franco Fichtner <franco@opnsense.org>
Copyright (C) 2004-2007 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
All rights reserved.
All rights reserved.
...
@@ -583,19 +584,10 @@ function system_routing_configure($interface = '')
...
@@ -583,19 +584,10 @@ function system_routing_configure($interface = '')
return
0
;
return
0
;
}
}
/* Compare the current hostname DNS to the DNS cache we made
function
add_hostname_to_watch
(
$hostname
)
* if it has changed we return the old records
{
* if no change we return false */
$result
=
array
();
function
compare_hostname_to_dnscache
(
$hostname
)
{
if
(
!
is_dir
(
"/var/db/dnscache"
))
{
mkdir
(
"/var/db/dnscache"
);
}
$hostname
=
trim
(
$hostname
);
if
(
is_readable
(
"/var/db/dnscache/
{
$hostname
}
"
))
{
$oldcontents
=
file_get_contents
(
"/var/db/dnscache/
{
$hostname
}
"
);
}
else
{
$oldcontents
=
""
;
}
if
((
is_fqdn
(
$hostname
))
&&
(
!
is_ipaddr
(
$hostname
)))
{
if
((
is_fqdn
(
$hostname
))
&&
(
!
is_ipaddr
(
$hostname
)))
{
$domrecords
=
array
();
$domrecords
=
array
();
$domips
=
array
();
$domips
=
array
();
...
@@ -617,14 +609,12 @@ function compare_hostname_to_dnscache($hostname) {
...
@@ -617,14 +609,12 @@ function compare_hostname_to_dnscache($hostname) {
$contents
.=
"
$ip
\n
"
;
$contents
.=
"
$ip
\n
"
;
}
}
}
}
}
if
(
trim
(
$oldcontents
)
!=
trim
(
$contents
))
{
/* Remove empty elements */
log_error
(
sprintf
(
'DNSCACHE: Found old IP %s and new IP %s'
,
$oldcontents
,
$contents
));
$result
=
array_filter
(
explode
(
"
\n
"
,
$contents
),
'strlen'
);
return
(
$oldcontents
);
}
else
{
return
false
;
}
}
return
$result
;
}
}
function
system_staticroutes_configure
(
$interface
=
''
)
function
system_staticroutes_configure
(
$interface
=
''
)
...
...
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