diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | etc/init.d/vyos-intfwatchd | 87 | ||||
-rw-r--r-- | scripts/vyos-intfwatchd | 160 | ||||
-rw-r--r-- | sysconf/vyatta-sysctl.conf | 4 |
4 files changed, 4 insertions, 249 deletions
diff --git a/Makefile.am b/Makefile.am index 593f83d0..3e70ca59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,6 @@ checkparamsonreboot_DATA += scripts/check-params-on-reboot.d/README initd_SCRIPTS += etc/init.d/ec2-vyos-init initd_SCRIPTS += etc/init.d/vyatta-config-reboot-params -initd_SCRIPTS += etc/init.d/vyos-intfwatchd checkparamsonreboot_SCRIPTS += scripts/check-params-on-reboot.d/ipv6_disable_blacklist @@ -79,7 +78,6 @@ sbin_SCRIPTS += scripts/vyatta-bridge.pl sbin_SCRIPTS += scripts/vyatta-bridgegroup-depedency.pl sbin_SCRIPTS += scripts/vyatta-dhcpv6-client.pl sbin_SCRIPTS += scripts/vyatta-update-grub.pl -sbin_SCRIPTS += scripts/vyos-intfwatchd sbin_SCRIPTS += scripts/ec2-check.pl sbin_SCRIPTS += scripts/is_port_available.pl sbin_SCRIPTS += scripts/vyos-persistpath diff --git a/etc/init.d/vyos-intfwatchd b/etc/init.d/vyos-intfwatchd deleted file mode 100755 index 6c5907a5..00000000 --- a/etc/init.d/vyos-intfwatchd +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh - -### BEGIN INIT INFO -# Provides: vyos-intfwatchd -# Required-Start: vyatta-router -# Required-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: -# Short-Description: Interface status monitoring daemon -### END INIT INFO - -set -e - -# /etc/init.d/vyos-intfwatchd: start and stop the event watching daemon - -test -x /opt/vyatta/sbin/vyos-intfwatchd || exit 0 - -umask 022 - -. /lib/lsb/init-functions - -if [ -n "$2" ]; then - EWD_OPTS="$EWD_OPTS $2" -fi - -# Are we running from init? -run_by_init() { - ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] -} - -check_dev_null() { - if [ ! -c /dev/null ]; then - if [ "$1" = log_end_msg ]; then - log_end_msg 1 || true - fi - if ! run_by_init; then - log_action_msg "/dev/null is not a character device!" - fi - exit 1 - fi -} - -export PATH="${PATH:+$PATH:}/usr/sbin:/sbin:/usr/bin:/opt/vyatta/sbin" - -case "$1" in - start) - check_dev_null - log_daemon_msg "Starting vyos-intfwatchd" "vyos-intfwatchd" - if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/vyos-intfwatchd.pid --exec /opt/vyatta/sbin/vyos-intfwatchd -- $EWD_OPTS; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping vyos-intfwatchd" "vyos-intfwatchd" - VI_PID=`cat /var/run/vyos-intfwatchd.pid` - for p in `pgrep -P $VI_PID`; do - kill $p - done - if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/vyos-intfwatchd.pid; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - restart) - log_daemon_msg "Restarting vyos-intfwatchd" "vyos-intfwatchd" - start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/vyos-intfwatchd.pid - check_for_no_start log_end_msg - check_dev_null log_end_msg - if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/vyos-intfwatchd.pid --exec /opt/vyatta/sbin/vyos-intfwatchd -- $EWD_OPTS; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - status) - status_of_proc -p /var/run/vyos-intfwatchd.pid /opt/vyatta/sbin/vyos-intfwatchd vyos-intfwatchd && exit 0 || exit $? - ;; - - *) - log_action_msg "Usage: /etc/init.d/vyos-intfwatchd {start|stop|restart|status}" - exit 1 -esac - -exit 0 diff --git a/scripts/vyos-intfwatchd b/scripts/vyos-intfwatchd deleted file mode 100644 index b8bde3f3..00000000 --- a/scripts/vyos-intfwatchd +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/perl -# -# Module: vyos-restore-static-ipv6.pl -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# Copyright (C) 2014 VyOS Development Group -# -# **** End License **** - -use lib "/opt/vyatta/share/perl5"; -use strict; -use warnings; -use POSIX; -use Fcntl; -use Sys::Syslog; -use Vyatta::Config; -use Vyatta::Interface; -use Data::Dumper; - -use constant -{ - # Program settings - PROGRAM_NAME => "vyos-intfwatchd", - PROGRAM_VERSION => "1.0", - PID_FILE => "/var/run/vyos-intfwatchd.pid", - - # Program exit codes - SUCCESS => 0, - ERROR => 1, - - # Subroutine error codes - SUB_ERROR => 0, - SUB_SUCCESS => 1, - - # Fcntl file lock/unlock constants - SET_EXCLUSIVE_LOCK => 2, - UNLOCK => 8 -}; - -my $debug = 0; - -sub daemonize -{ - syslog("info", "%s", "Starting in daemon mode"); - - my $pid = fork(); - if (!defined($pid)) - { - # Fork failed - die "Could not spawn child process: $!, exiting"; - } - elsif ($pid > 0) - { - # Child has been spawned succefully, - # parent should terminate now - exit(SUCCESS); - } - chdir("/"); - umask(0); - setsid(); - - # Close standard i/o stream descriptors - open STDIN, "/dev/null" or die "Can't read /dev/null: $!"; - open STDOUT, ">>/dev/null" or die "Can't write to /dev/null: $!"; - open STDERR, ">>/dev/null" or die "Can't write to /dev/null: $!"; -} - -sub writePid -{ - my ($pid, $fh) = @_; - - unless (flock($fh, SET_EXCLUSIVE_LOCK)) - { - syslog("err", "%s", "Could not lock PID file: $!"); - exit(ERROR); - } - - print($fh $pid); -} - -sub releasePid -{ - my $fh = shift; - flock($fh, UNLOCK); - close($fh); - unlink(PID_FILE); -} - - -daemonize(); -my $pidFile = PID_FILE; -unless (open PID_HANDLE, ">$pidFile") -{ - syslog("err", "%s", "Could not create PID file: $!"); - exit(1); -} -writePid($$, \*PID_HANDLE); - -my $config = new Vyatta::Config(); - -my $ip_monitor = "ip monitor link"; -unless (open(HANDLE, "$ip_monitor|")) -{ - syslog("err", "%s", qq{Could not start IP monitor: $!\n}); - exit(1); -} - -sub terminate -{ - my $error = shift; - syslog("notice", "%s", PROGRAM_NAME." is terminating"); - releasePid(\*PID_HANDLE); - exit(0); -} - -$SIG{'INT'} = \&terminate; -$SIG{'TERM'} = \&terminate; -$SIG{'KILL'} = sub { exit(0); }; - -# This solution should be bad enough to be fixed immediately -# when feasible. - -while(<HANDLE>) -{ - if( $_ =~ /^[0-9]+:\s+([^@]+)(@.*)*:\s+<.*UP,.*>/ ) - { - my $intf_name = $1; - my $intf = new Vyatta::Interface($intf_name); - my $intf_addr_path = $intf->path() . " address"; - - # Get IPv6 addresses - my @addresses = grep /:/, $config->returnEffectiveValues($intf_addr_path); - print Dumper(@addresses) if $debug; - - foreach my $address (@addresses) - { - system("ip address add $address dev $intf_name"); - if( $? != 0 ) - { - syslog("err", "%s", "Could not add address $address: $!"); - } - else - { - syslog("notice", "%s", "Restoring address $address on interface $intf_name"); - } - } - - $intf = undef; - } -} - diff --git a/sysconf/vyatta-sysctl.conf b/sysconf/vyatta-sysctl.conf index 3fe560b6..3e5717f1 100644 --- a/sysconf/vyatta-sysctl.conf +++ b/sysconf/vyatta-sysctl.conf @@ -67,3 +67,7 @@ net.ipv4.conf.all.send_redirects=1 # Increase size of buffer for netlink net.core.rmem_max=2097152 + +# Do not forget IPv6 addresses when a link goes down +net.ipv6.conf.default.keep_addr_on_down=1 +net.ipv6.conf.all.keep_addr_on_down=1 |