-
-
Save nna774/7ec7481a0f8ef8dc96a8627964507ab1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
temp="node.def" | |
interface_templates_dir=/opt/vyatta/share/vyatta-cfg/templates/interfaces | |
ip4ip6_dir=`find ${interface_templates_dir} -type d -name node\.tag | egrep '\/ipv6-tunnel\/node\.tag$'` | |
ip4ip6_encaplimit_dir="${ip4ip6_dir}/encaplimit" | |
ip4ip4_dir=`find ${interface_templates_dir} -type d -name node\.tag | egrep '\/tunnel\/node\.tag$'` | |
ip4ip4_encaplimit_dir="${ip4ip4_dir}/encaplimit" | |
if [ ! -e ${ip4ip6_encaplimit_dir} ]; then | |
echo "Creating ${ip4ip6_encaplimit_dir}" | |
sudo mkdir ${ip4ip6_encaplimit_dir} | |
fi | |
cat << 'EOF' > ${temp} | |
type: txt | |
help: Encaplimit field | |
val_help: txt; Encaplimit (default 4) | |
val_help: <0-255>; Sets a fixed encapsulation limit. Default is 4. | |
val_help: none; Sets no encapsulation limit. | |
syntax:expression: ($VAR(@) == "none" || (pattern $VAR(@) "[0-9]*")) ; "Must be 'none' or a number between 0-255" | |
update: sudo ip -6 tunnel change $VAR(../@) encaplimit $VAR(@); | |
delete: sudo ip -6 tunnel change $VAR(../@) encaplimit 4 | |
EOF | |
sudo mv ${temp} ${ip4ip6_encaplimit_dir} | |
if [ ! -e ${ip4ip4_encaplimit_dir} ]; then | |
echo "Creating ${ip4ip4_encaplimit_dir}" | |
sudo mkdir ${ip4ip4_encaplimit_dir} | |
fi | |
cat << 'EOF' > ${temp} | |
type: txt | |
help: Encaplimit field | |
val_help: txt; Encaplimit (default 4) | |
val_help: <0-255>; Sets a fixed encapsulation limit. Default is 4. | |
val_help: none; Sets no encapsulation limit. | |
syntax:expression: ($VAR(@) == "none" || (pattern $VAR(@) "[0-9]*")) ; "Must be 'none' or a number between 0-255" | |
update: sudo ip tunnel change $VAR(../@) encaplimit $VAR(@); | |
delete: sudo ip tunnel change $VAR(../@) encaplimit 4 | |
EOF | |
sudo mv ${temp} ${ip4ip4_encaplimit_dir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment