diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-12-28 14:16:32 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-12-28 14:16:32 +0100 |
commit | 2660561453274a0162e226722ecf436f4012ca69 (patch) | |
tree | 3cf47bfba16dc03b97ac75220a2533ff87204080 /scripts/vyatta-update-arp-params | |
parent | cf0bfe70fb855cfffd663d8453ecd17ca99ebb6d (diff) | |
download | vyatta-cfg-system-2660561453274a0162e226722ecf436f4012ca69.tar.gz vyatta-cfg-system-2660561453274a0162e226722ecf436f4012ca69.zip |
T1912: migrate 'system ip(v6)' subsystem to XML/Python
Diffstat (limited to 'scripts/vyatta-update-arp-params')
-rwxr-xr-x | scripts/vyatta-update-arp-params | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/scripts/vyatta-update-arp-params b/scripts/vyatta-update-arp-params deleted file mode 100755 index 36275731..00000000 --- a/scripts/vyatta-update-arp-params +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash -# -# Module: vyatta-update-arp-params -# -# **** 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. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2009 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Mohit Mehta -# Date: February 2009 -# Description: Update [ARP (IPv4)|Neighbor (IPV6)] Parameters -# -# **** End License **** -# - -# -# subroutines -# - -print_usage() -{ - echo "Usage:" - echo -e "\t$0 syntax-check <type of arp paramter> <value of arp paramter> <ipv4/ipv6>" - echo -e "\t$0 update <type of arp paramter> <value of arp paramter> <ipv4/ipv6>" - echo -e "\t$0 delete <type of arp paramter> <ipv4/ipv6>" -} - -set_table_thresholds() { - local ip_type=$1 - local arp_value=$2 - local softmax=$((arp_value / 2)); - local min=$((arp_value / 8)); - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh3=$arp_value - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh2=$softmax - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh1=$min -} - -syntax_arp_param () -{ - local arp_type=$1 - local arp_value=$2 - local ip_type=$3 - - case "$arp_type" in - - table-size) - local allowed_values=(1024 2048 4096 8192 16384 32768) - local i - for i in ${allowed_values[@]}; do - if [[ "$i" == "$arp_value" ]]; then - exit 0 - fi - done - echo "Allowed values for ARP table-size - ${allowed_values[*]}" - exit 1 - ;; - - *) - echo Invalid arp parameter $arp_type to set - exit 1 - ;; - esac -} - -update_arp_param () -{ - local arp_type=$1 - local arp_value=$2 - local ip_type=$3 - case "$arp_type" in - - table-size) - set_table_thresholds $ip_type $arp_value - ;; - - *) - echo Invalid arp parameter $arp_type to update - ;; - esac -} - -# -# main -# - -case "$1" in - syntax-check) - if [ $# -ne 4 ]; then - print_usage - exit 1 - fi - syntax_arp_param $2 $3 $4 - ;; - - update) - if [ $# -ne 4 ]; then - print_usage - exit 1 - fi - update_arp_param $2 $3 $4 - ;; - - *) - print_usage - exit 1 - ;; - -esac - -exit 0 - -# end of file |