#!/bin/bash me="${0##*/}" + me=ksocklnd-config # convert number of mask bits to x.x.x.x or x:x:x:x:x:x:x:x mask format cidr2mask() { local i mask="" local full_octets=$(($1/8)) local partial_octet=$(($1%8)) for ((i=0;i<4;i+=1)); do if [ $i -lt $full_octets ]; then mask+=255 elif [ $i -eq $full_octets ]; then mask+=$((256 - 2**(8-$partial_octet))) else mask+=0 fi test $i -lt 3 && mask+=. done echo $mask } cidr2maskipv6() { local mask="" local num_bits=$1 if [ $num_bits -le 128 ]; then local full_blocks=$((num_bits / 16)) local remaining_bits=$((16 - (num_bits % 16))) for ((i = 0; i < 8; i++)); do if [ $i -lt $full_blocks ]; then mask+="ffff" elif [ $i -eq $full_blocks ]; then mask+="$(printf "%x" $((0xFFFF >> $remaining_bits)))" else mask+="0" fi [ $i -lt 7 ] && mask+=":" done else echo "Invalid prefix length for IPv6" return 1 fi echo $mask } # apply netmask (second argument) to ip address (first argument) netcalc() { local ipa=$(echo ${1} | awk -F. '{ print $1 }') local ipb=$(echo ${1} | awk -F. '{ print $2 }') local ipc=$(echo ${1} | awk -F. '{ print $3 }') local ipd=$(echo ${1} | awk -F. '{ print $4 }') local mka=$(echo ${2} | awk -F. '{ print $1 }') local mkb=$(echo ${2} | awk -F. '{ print $2 }') local mkc=$(echo ${2} | awk -F. '{ print $3 }') local mkd=$(echo ${2} | awk -F. '{ print $4 }') local nta="$(( $ipa & $mka ))" local ntb="$(( $ipb & $mkb ))" local ntc="$(( $ipc & $mkc ))" local ntd="$(( $ipd & $mkd ))" echo "$nta.$ntb.$ntc.$ntd" } # expand IPv6 address to full length expand_ipv6() { local ip=$1 local expanded_ip="" # Split the IP address into segments IFS=':' read -r -a segments <<< "$ip" # Count the number of segments local num_segments=${#segments[@]} # Check if "::" is present in the IP address local double_colon_index=$(echo "$ip" | grep -o "::" | wc -l) local double_colon_present=false # If "::" is present, count the number of segments before and after it if [[ "$double_colon_index" -gt 0 ]]; then double_colon_present=true local before_double_colon=${segments[0]} local after_double_colon=${segments[-1]} # Count the number of segments before "::" local num_before_double_colon=$(echo "$before_double_colon" | grep -o ":" | wc -l) [[ -z "$before_double_colon" ]] && num_before_double_colon=0 # Count the number of segments after "::" local num_after_double_colon=$(echo "$after_double_colon" | grep -o ":" | wc -l) [[ -z "$after_double_colon" ]] && num_after_double_colon=0 fi # Iterate over each segment for segment in "${segments[@]}"; do # If "::" is present, handle segments before and after it if [[ "$double_colon_present" = true ]]; then if [[ "$segment" = "" ]]; then # Fill in the missing segments with "0000" local missing_segments=$((8 - num_segments + 1)) for ((i=1; i<=$missing_segments; i++)); do expanded_ip+="0000:" done else # Expand the segment to 4 characters and append it to the expanded IP expanded_ip+=$(printf "%04s" "$segment" | tr ' ' '0') expanded_ip+=":" fi else # Expand the segment to 4 characters and append it to the expanded IP expanded_ip+=$(printf "%04s" "$segment" | tr ' ' '0') expanded_ip+=":" fi done # Remove the trailing colon expanded_ip="${expanded_ip%:}" echo "$expanded_ip" } netcalcipv6() { local ip=$1 local mask=$2 # Expand IP address and subnet mask to full length ip=$(expand_ipv6 $ip) local ip_blocks=(${ip//:/ }) local mask_blocks=(${mask//:/ }) local result="" for ((i = 0; i < 8; i++)); do local dec_ip_block=$((16#${ip_blocks[i]})) local dec_mask_block=$((16#${mask_blocks[i]})) local network_block=$((dec_ip_block & dec_mask_block)) result+=$(printf "%04x" $network_block) [ $i -lt 7 ] && result+=":" done echo $result } # Check if the user wants to skip setting the routes checkskipcmd=$(cat /sys/module/ksocklnd/parameters/skip_mr_route_setup 2>&-) ++ cat /sys/module/ksocklnd/parameters/skip_mr_route_setup + checkskipcmd= if [ "$checkskipcmd" == "1" ]; then exit 0 fi + '[' '' == 1 ']' # Extract comma-separated interfaces from the argument j=0 + j=0 declare -a interfaces + declare -a interfaces for i in $(echo $1 | sed "s/,/ /g") do # verify that the interface exists ipv4_addr=$(/sbin/ip -o -4 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1) ipv6_addr=$(/sbin/ip -o -6 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1) if [ -z "$ipv4_addr" ] && [ -z "$ipv6_addr" ]; then # No IPv4 or IPv6 address configured on this interface, skip it logcmd=(logger "${me}: skip setting up route for ${i}: IP address not found") eval "${logcmd[@]}" continue fi # Check if route is already set up for this interface (IPv4 or IPv6) if [ ! -z "$ipv4_addr" ]; then intfroute_ipv4=$(/sbin/ip -o -4 route show table $i 2>&-) if [ ! -z "$intfroute_ipv4" ]; then echo $intfroute_ipv4 # IPv4 route exists, skip this interface logcmd=(logger "${me}: skip setting up route for ${i}: IPv4 route exists") eval "${logcmd[@]}" continue fi fi if [ ! -z "$ipv6_addr" ]; then intfroute_ipv6=$(/sbin/ip -o -6 route show table $i 2>&-) if [ ! -z "$intfroute_ipv6" ]; then # IPv6 route exists, skip this interface logcmd=(logger "${me}: skip setting up route for ${i}: IPv6 route exists") eval "${logcmd[@]}" continue fi fi interfaces[$j]=$i j=$((j+1)) done ++ echo enp0s3 ++ sed 's/,/ /g' + for i in '$(echo $1 | sed "s/,/ /g")' ++ /sbin/ip -o -4 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f1 + ipv4_addr=192.168.1.82 ++ /sbin/ip -o -6 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f1 + ipv6_addr=fe80::a00:27ff:feb2:2f0 + '[' -z 192.168.1.82 ']' + '[' '!' -z 192.168.1.82 ']' ++ /sbin/ip -o -4 route show table enp0s3 + intfroute_ipv4= + '[' '!' -z '' ']' + '[' '!' -z fe80::a00:27ff:feb2:2f0 ']' ++ /sbin/ip -o -6 route show table enp0s3 + intfroute_ipv6= + '[' '!' -z '' ']' + interfaces[$j]=enp0s3 + j=1 # this array will contain the interfaces # already listed in rt_tables interfaces_listed=() + interfaces_listed=() # flush cache for every interface for i in "${interfaces[@]}" do # build command redirect="2>&-" flushcmd=(/sbin/ip route flush table ${i} ${redirect} ) # execute command eval "${flushcmd[@]}" logcmd=(logger "${me}: ${flushcmd[@]}") eval "${logcmd[@]}" done + for i in '"${interfaces[@]}"' + redirect='2>&-' + flushcmd=(/sbin/ip route flush table ${i} ${redirect}) + eval /sbin/ip route flush table enp0s3 '2>&-' /sbin/ip route flush table enp0s3 2>&- ++ /sbin/ip route flush table enp0s3 + logcmd=(logger "${me}: ${flushcmd[@]}") + eval logger 'ksocklnd-config: /sbin/ip' route flush table enp0s3 '2>&-' logger ksocklnd-config: /sbin/ip route flush table enp0s3 2>&- ++ logger ksocklnd-config: /sbin/ip route flush table enp0s3 filename='/etc/iproute2/rt_tables' + filename=/etc/iproute2/rt_tables n=1 + n=1 max_table_num=0 + max_table_num=0 while read line; do # reading each line # trim leading and trailing spaces line=`echo $line | sed -e 's/^[[:space:]]*//'` linelen=$(echo -n $line | wc -m) # don't check empty lines if [ $linelen -lt 1 ]; then continue fi # don't check comments if [[ ${line:0:1} == "#" ]]; then continue fi # split using space as separator splitline=( $line ) # check the table number and update the max if [ $max_table_num -lt ${splitline[0]} ]; then max_table_num=${splitline[0]} fi # check if any of the interfaces are listed for i in "${interfaces[@]}" do if [[ " ${splitline[@]} " =~ " ${i} " ]]; then if [[ " ${interfaces[@]} " =~ " ${i} " ]]; then interfaces_listed+=($i) fi fi done n=$((n+1)) done < $filename + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' ++ sed -e 's/^[[:space:]]*//' + line='#' ++ echo -n '#' ++ wc -m + linelen=1 + '[' 1 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' reserved values ++ sed -e 's/^[[:space:]]*//' + line='# reserved values' ++ echo -n '#' reserved values ++ wc -m + linelen=17 + '[' 17 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' ++ sed -e 's/^[[:space:]]*//' + line='#' ++ echo -n '#' ++ wc -m + linelen=1 + '[' 1 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo 255 local ++ sed -e 's/^[[:space:]]*//' + line='255 local' ++ echo -n 255 local ++ wc -m + linelen=9 + '[' 9 -lt 1 ']' + [[ 2 == \# ]] + splitline=($line) + '[' 0 -lt 255 ']' + max_table_num=255 + for i in '"${interfaces[@]}"' + [[ 255 local =~ enp0s3 ]] + n=2 + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo 254 main ++ sed -e 's/^[[:space:]]*//' + line='254 main' ++ echo -n 254 main ++ wc -m + linelen=8 + '[' 8 -lt 1 ']' + [[ 2 == \# ]] + splitline=($line) + '[' 255 -lt 254 ']' + for i in '"${interfaces[@]}"' + [[ 254 main =~ enp0s3 ]] + n=3 + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo 253 default ++ sed -e 's/^[[:space:]]*//' + line='253 default' ++ echo -n 253 default ++ wc -m + linelen=11 + '[' 11 -lt 1 ']' + [[ 2 == \# ]] + splitline=($line) + '[' 255 -lt 253 ']' + for i in '"${interfaces[@]}"' + [[ 253 default =~ enp0s3 ]] + n=4 + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo 0 unspec ++ sed -e 's/^[[:space:]]*//' + line='0 unspec' ++ echo -n 0 unspec ++ wc -m + linelen=8 + '[' 8 -lt 1 ']' + [[ 0 == \# ]] + splitline=($line) + '[' 255 -lt 0 ']' + for i in '"${interfaces[@]}"' + [[ 0 unspec =~ enp0s3 ]] + n=5 + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' ++ sed -e 's/^[[:space:]]*//' + line='#' ++ echo -n '#' ++ wc -m + linelen=1 + '[' 1 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' local ++ sed -e 's/^[[:space:]]*//' + line='# local' ++ echo -n '#' local ++ wc -m + linelen=7 + '[' 7 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#' ++ sed -e 's/^[[:space:]]*//' + line='#' ++ echo -n '#' ++ wc -m + linelen=1 + '[' 1 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo '#1' inr.ruhep ++ sed -e 's/^[[:space:]]*//' + line='#1 inr.ruhep' ++ echo -n '#1' inr.ruhep ++ wc -m + linelen=12 + '[' 12 -lt 1 ']' + [[ # == \# ]] + continue + read line echo $line | sed -e 's/^[[:space:]]*//' ++ echo 256 enp0s3 ++ sed -e 's/^[[:space:]]*//' + line='256 enp0s3' ++ echo -n 256 enp0s3 ++ wc -m + linelen=10 + '[' 10 -lt 1 ']' + [[ 2 == \# ]] + splitline=($line) + '[' 255 -lt 256 ']' + max_table_num=256 + for i in '"${interfaces[@]}"' + [[ 256 enp0s3 =~ enp0s3 ]] + [[ enp0s3 =~ enp0s3 ]] + interfaces_listed+=($i) + n=6 + read line # add entries for unlisted interfaces for i in "${interfaces[@]}" do if [[ ! " ${interfaces_listed[@]} " =~ " ${i} " ]]; then max_table_num=$((max_table_num+1)) echo "$max_table_num $i" >> $filename fi done + for i in '"${interfaces[@]}"' + [[ ! enp0s3 =~ enp0s3 ]] # generate list of available not-dev-specific default gateways gwsline=$(/sbin/ip route | awk '/default/ { if ($0 !~ /dev/) print $3 }') ++ /sbin/ip route ++ awk '/default/ { if ($0 !~ /dev/) print $3 }' + gwsline= comm_gateways=($gwsline) + comm_gateways=($gwsline) gwsline_ipv6=$(/sbin/ip -6 route | awk '/default/ { if ($0 !~ /dev/) print $3 }') ++ /sbin/ip -6 route ++ awk '/default/ { if ($0 !~ /dev/) print $3 }' + gwsline_ipv6= comm_gateways_ipv6=($gwsline_ipv6) + comm_gateways_ipv6=($gwsline_ipv6) # Ping the gw to check if it is alive pinggw() { local gw=$1 local timeout=1 # Set the timeout for the ping command # Determine if the IP is IPv4 or IPv6 if [[ $gw =~ .*:.* ]]; then # IPv6: Use ping6 if ping6 -c 1 -W $timeout "$gw" &> /dev/null; then return 0 # reachable else logcmd=(logger "${me}: unreachable default gateway ${gw}: skipping ") eval "${logcmd[@]}" return 1 # not reachable fi else # IPv4: Use the standard ping if ping -c 1 -W $timeout "$gw" &> /dev/null; then return 0 # reachable else logcmd=(logger "${me}: unreachable default gateway ${gw}: skipping ") eval "${logcmd[@]}" return 1 # not reachable fi fi } # Select a gateway on the same subnet for both IPv4 and IPv6 selectgw() { local ip=$1 local mask=$2 local interface=$3 # Check if the IP address is IPv4 or IPv6 if [[ $ip =~ .*:.* ]]; then # IPv6 ip=$(expand_ipv6 $ip) mask=$(expand_ipv6 $mask) local ip_blocks=(${ip//:/ }) local mask_blocks=(${mask//:/ }) local result="" for ((i = 0; i < 8; i++)); do local dec_ip_block=$((16#${ip_blocks[i]})) local dec_mask_block=$((16#${mask_blocks[i]})) local network_block=$((dec_ip_block & dec_mask_block)) result+=$(printf "%04x" $network_block) [ $i -lt 7 ] && result+=":" done local network_ipv6=$result local spec_gateways_ipv6=($(/sbin/ip -6 route show dev $interface | awk '/default/ { print $3 }')) for gw in "${spec_gateways_ipv6[@]}"; do gw_network=$(netcalcipv6 "$gw" "$mask") if [[ "$network_ipv6" == "$gw_network" ]]; then if pinggw "$gw"; then echo $gw return fi fi done for gw in "${comm_gateways_ipv6[@]}"; do gw_network=$(netcalcipv6 "$gw" "$mask") if [[ "$network_ipv6" == "$gw_network" ]]; then if pinggw "$gw"; then echo $gw return fi fi done else # IPv4 local ip_parts=(${ip//./ }) local mask_parts=(${mask//./ }) local network_ipv4="" for ((i = 0; i < 4; i++)); do local network_part=$((ip_parts[i] & mask_parts[i])) network_ipv4+="$network_part" [ $i -lt 3 ] && network_ipv4+="." done local spec_gateways=($(/sbin/ip route show dev $interface | awk '/default/ { print $3 }')) for gw in "${spec_gateways[@]}"; do gw_network=$(netcalc "$gw" "$mask") if [[ "$network_ipv4" == "$gw_network" ]]; then if pinggw "$gw"; then echo $gw return fi fi done for gw in "${comm_gateways[@]}"; do gw_network=$(netcalc "$gw" "$mask") if [[ "$network_ipv4" == "$gw_network" ]]; then if pinggw "$gw"; then echo $gw return fi fi done fi echo "0.0.0.0" } # Add the routing entries and rules for IPv4 and/or IPv6 for i in "${interfaces[@]}" do # Extract IPv4 and IPv6 addresses and netmasks in CIDR format addr_ipv4=($(/sbin/ip -o -4 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1)) cidrmask_ipv4=($(/sbin/ip -o -4 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f2)) addr_ipv6=($(/sbin/ip -o -6 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1)) cidrmask_ipv6=($(/sbin/ip -o -6 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f2)) # Configure routing and rules for IPv4 (if IPv4 address is configured) if [ ! -z "${addr_ipv4}" ]; then # Convert CIDR mask to mask in dot format for IPv4 dotmask_ipv4=$(cidr2mask ${cidrmask_ipv4[0]}) # Find a gateway on the same subnet for IPv4 gw_ipv4=$(selectgw "${addr_ipv4[0]}" "$dotmask_ipv4" "$i") # Build and execute route commands for IPv4 if [[ $gw_ipv4 == "0.0.0.0" ]]; then # Gateway not found, assume local destinations for IPv4 net_ipv4=$(netcalc "${addr_ipv4[0]}" "$dotmask_ipv4") routecmd_ipv4=(/sbin/ip route add ${net_ipv4}/${cidrmask_ipv4[0]} dev ${i} proto kernel scope link src ${addr_ipv4[0]} table ${i}) else routecmd_ipv4=(/sbin/ip route add default via ${gw_ipv4} dev ${i} table ${i}) fi ruledelcmd_ipv4=(/sbin/ip rule del from ${addr_ipv4[0]} table ${i} '&>/dev/null') ruleaddcmd_ipv4=(/sbin/ip rule add from ${addr_ipv4[0]} table ${i}) routeerr_ipv4=$(eval "${routecmd_ipv4[@]}" 2>&1 >/dev/null) ruledelerr_ipv4=$(eval "${ruledelcmd_ipv4[@]}" 2>&1 >/dev/null) ruleadderr_ipv4=$(eval "${ruleaddcmd_ipv4[@]}" 2>&1 >/dev/null) logcmd1_ipv4=(logger "${me}: ${routecmd_ipv4[@]} ${routeerr_ipv4}") logcmd2_ipv4=(logger "${me}: ${ruledelcmd_ipv4[@]} ${ruledelerr_ipv4}") logcmd3_ipv4=(logger "${me}: ${ruleaddcmd_ipv4[@]} ${ruleadderr_ipv4}") eval "${logcmd1_ipv4[@]}" eval "${logcmd2_ipv4[@]}" eval "${logcmd3_ipv4[@]}" fi # Configure routing and rules for IPv6 (if IPv6 address is configured) if [ ! -z "${addr_ipv6}" ]; then # Convert CIDR mask to mask in dot format for IPv6 dotmask_ipv6=$(cidr2maskipv6 ${cidrmask_ipv6[0]}) # Find a gateway on the same subnet for IPv6 gw_ipv6=$(selectgw "${addr_ipv6[0]}" "$dotmask_ipv6" "$i") # Build and execute route commands for IPv6 if [[ $gw_ipv6 == "0.0.0.0" ]]; then # Gateway not found, assume local destinations for IPv6 net_ipv6=$(netcalcipv6 "${addr_ipv6[0]}" "$dotmask_ipv6") routecmd_ipv6=(/sbin/ip -6 route add ${addr_ipv6[0]}/${cidrmask_ipv6[0]} dev ${i} proto kernel scope link src ${addr_ipv6[0]} table ${i}) else routecmd_ipv6=(/sbin/ip -6 route add default via ${gw_ipv6} dev ${i} table ${i}) fi ruledelcmd_ipv6=(/sbin/ip -6 rule del from ${addr_ipv6[0]} table ${i} '&>/dev/null') ruleaddcmd_ipv6=(/sbin/ip -6 rule add from ${addr_ipv6[0]} table ${i}) routeerr_ipv6=$(eval "${routecmd_ipv6[@]}" 2>&1 >/dev/null) ruledelerr_ipv6=$(eval "${ruledelcmd_ipv6[@]}" 2>&1 >/dev/null) ruleadderr_ipv6=$(eval "${ruleaddcmd_ipv6[@]}" 2>&1 >/dev/null) logcmd1_ipv6=(logger -- "${me}: ${routecmd_ipv6[@]} ${routeerr_ipv6}") logcmd2_ipv6=(logger -- "${me}: ${ruledelcmd_ipv6[@]} ${ruledelerr_ipv6}") logcmd3_ipv6=(logger -- "${me}: ${ruleaddcmd_ipv6[@]} ${ruleadderr_ipv6}") eval "${logcmd1_ipv6[@]}" eval "${logcmd2_ipv6[@]}" eval "${logcmd3_ipv6[@]}" fi done + for i in '"${interfaces[@]}"' + addr_ipv4=($(/sbin/ip -o -4 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1)) ++ /sbin/ip -o -4 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f1 + cidrmask_ipv4=($(/sbin/ip -o -4 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f2)) ++ /sbin/ip -o -4 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f2 + addr_ipv6=($(/sbin/ip -o -6 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f1)) ++ /sbin/ip -o -6 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f1 + cidrmask_ipv6=($(/sbin/ip -o -6 addr list $i 2>&- | awk '{print $4}' | cut -d/ -f2)) ++ /sbin/ip -o -6 addr list enp0s3 ++ awk '{print $4}' ++ cut -d/ -f2 + '[' '!' -z 192.168.1.82 ']' ++ cidr2mask 24 ++ local i mask= ++ local full_octets=3 ++ local partial_octet=0 ++ (( i=0 )) ++ (( i<4 )) ++ '[' 0 -lt 3 ']' ++ mask+=255 ++ test 0 -lt 3 ++ mask+=. ++ (( i+=1 )) ++ (( i<4 )) ++ '[' 1 -lt 3 ']' ++ mask+=255 ++ test 1 -lt 3 ++ mask+=. ++ (( i+=1 )) ++ (( i<4 )) ++ '[' 2 -lt 3 ']' ++ mask+=255 ++ test 2 -lt 3 ++ mask+=. ++ (( i+=1 )) ++ (( i<4 )) ++ '[' 3 -lt 3 ']' ++ '[' 3 -eq 3 ']' ++ mask+=0 ++ test 3 -lt 3 ++ (( i+=1 )) ++ (( i<4 )) ++ echo 255.255.255.0 + dotmask_ipv4=255.255.255.0 ++ selectgw 192.168.1.82 255.255.255.0 enp0s3 ++ local ip=192.168.1.82 ++ local mask=255.255.255.0 ++ local interface=enp0s3 ++ [[ 192.168.1.82 =~ .*:.* ]] ++ ip_parts=(${ip//./ }) ++ local ip_parts ++ mask_parts=(${mask//./ }) ++ local mask_parts ++ local network_ipv4= ++ (( i = 0 )) ++ (( i < 4 )) ++ local network_part=192 ++ network_ipv4+=192 ++ '[' 0 -lt 3 ']' ++ network_ipv4+=. ++ (( i++ )) ++ (( i < 4 )) ++ local network_part=168 ++ network_ipv4+=168 ++ '[' 1 -lt 3 ']' ++ network_ipv4+=. ++ (( i++ )) ++ (( i < 4 )) ++ local network_part=1 ++ network_ipv4+=1 ++ '[' 2 -lt 3 ']' ++ network_ipv4+=. ++ (( i++ )) ++ (( i < 4 )) ++ local network_part=0 ++ network_ipv4+=0 ++ '[' 3 -lt 3 ']' ++ (( i++ )) ++ (( i < 4 )) ++ spec_gateways=($(/sbin/ip route show dev $interface | awk '/default/ { print $3 }')) +++ /sbin/ip route show dev enp0s3 +++ awk '/default/ { print $3 }' ++ local spec_gateways ++ for gw in '"${spec_gateways[@]}"' +++ netcalc 192.168.1.1 255.255.255.0 ++++ echo 192.168.1.1 ++++ awk -F. '{ print $1 }' +++ local ipa=192 ++++ echo 192.168.1.1 ++++ awk -F. '{ print $2 }' +++ local ipb=168 ++++ echo 192.168.1.1 ++++ awk -F. '{ print $3 }' +++ local ipc=1 ++++ echo 192.168.1.1 ++++ awk -F. '{ print $4 }' +++ local ipd=1 ++++ echo 255.255.255.0 ++++ awk -F. '{ print $1 }' +++ local mka=255 ++++ echo 255.255.255.0 ++++ awk -F. '{ print $2 }' +++ local mkb=255 ++++ echo 255.255.255.0 ++++ awk -F. '{ print $3 }' +++ local mkc=255 ++++ echo 255.255.255.0 ++++ awk -F. '{ print $4 }' +++ local mkd=0 +++ local nta=192 +++ local ntb=168 +++ local ntc=1 +++ local ntd=0 +++ echo 192.168.1.0 ++ gw_network=192.168.1.0 ++ [[ 192.168.1.0 == \1\9\2\.\1\6\8\.\1\.\0 ]] ++ pinggw 192.168.1.1 ++ local gw=192.168.1.1 ++ local timeout=1 ++ [[ 192.168.1.1 =~ .*:.* ]] ++ ping -c 1 -W 1 192.168.1.1 ++ return 0 ++ echo 192.168.1.1 ++ return + gw_ipv4=192.168.1.1 + [[ 192.168.1.1 == \0\.\0\.\0\.\0 ]] + routecmd_ipv4=(/sbin/ip route add default via ${gw_ipv4} dev ${i} table ${i}) + ruledelcmd_ipv4=(/sbin/ip rule del from ${addr_ipv4[0]} table ${i} '&>/dev/null') + ruleaddcmd_ipv4=(/sbin/ip rule add from ${addr_ipv4[0]} table ${i}) ++ eval /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3 + routeerr_ipv4='+++ /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3' ++ eval /sbin/ip rule del from 192.168.1.82 table enp0s3 '&>/dev/null' + ruledelerr_ipv4='+++ /sbin/ip rule del from 192.168.1.82 table enp0s3' ++ eval /sbin/ip rule add from 192.168.1.82 table enp0s3 + ruleadderr_ipv4='+++ /sbin/ip rule add from 192.168.1.82 table enp0s3' + logcmd1_ipv4=(logger "${me}: ${routecmd_ipv4[@]} ${routeerr_ipv4}") + logcmd2_ipv4=(logger "${me}: ${ruledelcmd_ipv4[@]} ${ruledelerr_ipv4}") + logcmd3_ipv4=(logger "${me}: ${ruleaddcmd_ipv4[@]} ${ruleadderr_ipv4}") + eval logger 'ksocklnd-config: /sbin/ip' route add default via 192.168.1.1 dev enp0s3 table 'enp0s3 +++ /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3' logger ksocklnd-config: /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3 +++ /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3 ++ logger ksocklnd-config: /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3 +++ /sbin/ip route add default via 192.168.1.1 dev enp0s3 table enp0s3 + eval logger 'ksocklnd-config: /sbin/ip' rule del from 192.168.1.82 table enp0s3 '&>/dev/null +++ /sbin/ip rule del from 192.168.1.82 table enp0s3' logger ksocklnd-config: /sbin/ip rule del from 192.168.1.82 table enp0s3 &>/dev/null +++ /sbin/ip rule del from 192.168.1.82 table enp0s3 ++ logger ksocklnd-config: /sbin/ip rule del from 192.168.1.82 table enp0s3 +++ /sbin/ip rule del from 192.168.1.82 table enp0s3 + eval logger 'ksocklnd-config: /sbin/ip' rule add from 192.168.1.82 table 'enp0s3 +++ /sbin/ip rule add from 192.168.1.82 table enp0s3' logger ksocklnd-config: /sbin/ip rule add from 192.168.1.82 table enp0s3 +++ /sbin/ip rule add from 192.168.1.82 table enp0s3 ++ logger ksocklnd-config: /sbin/ip rule add from 192.168.1.82 table enp0s3 +++ /sbin/ip rule add from 192.168.1.82 table enp0s3 + '[' '!' -z fe80::a00:27ff:feb2:2f0 ']' ++ cidr2maskipv6 64 ++ local mask= ++ local num_bits=64 ++ '[' 64 -le 128 ']' ++ local full_blocks=4 ++ local remaining_bits=16 ++ (( i = 0 )) ++ (( i < 8 )) ++ '[' 0 -lt 4 ']' ++ mask+=ffff ++ '[' 0 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 1 -lt 4 ']' ++ mask+=ffff ++ '[' 1 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 2 -lt 4 ']' ++ mask+=ffff ++ '[' 2 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 3 -lt 4 ']' ++ mask+=ffff ++ '[' 3 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 4 -lt 4 ']' ++ '[' 4 -eq 4 ']' +++ printf %x 0 ++ mask+=0 ++ '[' 4 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 5 -lt 4 ']' ++ '[' 5 -eq 4 ']' ++ mask+=0 ++ '[' 5 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 6 -lt 4 ']' ++ '[' 6 -eq 4 ']' ++ mask+=0 ++ '[' 6 -lt 7 ']' ++ mask+=: ++ (( i++ )) ++ (( i < 8 )) ++ '[' 7 -lt 4 ']' ++ '[' 7 -eq 4 ']' ++ mask+=0 ++ '[' 7 -lt 7 ']' ++ (( i++ )) ++ (( i < 8 )) ++ echo ffff:ffff:ffff:ffff:0:0:0:0 + dotmask_ipv6=ffff:ffff:ffff:ffff:0:0:0:0 ++ selectgw fe80::a00:27ff:feb2:2f0 ffff:ffff:ffff:ffff:0:0:0:0 enp0s3 ++ local ip=fe80::a00:27ff:feb2:2f0 ++ local mask=ffff:ffff:ffff:ffff:0:0:0:0 ++ local interface=enp0s3 ++ [[ fe80::a00:27ff:feb2:2f0 =~ .*:.* ]] +++ expand_ipv6 fe80::a00:27ff:feb2:2f0 +++ local ip=fe80::a00:27ff:feb2:2f0 +++ local expanded_ip= +++ IFS=: +++ read -r -a segments +++ local num_segments=6 ++++ echo fe80::a00:27ff:feb2:2f0 ++++ grep -o :: ++++ wc -l +++ local double_colon_index=1 +++ local double_colon_present=false +++ [[ 1 -gt 0 ]] +++ double_colon_present=true +++ local before_double_colon=fe80 +++ local after_double_colon=2f0 ++++ echo fe80 ++++ grep -o : ++++ wc -l +++ local num_before_double_colon=0 +++ [[ -z fe80 ]] ++++ echo 2f0 ++++ grep -o : ++++ wc -l +++ local num_after_double_colon=0 +++ [[ -z 2f0 ]] +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ fe80 = '' ]] ++++ printf %04s fe80 ++++ tr ' ' 0 +++ expanded_ip+=fe80 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ '' = '' ]] +++ local missing_segments=3 +++ (( i=1 )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ a00 = '' ]] ++++ printf %04s a00 ++++ tr ' ' 0 +++ expanded_ip+=0a00 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ 27ff = '' ]] ++++ printf %04s 27ff ++++ tr ' ' 0 +++ expanded_ip+=27ff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ feb2 = '' ]] ++++ printf %04s feb2 ++++ tr ' ' 0 +++ expanded_ip+=feb2 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ 2f0 = '' ]] ++++ printf %04s 2f0 ++++ tr ' ' 0 +++ expanded_ip+=02f0 +++ expanded_ip+=: +++ expanded_ip=fe80:0000:0000:0000:0a00:27ff:feb2:02f0 +++ echo fe80:0000:0000:0000:0a00:27ff:feb2:02f0 ++ ip=fe80:0000:0000:0000:0a00:27ff:feb2:02f0 +++ expand_ipv6 ffff:ffff:ffff:ffff:0:0:0:0 +++ local ip=ffff:ffff:ffff:ffff:0:0:0:0 +++ local expanded_ip= +++ IFS=: +++ read -r -a segments +++ local num_segments=8 ++++ echo ffff:ffff:ffff:ffff:0:0:0:0 ++++ grep -o :: ++++ wc -l +++ local double_colon_index=0 +++ local double_colon_present=false +++ [[ 0 -gt 0 ]] +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s ffff ++++ tr ' ' 0 +++ expanded_ip+=ffff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s ffff ++++ tr ' ' 0 +++ expanded_ip+=ffff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s ffff ++++ tr ' ' 0 +++ expanded_ip+=ffff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s ffff ++++ tr ' ' 0 +++ expanded_ip+=ffff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s 0 ++++ tr ' ' 0 +++ expanded_ip+=0000 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s 0 ++++ tr ' ' 0 +++ expanded_ip+=0000 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s 0 ++++ tr ' ' 0 +++ expanded_ip+=0000 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ false = true ]] ++++ printf %04s 0 ++++ tr ' ' 0 +++ expanded_ip+=0000 +++ expanded_ip+=: +++ expanded_ip=ffff:ffff:ffff:ffff:0000:0000:0000:0000 +++ echo ffff:ffff:ffff:ffff:0000:0000:0000:0000 ++ mask=ffff:ffff:ffff:ffff:0000:0000:0000:0000 ++ ip_blocks=(${ip//:/ }) ++ local ip_blocks ++ mask_blocks=(${mask//:/ }) ++ local mask_blocks ++ local result= ++ (( i = 0 )) ++ (( i < 8 )) ++ local dec_ip_block=65152 ++ local dec_mask_block=65535 ++ local network_block=65152 +++ printf %04x 65152 ++ result+=fe80 ++ '[' 0 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 1 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 2 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 3 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=2560 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 4 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=10239 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 5 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=65202 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 6 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=752 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 7 -lt 7 ']' ++ (( i++ )) ++ (( i < 8 )) ++ local network_ipv6=fe80:0000:0000:0000:0000:0000:0000:0000 ++ spec_gateways_ipv6=($(/sbin/ip -6 route show dev $interface | awk '/default/ { print $3 }')) +++ /sbin/ip -6 route show dev enp0s3 +++ awk '/default/ { print $3 }' ++ local spec_gateways_ipv6 ++ echo 0.0.0.0 + gw_ipv6=0.0.0.0 + [[ 0.0.0.0 == \0\.\0\.\0\.\0 ]] ++ netcalcipv6 fe80::a00:27ff:feb2:2f0 ffff:ffff:ffff:ffff:0:0:0:0 ++ local ip=fe80::a00:27ff:feb2:2f0 ++ local mask=ffff:ffff:ffff:ffff:0:0:0:0 +++ expand_ipv6 fe80::a00:27ff:feb2:2f0 +++ local ip=fe80::a00:27ff:feb2:2f0 +++ local expanded_ip= +++ IFS=: +++ read -r -a segments +++ local num_segments=6 ++++ echo fe80::a00:27ff:feb2:2f0 ++++ grep -o :: ++++ wc -l +++ local double_colon_index=1 +++ local double_colon_present=false +++ [[ 1 -gt 0 ]] +++ double_colon_present=true +++ local before_double_colon=fe80 +++ local after_double_colon=2f0 ++++ echo fe80 ++++ grep -o : ++++ wc -l +++ local num_before_double_colon=0 +++ [[ -z fe80 ]] ++++ echo 2f0 ++++ grep -o : ++++ wc -l +++ local num_after_double_colon=0 +++ [[ -z 2f0 ]] +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ fe80 = '' ]] ++++ printf %04s fe80 ++++ tr ' ' 0 +++ expanded_ip+=fe80 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ '' = '' ]] +++ local missing_segments=3 +++ (( i=1 )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ expanded_ip+=0000: +++ (( i++ )) +++ (( i<=3 )) +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ a00 = '' ]] ++++ printf %04s a00 ++++ tr ' ' 0 +++ expanded_ip+=0a00 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ 27ff = '' ]] ++++ printf %04s 27ff ++++ tr ' ' 0 +++ expanded_ip+=27ff +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ feb2 = '' ]] ++++ printf %04s feb2 ++++ tr ' ' 0 +++ expanded_ip+=feb2 +++ expanded_ip+=: +++ for segment in '"${segments[@]}"' +++ [[ true = true ]] +++ [[ 2f0 = '' ]] ++++ printf %04s 2f0 ++++ tr ' ' 0 +++ expanded_ip+=02f0 +++ expanded_ip+=: +++ expanded_ip=fe80:0000:0000:0000:0a00:27ff:feb2:02f0 +++ echo fe80:0000:0000:0000:0a00:27ff:feb2:02f0 ++ ip=fe80:0000:0000:0000:0a00:27ff:feb2:02f0 ++ ip_blocks=(${ip//:/ }) ++ local ip_blocks ++ mask_blocks=(${mask//:/ }) ++ local mask_blocks ++ local result= ++ (( i = 0 )) ++ (( i < 8 )) ++ local dec_ip_block=65152 ++ local dec_mask_block=65535 ++ local network_block=65152 +++ printf %04x 65152 ++ result+=fe80 ++ '[' 0 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 1 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 2 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=0 ++ local dec_mask_block=65535 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 3 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=2560 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 4 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=10239 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 5 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=65202 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 6 -lt 7 ']' ++ result+=: ++ (( i++ )) ++ (( i < 8 )) ++ local dec_ip_block=752 ++ local dec_mask_block=0 ++ local network_block=0 +++ printf %04x 0 ++ result+=0000 ++ '[' 7 -lt 7 ']' ++ (( i++ )) ++ (( i < 8 )) ++ echo fe80:0000:0000:0000:0000:0000:0000:0000 + net_ipv6=fe80:0000:0000:0000:0000:0000:0000:0000 + routecmd_ipv6=(/sbin/ip -6 route add ${addr_ipv6[0]}/${cidrmask_ipv6[0]} dev ${i} proto kernel scope link src ${addr_ipv6[0]} table ${i}) + ruledelcmd_ipv6=(/sbin/ip -6 rule del from ${addr_ipv6[0]} table ${i} '&>/dev/null') + ruleaddcmd_ipv6=(/sbin/ip -6 rule add from ${addr_ipv6[0]} table ${i}) ++ eval /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3 + routeerr_ipv6='+++ /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3' ++ eval /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 '&>/dev/null' + ruledelerr_ipv6='+++ /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3' ++ eval /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3 + ruleadderr_ipv6='+++ /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3' + logcmd1_ipv6=(logger -- "${me}: ${routecmd_ipv6[@]} ${routeerr_ipv6}") + logcmd2_ipv6=(logger -- "${me}: ${ruledelcmd_ipv6[@]} ${ruledelerr_ipv6}") + logcmd3_ipv6=(logger -- "${me}: ${ruleaddcmd_ipv6[@]} ${ruleadderr_ipv6}") + eval logger -- 'ksocklnd-config: /sbin/ip' -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table 'enp0s3 +++ /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3' logger -- ksocklnd-config: /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3 +++ /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3 ++ logger -- ksocklnd-config: /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3 +++ /sbin/ip -6 route add fe80::a00:27ff:feb2:2f0/64 dev enp0s3 proto kernel scope link src fe80::a00:27ff:feb2:2f0 table enp0s3 + eval logger -- 'ksocklnd-config: /sbin/ip' -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 '&>/dev/null +++ /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3' logger -- ksocklnd-config: /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 &>/dev/null +++ /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 ++ logger -- ksocklnd-config: /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 +++ /sbin/ip -6 rule del from fe80::a00:27ff:feb2:2f0 table enp0s3 + eval logger -- 'ksocklnd-config: /sbin/ip' -6 rule add from fe80::a00:27ff:feb2:2f0 table 'enp0s3 +++ /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3' logger -- ksocklnd-config: /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3 +++ /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3 ++ logger -- ksocklnd-config: /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3 +++ /sbin/ip -6 rule add from fe80::a00:27ff:feb2:2f0 table enp0s3 # flush arp tables for i in "${interfaces[@]}" do flushcmd=(/sbin/ip neigh flush dev ${i}) eval ${flushcmd[@]} done + for i in '"${interfaces[@]}"' + flushcmd=(/sbin/ip neigh flush dev ${i}) + eval /sbin/ip neigh flush dev enp0s3 /sbin/ip neigh flush dev enp0s3 ++ /sbin/ip neigh flush dev enp0s3