Skip to content

Instantly share code, notes, and snippets.

@SoerenBusse
Last active May 14, 2023 15:57
Show Gist options
  • Select an option

  • Save SoerenBusse/fb0b91b65ae1b9f5c3d1fd9ee22248ad to your computer and use it in GitHub Desktop.

Select an option

Save SoerenBusse/fb0b91b65ae1b9f5c3d1fd9ee22248ad to your computer and use it in GitHub Desktop.
This patch will add the radvd "DeprecatePrefix" option to EdgeRouters configuration tree

Setup debian repository and install required packages

configure
set system package repository stretch components 'main contrib non-free' 
set system package repository stretch distribution stretch
set system package repository stretch url http://archive.debian.org/debian
sudo apt update
sudo apt install patch

Apply patch

sudo -i

# Download Patch File via curl -o

mkdir /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ipv6/router-advert/prefix/node.tag/deprecate-prefix
cat >/opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ipv6/router-advert/prefix/node.tag/deprecate-prefix/node.def <<EOF
type: bool
help: Flag whether a prefix should be deprecated when radvd is shutdown

default: false
EOF

cp /opt/vyatta/sbin/vyatta_gen_radvd.pl /opt/vyatta/sbin/vyatta_gen_radvd.pl.backup
patch /opt/vyatta/sbin/vyatta_gen_radvd.pl < ./gen_radvd.pl.patch
rm gen_radvd.pl.patch
exit

Configuration Example

set interfaces ethernet eth0 ipv6 router-advert prefix ::/64 deprecate-prefix true

Unapply patch

sudo mv /opt/vyatta/sbin/vyatta_gen_radvd.pl.backup /opt/vyatta/sbin/vyatta_gen_radvd.pl
sudo rm -r /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ipv6/router-advert/prefix/node.tag/deprecate-prefix
--- /opt/vyatta/sbin/vyatta_gen_radvd.pl.backup 2023-05-14 15:44:31.833972253 +0000
+++ /opt/vyatta/sbin/vyatta_gen_radvd.pl 2023-05-14 15:45:12.261402482 +0000
@@ -184,7 +184,8 @@
my %prefix_param_hash = ( 'AdvValidLifetime' => '2592000',
'AdvOnLink' => 'on',
'AdvPreferredLifetime' => '-1',
- 'AdvAutonomous' => 'on' );
+ 'AdvAutonomous' => 'on',
+ 'DeprecatePrefix' => 'on' );
my @prefix_params = $config->listNodes("$param_root prefix $prefix");
log_msg("prefix_params for prefix $prefix: @prefix_params\n");
@@ -212,6 +213,12 @@
$prefix_param_hash{'AdvValidLifetime'} = $value;
} elsif ($prefix_param eq "preferred-lifetime") {
$prefix_param_hash{'AdvPreferredLifetime'} = $value;
+ } elsif ($prefix_param eq "deprecate-prefix") {
+ if ($value eq "true") {
+ $prefix_param_hash{'DeprecatePrefix'} = 'on';
+ } else {
+ $prefix_param_hash{'DeprecatePrefix'} = 'off';
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment