diff options
author | James Davidson <james.davidson@vyatta.com> | 2013-01-08 14:54:19 -0800 |
---|---|---|
committer | James Davidson <james.davidson@vyatta.com> | 2013-01-08 14:54:19 -0800 |
commit | 2dd6be60ba0b888d138292f5ccec3bacfc5d4949 (patch) | |
tree | 1859f9386ba60161f8c6aec274d1daeecf529972 /scripts | |
parent | b5400cc864c0c631de0291c7d535b0430f360dcd (diff) | |
download | vyatta-cfg-system-2dd6be60ba0b888d138292f5ccec3bacfc5d4949.tar.gz vyatta-cfg-system-2dd6be60ba0b888d138292f5ccec3bacfc5d4949.zip |
Bug 7856: Set default neighbour table size to 8192
Also increase the max allowed value to 32768.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-update-arp-params | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/scripts/vyatta-update-arp-params b/scripts/vyatta-update-arp-params index 094d0751..36275731 100755 --- a/scripts/vyatta-update-arp-params +++ b/scripts/vyatta-update-arp-params @@ -35,29 +35,37 @@ print_usage() 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 () { - arp_type=$1 - arp_value=$2 - ip_type=$3 + local arp_type=$1 + local arp_value=$2 + local ip_type=$3 case "$arp_type" in - table-size) - allowed_values=(1024 2048 4096 8192 16384) - allowed_values_len=${#allowed_values[*]} - i=0 - while [ $i -lt $allowed_values_len ]; do - if [ "${allowed_values[$i]}" == "$arp_value" ] ; then - exit 0 - fi - let i++ + 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 - 1024 2048 4096 8192 16384" + echo "Allowed values for ARP table-size - ${allowed_values[*]}" exit 1 ;; - *) + *) echo Invalid arp parameter $arp_type to set exit 1 ;; @@ -66,40 +74,16 @@ syntax_arp_param () update_arp_param () { - arp_type=$1 - arp_value=$2 - ip_type=$3 - - case "$arp_type" in - - table-size) - let softmax=$arp_value\/2; - let 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 - ;; - - *) - echo Invalid arp parameter $arp_type to update - ;; - esac -} - -delete_arp_param () -{ - arp_type=$1 - ip_type=$2 - + local arp_type=$1 + local arp_value=$2 + local ip_type=$3 case "$arp_type" in - table-size) - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh3=1024 - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh2=512 - sudo sysctl -q net.$ip_type.neigh.default.gc_thresh1=128 + table-size) + set_table_thresholds $ip_type $arp_value ;; - *) + *) echo Invalid arp parameter $arp_type to update ;; esac @@ -126,15 +110,6 @@ case "$1" in update_arp_param $2 $3 $4 ;; - delete) - if [ $# -ne 3 ]; then - print_usage - exit 1 - fi - delete_arp_param $2 $3 - ;; - - *) print_usage exit 1 |