Commit 38d70ed7 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) style cleanup rc.newwanip, don't try to loop back to configd if not...

(legacy) style cleanup rc.newwanip, don't try to loop back to configd if not needed. loosly related to https://github.com/opnsense/core/issues/451
parent fdc754e4
......@@ -73,12 +73,13 @@ if (is_array($config['interfaces'][$interface]) && !isset($config['interfaces'][
return;
}
if (empty($argument))
if (empty($argument)) {
$curwanip = get_interface_ip();
else {
} else {
$curwanip = find_interface_ip($interface_real, true);
if($curwanip == "")
if(empty($curwanip)) {
$curwanip = get_interface_ip($interface);
}
}
log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface_descr}[{$interface}]) (real interface: {$interface_real}).");
......@@ -98,36 +99,45 @@ if ($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) {
}
$oldip = "0.0.0.0";
if (file_exists("/var/db/{$interface}_cacheip"))
if (file_exists("/var/db/{$interface}_cacheip")) {
$oldip = file_get_contents("/var/db/{$interface}_cacheip");
} else {
$oldip = "0.0.0.0";
}
/* regenerate resolv.conf if DNS overrides are allowed */
system_resolvconf_generate(true);
/* write the current interface IP to file */
if (is_ipaddr($curwanip))
/* used in src/sbin/dhclient-script.ext */
if (is_ipaddr($curwanip)) {
@file_put_contents("/var/db/{$interface}_ip", $curwanip);
}
link_interface_to_vips($interface, "update");
unset($gre);
$gre = link_interface_to_gre($interface);
if (!empty($gre))
if (!empty($gre)) {
array_walk($gre, 'interface_gre_configure');
unset($gif);
}
$gif = link_interface_to_gif($interface);
if (!empty($gif))
if (!empty($gif)) {
array_walk($gif, 'interface_gif_configure');
}
$grouptmp = link_interface_to_group($interface);
if (!empty($grouptmp))
if (!empty($grouptmp)) {
array_walk($grouptmp, 'interface_group_add_member');
}
unset($bridgetmp);
$bridgetmp = link_interface_to_bridge($interface);
if (!empty($bridgetmp))
if (!empty($bridgetmp)) {
interface_bridge_add_member($bridgetmp, $interface_real);
}
/* make new hosts file */
system_hosts_generate();
......@@ -142,8 +152,9 @@ if (isset($config['interfaces'][$interface]['ipaddrv6'])) {
interface_6rd_configure($interface, $config['interfaces'][$interface]);
break;
case "dhcp6":
if (isset($config['interfaces'][$interface]['dhcp6usev4iface']))
if (isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
interface_dhcpv6_configure($interface, $config['interfaces'][$interface]);
}
break;
}
}
......@@ -153,13 +164,12 @@ if(isset($config['gifs']['gif']) && is_array($config['gifs']['gif'])){
foreach($config['gifs']['gif'] as $gif) {
if($gif['if'] == $interface) {
foreach($config['interfaces'] as $ifname => $ifparent) {
// echo "interface $ifparent, ifname $ifname, gif {$gif['gifif']}\n";
if(($ifparent['if'] == $gif['gifif']) && (isset($ifparent['enable']))) {
// echo "Running routing configure for $ifname\n";
$gif['gifif'] = interface_gif_configure($gif);
$confif = convert_real_interface_to_friendly_interface_name($gif['gifif']);
if ($confif <> "")
if (!empty($confif)) {
interface_configure($confif);
}
system_routing_configure($ifname);
}
}
......@@ -179,8 +189,9 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
/* reconfigure our gateway monitor */
setup_gateways_monitor();
if (is_ipaddr($curwanip))
if (is_ipaddr($curwanip)) {
@file_put_contents("/var/db/{$interface}_cacheip", $curwanip);
}
/* perform RFC 2136 DNS update */
services_dnsupdate_process($interface);
......@@ -192,8 +203,9 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
vpn_ipsec_force_reload($interface);
/* start OpenVPN server & clients */
if (substr($interface_real, 0, 4) != "ovpn")
if (substr($interface_real, 0, 4) != "ovpn") {
openvpn_resync_all($interface);
}
/* reload graphing functions */
enable_rrd_graphing();
......@@ -208,5 +220,5 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
system_ntp_configure(false);
}
/* signal filter reload */
filter_configure();
/* reload filter, don't try to sync to carp slave */
filter_configure_sync();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment