lmtu=1500
 rmtu=2000
 
+filesize=$((2 * 1024 * 1024))
+
 usage(){
        echo "nft_flowtable.sh [OPTIONS]"
        echo
        exit 1
 }
 
-while getopts "o:l:r:" o
+while getopts "o:l:r:s:" o
 do
        case $o in
                o) omtu=$OPTARG;;
                l) lmtu=$OPTARG;;
                r) rmtu=$OPTARG;;
+               s) filesize=$OPTARG;;
                *) usage;;
        esac
 done
 
 make_file()
 {
-       name=$1
-
-       SIZE=$((RANDOM % (1024 * 128)))
-       SIZE=$((SIZE + (1024 * 8)))
-       TSIZE=$((SIZE * 1024))
-
-       dd if=/dev/urandom of="$name" bs=1024 count=$SIZE 2> /dev/null
+       name="$1"
+       sz="$2"
 
-       SIZE=$((RANDOM % 1024))
-       SIZE=$((SIZE + 128))
-       TSIZE=$((TSIZE + SIZE))
-       dd if=/dev/urandom conf=notrunc of="$name" bs=1 count=$SIZE 2> /dev/null
+       head -c "$sz" < /dev/urandom > "$name"
 }
 
 check_counters()
        local fs
        fs=$(du -sb "$nsin")
        local max_orig=${fs%%/*}
-       local max_repl=$((max_orig/4))
+       local max_repl=$((max_orig))
 
        # flowtable fastpath should bypass normal routing one, i.e. the counters in forward hook
        # should always be lower than the size of the transmitted file (max_orig).
        if [ "$orig_cnt" -gt "$max_orig" ];then
-               echo "FAIL: $what: original counter $orig_cnt exceeds expected value $max_orig" 1>&2
+               echo "FAIL: $what: original counter $orig_cnt exceeds expected value $max_orig, reply counter $repl_cnt" 1>&2
                ret=1
                ok=0
        fi
 
        if [ "$repl_cnt" -gt $max_repl ];then
-               echo "FAIL: $what: reply counter $repl_cnt exceeds expected value $max_repl" 1>&2
+               echo "FAIL: $what: reply counter $repl_cnt exceeds expected value $max_repl, original counter $orig_cnt" 1>&2
                ret=1
                ok=0
        fi
        return $lret
 }
 
-make_file "$nsin"
+make_file "$nsin" "$filesize"
 
 # First test:
 # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed.
        l=$(((RANDOM%mtu) + low))
        r=$(((RANDOM%mtu) + low))
 
-       echo "re-run with random mtus: -o $o -l $l -r $r"
-       $0 -o "$o" -l "$l" -r "$r"
+       MINSIZE=$((2 *  1000 * 1000))
+       MAXSIZE=$((64 * 1000 * 1000))
+
+       filesize=$(((RANDOM * RANDOM) % MAXSIZE))
+       if [ "$filesize" -lt "$MINSIZE" ]; then
+               filesize=$((filesize+MINSIZE))
+       fi
+
+       echo "re-run with random mtus and file size: -o $o -l $l -r $r -s $filesize"
+       $0 -o "$o" -l "$l" -r "$r" -s "$filesize"
 fi
 
 exit $ret