This file is indexed.

/usr/share/doc/secvpn/tcp-over-tcp/checkTCP is in secvpn 2.23.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/sh
#
# checkTCP.sh 
#
# Checks a TCP connection by sending a large amount of data over a TCP
# connection measuring the bandwidth or the time until the connection
# aborts.
# The key is the variable drop rate of the router. Using this special
# kernel, we are able to simulate "bad" connections.
# 
#
# Steps:
#         - set the drop rate of the router (via rexec)
#         - start the timer
#         - start a ftp-put (50MB) to the target system
#         - stop time timer
#         - store the time needed (negative if ftp aborts)
#
# ----------------------------------------------------------------------------

#
# Definitions
#
ROUTER_NAME=10.2.0.1                    # router with variable "drop rate"
ROUTER_USER=sr                          # remote user to set the drop rate
ROUTER_PW=geheim                        # the password of the user
TARGET_NAME=10.2.1.100                  # target system of the connection
TARGET_USER=sr                          # the FTP user on the target system
TARGET_PW=sr                            # the password of the FTP user
DROP_START=0                            # start drop rate (in percent)
DROP_END=020                            # end drop rate (in percent)
DROP_DELTA=1                            # delta rate for drop rate (in percent)
DATA_SIZE=10000                         # amount of data to be transferred
					# (in kB)
MAXLOOP=5                               # transfer loops per drop rate
TMPFILE=/tmp/TCP.data                   # temporary test data file
RESULTFILE=checkTCP.result              # the result file

#
# Variables
#
o_trace=0                               # Trace on/off


#
# Set drop rate of router
#
set_drop_rate() # rate_percent
{
  [ $o_trace -eq 1 ] && set -x

  _rate=`expr ${1} \* 10`

  echo "Setting drop rate on '${ROUTER_NAME}' to ${1}%"

  rsh -l ${ROUTER_USER} ${ROUTER_NAME} \
	"echo ${_rate} >> /proc/sys/net/ipv4/ip_drop_rate"

  if [ $? -ne 0 ]; then
    echo "ERR: Cannot set drop rate on ${ROUTER_NAME}"
    exit 1
  fi
}

#
# Send the data and delivers the time needed as RESULT (in seconds)
#
send_data() # host user password file
{
  [ $o_trace -eq 1 ] && set -x

  echo "Starting data transfer ..."
  _Start=${SECONDS}

  ftp -n <<EOFEOF
open ${1}
user ${2} ${3}
lcd `dirname ${4}`
cd `dirname ${4}`
bin
put `basename ${4}`
EOFEOF

  _res=$?

  _End=${SECONDS}
  _Delta=`expr ${_End} - ${_Start}`

  if [ ${_res} -ne 0 ]; then
    _Delta=`expr ${_Delta} \* -1` 
  fi

  echo "Data transfer ended in ${_Delta} seconds"

  RESULT=${_Delta}
}

#
# Make a test file of desired size
#
make_test_file() # size_in_kB filename
{
  [ $o_trace -eq 1 ] && set -x
 
  _root=`awk '$2 == "/" { print $1; }' /etc/fstab`

  echo "Creating the test file '${2}' with ${1}kB ..."

  dd if=${_root} of=${2} bs=1k count=${1}
}

#
# Main
#

# Inits
trap 'exit 1' INT QUIT

# make a test file
make_test_file ${DATA_SIZE} ${TMPFILE}

# start the tests with variable drop rate
_Drop=${DROP_START}
while [ ${_Drop} -le ${DROP_END} ]; do
  set_drop_rate ${_Drop}
  echo -n "${_Drop};${DATA_SIZE}" >>${RESULTFILE}

  _i=0
  while [ ${_i} -lt ${MAXLOOP} ]; do
    send_data ${TARGET_NAME} ${TARGET_USER} ${TARGET_PW} ${TMPFILE}
    _Elapsed=${RESULT}

    echo -n ";${_Elapsed}" >>${RESULTFILE}
    _i=`expr ${_i} + 1`
  done
  echo "" >>${RESULTFILE}

  _Drop=`expr ${_Drop} + ${DROP_DELTA}`
done