Projet

Général

Profil

Télécharger (2,08 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / etc / rc.newroutedns @ master

1
#!/usr/local/bin/php -f
2
<?php
3
/*
4
	Copyright (C) 2013 Renato Botelho <garga@pfsense.org>.
5
	All rights reserved.
6

    
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9

    
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12

    
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16

    
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28

    
29
/* parse the configuration and include all functions used below */
30
require_once("util.inc");
31
require_once("config.inc");
32
require_once("functions.inc");
33
require_once("system.inc");
34

    
35
/* make sure to wait until the boot scripts have finished */
36
if (file_exists("{$g['varrun_path']}/booting"))
37
	return;
38

    
39
$staticroutes = get_staticroutes();
40

    
41
if (count($staticroutes))
42
	log_error("Static Routes: One or more aliases used for routing has changed its IP. Refreshing.");
43
else
44
	return;
45

    
46
$routelck = lock('routedns', LOCK_EX);
47

    
48
/* We will walk the list of hostnames found in static routes
49
 * configuration. Since we are already triggered by filterdns
50
 * that a hostname has changed we can proceed to compare the
51
 * new IP address with the old address from the DNS cache.
52
 */
53
system_staticroutes_configure();
54

    
55
unlock($routelck);
56
?>
(73-73/103)