Skip to content

Commit

Permalink
rc: try to avoid pppoe loops by exiting right away
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed May 5, 2017
1 parent 2f715d2 commit 9b4c350
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/etc/rc.newwanip
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface_des
if ($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) {
if (substr($interface_real, 0, 4) != "ovpn") {
if (!empty($config['interfaces'][$interface]['ipaddr'])) {
log_error("rc.newwanip: Failed to update {$interface} IP, restarting...");
configd_run("interface reconfigure {$interface}");
log_error("rc.newwanip: Failed to update {$interface} IP");
return;
}
}
Expand Down
18 changes: 4 additions & 14 deletions src/etc/rc.newwanipv6
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if (is_ipaddrv6($curwanipv6)) {

log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real}).");

$oldipv6 = "";
$oldipv6 = "::";
if (file_exists("/var/db/{$interface}_cacheipv6")) {
$oldipv6 = file_get_contents("/var/db/{$interface}_cacheipv6");
}
Expand All @@ -113,21 +113,8 @@ system_resolvconf_generate();
system_routing_configure($interface);
setup_gateways_monitor();

/* signal filter reload */
filter_configure();

if (is_ipaddrv6($oldipv6)) {
if ($curwanipv6 == $oldipv6) {
// Still need to sync VPNs on PPPoE and such, as even with the same IP the VPN software is unhappy with the IP disappearing.
if (in_array($config['interfaces'][$interface]['ipaddrv6'], array('pppoe', 'pptp', 'ppp'))) {
/* reconfigure IPsec tunnels */
ipsec_configure_do(false, $interface);

/* start OpenVPN server & clients */
if (substr($interface_real, 0, 4) != "ovpn") {
openvpn_resync_all($interface);
}
}
return;
} elseif (does_interface_exist($interface_real)) {
mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete");
Expand All @@ -144,3 +131,6 @@ if (substr($interface_real, 0, 4) != 'ovpn') {
plugins_configure('vpn', false, array($interface));
plugins_configure('newwanip', false, array($interface));
rrd_configure();

/* reload filter, don't try to sync to carp slave */
filter_configure_sync();

4 comments on commit 9b4c350

@fichtner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdSchellevis can you review this? tests ok to improve the reload situation, avoid reconfigure loops, unnecessary filter reload and don't restart VPN anymore in IPv6 PPP cases...

For user comments see f31964a#commitcomment-22067673

@AdSchellevis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fichtner it looks good, but I can't test it at the moment.

@fichtner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for the look. there is more here to do... master is different already but this models around what we need to do. ultimately, one newwanip script will be able to handle both ipv4 and ipv6 at the same time. it will be on master for a while longer to mature, but it's progressing :)

@AdSchellevis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds great!

Please sign in to comment.