Project

General

Profile

Download (1.73 KB) Statistics
| Branch: | Tag: | Revision:
1 cb7d18d5 Renato Botelho
#!/usr/local/bin/php-cgi -f
2 514123f8 Ermal
<?php
3
/*
4 ac24dc24 Renato Botelho
 * rc.dyndns.update
5
 *
6
 * part of pfSense (https://www.pfsense.org)
7 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
8
 * Copyright (c) 2013-2016 Electric Sheep Fencing
9 8f2f85c3 Luiz Otavio O Souza
 * Copyright (c) 2014-2022 Rubicon Communications, LLC (Netgate)
10 ac24dc24 Renato Botelho
 * All rights reserved.
11
 *
12 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
13
 * you may not use this file except in compliance with the License.
14
 * You may obtain a copy of the License at
15 ac24dc24 Renato Botelho
 *
16 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
17 ac24dc24 Renato Botelho
 *
18 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
19
 * distributed under the License is distributed on an "AS IS" BASIS,
20
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
 * See the License for the specific language governing permissions and
22
 * limitations under the License.
23 ac24dc24 Renato Botelho
 */
24 514123f8 Ermal
25
require_once("config.inc");
26 afa32fcc Ermal
require_once("gwlb.inc");
27 514123f8 Ermal
require_once("functions.inc");
28
require_once("filter.inc");
29
require_once("shaper.inc");
30
31
/* Interface IP address has changed */
32
33 e173dd74 Phil Davis
if (isset($_GET['dyndns'])) {
34 c71b14fd Ermal
	$argument = $_GET['dyndns'];
35 e173dd74 Phil Davis
} else {
36 c71b14fd Ermal
	$argument = trim($argv[1], " \n");
37 e173dd74 Phil Davis
}
38 514123f8 Ermal
39 e173dd74 Phil Davis
if (empty($argument) || $argument == "all") {
40 514123f8 Ermal
	services_dyndns_configure();
41
	services_dnsupdate_process();
42
} else {
43 155362f7 Ermal
	$interface = lookup_gateway_interface_by_name($argument);
44 e173dd74 Phil Davis
	if (empty($interface)) {
45 155362f7 Ermal
		$interface = $argument;
46 e173dd74 Phil Davis
	}
47 155362f7 Ermal
	services_dyndns_configure($interface);
48
	services_dnsupdate_process($interface);
49 b85557f4 Viktor G
50
	/* check if this interface is used by gateway groups,
51
	 * see https://redmine.pfsense.org/issues/9435 */
52 d6eecfdc Viktor G
	$gateways = gateway_is_gwgroup_member($argument);
53
	if (is_array($gateways) && !empty($gateways)) {
54
		foreach ($gateways as $gw) {
55
			services_dyndns_configure($gw);
56
			services_dnsupdate_process($gw);
57
		}
58 b85557f4 Viktor G
	}
59 514123f8 Ermal
}
60
61
?>