1
|
#!/usr/local/bin/php-cgi -f
|
2
|
<?php
|
3
|
/*
|
4
|
* rc.newroutedns
|
5
|
*
|
6
|
* part of pfSense (https://www.pfsense.org)
|
7
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
8
|
* All rights reserved.
|
9
|
*
|
10
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
* you may not use this file except in compliance with the License.
|
12
|
* You may obtain a copy of the License at
|
13
|
*
|
14
|
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
*
|
16
|
* Unless required by applicable law or agreed to in writing, software
|
17
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
* See the License for the specific language governing permissions and
|
20
|
* limitations under the License.
|
21
|
*/
|
22
|
|
23
|
/* parse the configuration and include all functions used below */
|
24
|
require_once("util.inc");
|
25
|
require_once("config.inc");
|
26
|
require_once("functions.inc");
|
27
|
require_once("system.inc");
|
28
|
|
29
|
/* make sure to wait until the boot scripts have finished */
|
30
|
if (file_exists("{$g['varrun_path']}/booting")) {
|
31
|
return;
|
32
|
}
|
33
|
|
34
|
// Get enabled static routes
|
35
|
$staticroutes = get_staticroutes(false, false, true);
|
36
|
|
37
|
if (count($staticroutes)) {
|
38
|
log_error("Static Routes: One or more aliases used for routing has changed its IP. Refreshing.");
|
39
|
} else {
|
40
|
return;
|
41
|
}
|
42
|
|
43
|
$routelck = lock('routedns', LOCK_EX);
|
44
|
|
45
|
/* We will walk the list of hostnames found in static routes
|
46
|
* configuration. Since we are already triggered by filterdns
|
47
|
* that a hostname has changed we can proceed to compare the
|
48
|
* new IP address with the old address from the DNS cache.
|
49
|
*/
|
50
|
system_staticroutes_configure();
|
51
|
|
52
|
unlock($routelck);
|
53
|
?>
|