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
Hide 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()
if
(
!
is_ipaddr
(
$rg
))
{
$filterdns_list
[]
=
"
{
$rg
}
"
;
add_hostname_to_watch
(
$rg
);
if
(
!
file_exists
(
"/var/run/booting"
))
{
$rg
=
resolve_retry
(
$rg
);
}
...
...
src/etc/inc/pfsense-utils.inc
View file @
7bcc88ce
...
...
@@ -215,39 +215,6 @@ function reload_ttys()
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
)
{
$hostname
=
false
;
if
(
preg_match
(
"/[-A-Z0-9\.]+\.[-A-Z0-9\.]+/i"
,
$fqdn
))
{
...
...
src/etc/inc/system.inc
View file @
7bcc88ce
...
...
@@ -2,6 +2,7 @@
/*
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>
All rights reserved.
...
...
@@ -583,19 +584,10 @@ function system_routing_configure($interface = '')
return
0
;
}
/* Compare the current hostname DNS to the DNS cache we made
* if it has changed we return the old records
* if no change we return false */
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
=
""
;
}
function
add_hostname_to_watch
(
$hostname
)
{
$result
=
array
();
if
((
is_fqdn
(
$hostname
))
&&
(
!
is_ipaddr
(
$hostname
)))
{
$domrecords
=
array
();
$domips
=
array
();
...
...
@@ -617,14 +609,12 @@ function compare_hostname_to_dnscache($hostname) {
$contents
.=
"
$ip
\n
"
;
}
}
}
if
(
trim
(
$oldcontents
)
!=
trim
(
$contents
))
{
log_error
(
sprintf
(
'DNSCACHE: Found old IP %s and new IP %s'
,
$oldcontents
,
$contents
));
return
(
$oldcontents
);
}
else
{
return
false
;
/* Remove empty elements */
$result
=
array_filter
(
explode
(
"
\n
"
,
$contents
),
'strlen'
);
}
return
$result
;
}
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