summaryrefslogtreecommitdiff
path: root/draft/uftp
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2017-05-05 11:28:51 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2017-05-05 11:28:51 +0200
commit604f3d64764270c052cfb43081ec522237bbdb75 (patch)
treeb3db80e35399412693c7a986b3021435b2914fe4 /draft/uftp
parentf7f175cb29192682f3ece9479f24a40672a3d74d (diff)
downloadeficast-604f3d64764270c052cfb43081ec522237bbdb75.tar.gz
eficast-604f3d64764270c052cfb43081ec522237bbdb75.tar.bz2
eficast-604f3d64764270c052cfb43081ec522237bbdb75.zip
Massive add for all draft stuff to keep it in sync
Diffstat (limited to 'draft/uftp')
-rw-r--r--draft/uftp/bug-ts.txt495
-rw-r--r--draft/uftp/notes.txt42
-rwxr-xr-xdraft/uftp/sinkcat.sh39
-rwxr-xr-xdraft/uftp/sinkdo.sh57
-rw-r--r--draft/uftp/trace-lost-buf.txt485
5 files changed, 1118 insertions, 0 deletions
diff --git a/draft/uftp/bug-ts.txt b/draft/uftp/bug-ts.txt
new file mode 100644
index 0000000..304865b
--- /dev/null
+++ b/draft/uftp/bug-ts.txt
@@ -0,0 +1,495 @@
+lpouzenc@lud-x200s:~/git/eficast/uftp/uftp-4.9.2$ ./uftp -f -C tfmcc -s 20 -x2 -S /tmp/uftpd.csv -M ff02::42 -P ff02::43 -I 3/6 -- /home/lpouzenc/git/eficast/testimage/10-restore-mbr.00.sh /home/lpouzenc/git/eficast/testimage/10-restore-mbr.aa /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.00.sh /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.aa /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ab /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ac /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ad /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ae /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.af /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ag /home/lpouzenc/git/eficast/testimage/20-partclone-sda2.img.ah /home/lpouzenc/git/eficast/testimage/99-end
+
+
+UFTP version 4.9.2 Copyright (C) 2001-2016 Dennis A. Bush
+Starting at Mon Dec 19 14:41:09 2016
+Transfer rate: dynamic via TFMCC
+Using private multicast address ff02::43 Group ID: 1AAE76CE
+Initializing group
+Sending ANNOUNCE 1
+Received REGISTER from client 0x7AECB2FE
+Sending REG_CONF 2.1
+Sending ANNOUNCE 2
+Sending ANNOUNCE 3
+Sending ANNOUNCE 4
+Sending ANNOUNCE 5
+Sending ANNOUNCE 6
+Sending ANNOUNCE 7
+Sending ANNOUNCE 8
+Sending ANNOUNCE 9
+Sending ANNOUNCE 10
+Sending ANNOUNCE 11
+Sending ANNOUNCE 12
+Sending ANNOUNCE 13
+Sending ANNOUNCE 14
+Sending ANNOUNCE 15
+Sending ANNOUNCE 16
+Sending ANNOUNCE 17
+Sending ANNOUNCE 18
+Sending ANNOUNCE 19
+Sending ANNOUNCE 20
+----- 10-restore-mbr.00.sh -----
+File ID: 0001 Name: 10-restore-mbr.00.sh
+ sending as: 10-restore-mbr.00.sh
+Bytes: 50 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.016 seconds
+Total elapsed time: 0.016 seconds
+Overall throughput: 2.99 KB/s
+----- 10-restore-mbr.aa -----
+File ID: 0002 Name: 10-restore-mbr.aa
+ sending as: 10-restore-mbr.aa
+Bytes: 512 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.078 seconds
+Total elapsed time: 0.078 seconds
+Overall throughput: 6.39 KB/s
+----- 20-partclone-sda2.img.00.sh -----
+File ID: 0003 Name: 20-partclone-sda2.img.00.sh
+ sending as: 20-partclone-sda2.img.00.sh
+Bytes: 112 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.134 seconds
+Total elapsed time: 0.134 seconds
+Overall throughput: 0.81 KB/s
+----- 20-partclone-sda2.img.aa -----
+File ID: 0004 Name: 20-partclone-sda2.img.aa
+ sending as: 20-partclone-sda2.img.aa
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 412 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Sending section 3
+Got 181 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 192 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 233 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 584 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 32 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 192 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 2
+Sending section 3
+Sending section 4
+Sending section 5
+Got 46 NAKs for section 0 from client 0x7AECB2FE
+Got 104 NAKs for section 3 from client 0x7AECB2FE
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got 120 NAKs for section 4 from client 0x7AECB2FE
+Got 13 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 0
+Sending section 3
+Sending section 4
+Sending section 7
+Sending DONE 1.1
+Got 87 NAKs for section 2 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 2
+Sending DONE 1.1
+Got 348 NAKs for section 5 from client 0x7AECB2FE
+Got 21 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 5
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Sending DONE 2.1
+Got 158 NAKs for section 5 from client 0x7AECB2FE
+Got 21 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 3.1
+Starting pass 6
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 24.500 seconds
+Total elapsed time: 24.500 seconds
+Overall throughput: 4179.58 KB/s
+----- 20-partclone-sda2.img.ab -----
+File ID: 0005 Name: 20-partclone-sda2.img.ab
+ sending as: 20-partclone-sda2.img.ab
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 217 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 81 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 16 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 337 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 60 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 116 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 274 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 215 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Sending section 5
+Sending section 6
+Got 19 NAKs for section 3 from client 0x7AECB2FE
+Sending section 7
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 3
+Sending section 3
+Sending DONE 1.1
+Got 21 NAKs for section 4 from client 0x7AECB2FE
+Got 1 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 4
+Sending section 5
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 19.133 seconds
+Total elapsed time: 19.133 seconds
+Overall throughput: 5351.90 KB/s
+----- 20-partclone-sda2.img.ac -----
+File ID: 0006 Name: 20-partclone-sda2.img.ac
+ sending as: 20-partclone-sda2.img.ac
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 109 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 47 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 477 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 397 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 169 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 273 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 40 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 277 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Got 283 NAKs for section 2 from client 0x7AECB2FE
+Sending section 5
+Got 142 NAKs for section 3 from client 0x7AECB2FE
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 3
+Sending section 2
+Sending section 3
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 18.411 seconds
+Total elapsed time: 18.411 seconds
+Overall throughput: 5562.02 KB/s
+----- 20-partclone-sda2.img.ad -----
+File ID: 0007 Name: 20-partclone-sda2.img.ad
+ sending as: 20-partclone-sda2.img.ad
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 652 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Sending section 3
+Got 509 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 143 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 303 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 58 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 244 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 2
+Sending section 3
+Sending section 4
+Got 245 NAKs for section 0 from client 0x7AECB2FE
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Got 316 NAKs for section 2 from client 0x7AECB2FE
+Got 204 NAKs for section 4 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 0
+Sending section 2
+Got 191 NAKs for section 6 from client 0x7AECB2FE
+Sending section 4
+Sending section 6
+Sending DONE 1.1
+Got 31 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 5
+Sending DONE 1.1
+Got 37 NAKs for section 2 from client 0x7AECB2FE
+Got 99 NAKs for section 3 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 5
+Sending section 2
+Sending section 3
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 20.795 seconds
+Total elapsed time: 20.795 seconds
+Overall throughput: 4924.27 KB/s
+----- 20-partclone-sda2.img.ae -----
+File ID: 0008 Name: 20-partclone-sda2.img.ae
+ sending as: 20-partclone-sda2.img.ae
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 81 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 235 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Sending section 4
+Got 684 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Sending section 6
+Got 273 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 411 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 75 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 3
+Got 21 NAKs for section 1 from client 0x7AECB2FE
+Sending section 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got 474 NAKs for section 3 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 1
+Sending section 3
+Got 34 NAKs for section 7 from client 0x7AECB2FE
+Sending section 7
+Sending DONE 1.1
+Got 24 NAKs for section 3 from client 0x7AECB2FE
+Got 174 NAKs for section 5 from client 0x7AECB2FE
+Got 253 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 3
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 18.859 seconds
+Total elapsed time: 18.859 seconds
+Overall throughput: 5429.67 KB/s
+----- 20-partclone-sda2.img.af -----
+File ID: 0009 Name: 20-partclone-sda2.img.af
+ sending as: 20-partclone-sda2.img.af
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 54 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 359 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 174 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 191 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 260 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 259 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 27 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 225 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Got 15 NAKs for section 2 from client 0x7AECB2FE
+Sending section 5
+Sending section 6
+Sending section 7
+Got 45 NAKs for section 4 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 40 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 2
+Sending section 4
+Sending section 5
+Sending DONE 1.1
+Got 58 NAKs for section 3 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 3
+Sending DONE 1.1
+Got 2 NAKs for section 6 from client 0x7AECB2FE
+Got 34 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 19.850 seconds
+Total elapsed time: 19.850 seconds
+Overall throughput: 5158.63 KB/s
+----- 20-partclone-sda2.img.ag -----
+File ID: 000A Name: 20-partclone-sda2.img.ag
+ sending as: 20-partclone-sda2.img.ag
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 493 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 54 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 573 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Sending section 5
+Got 319 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 37 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 212 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 43 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 4
+Sending section 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got 238 NAKs for section 2 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 2
+Sending DONE 1.1
+Got 27 NAKs for section 7 from client 0x7AECB2FE
+Got 145 NAKs for section 4 from client 0x7AECB2FE
+Got 26 NAKs for section 5 from client 0x7AECB2FE
+Got 124 NAKs for section 6 from client 0x7AECB2FE
+Got 27 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 4
+Sending section 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 19.665 seconds
+Total elapsed time: 19.665 seconds
+Overall throughput: 5207.31 KB/s
+----- 20-partclone-sda2.img.ah -----
+File ID: 000B Name: 20-partclone-sda2.img.ah
+ sending as: 20-partclone-sda2.img.ah
+Bytes: 23054408 Blocks: 17735 Sections: 2
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 82 NAKs for section 0 from client 0x7AECB2FE
+Sending DONE 1.1
+<-------------- 100% CPU and no activity on network. Attached ddd, tried to save session but it fails to save the core file.
+ Abandon
+lpouzenc@lud-x200s:~/git/eficast/uftp/uftp-4.9.2$
+
diff --git a/draft/uftp/notes.txt b/draft/uftp/notes.txt
new file mode 100644
index 0000000..25ee4b0
--- /dev/null
+++ b/draft/uftp/notes.txt
@@ -0,0 +1,42 @@
+
+SRCPART=/dev/sda2
+DESTDIR=/home
+PARTCLONE_EXTRAOPTS="-N"
+SPLIT_SIZE=1G
+
+partclone.imager -c -s $SRCPART -o - $PARTCLONE_EXTRAOPTS | split -b$SPLIT_SIZE - $DESTDIR/partclone-sda2.img.
+
+
+
+----------------
+
+PARTCLONE_EXTRAOPTS="-N"
+DSTPART=/dev/sda2
+./sinkcat.sh /dev/shm/sink | partclone.restore $PARTCLONE_EXTRAOPTS -o $DSTPART
+
+----------------------
+
+# setsockopt(3, SOL_IPV6, 0x2a /* IPV6_??? */, "\2\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\377\3\0\0\0\0\0\0\0\0\0\1\0\2\0\3"..., 136) = -1 EADDRINUSE (Address already in use)
+#write(2, "Error joining multicast group", 29Error joining multicast group) = 29
+#write(2, ": Address already in use", 24: Address already in use) = 24
+
+ADDR_OPTS="-M ff02::42 -I 2/6" # Bug si IP multiples sur même interface
+LOG_OPTS="-x3 -S /tmp/uftpd.csv -L /dev/shm/uftpd.log "
+DIR_OPTS="-T /dev/shm/tmp -D /dev/shm/uftpd -i"
+mkdir /dev/shm/{tmp,uftpd}
+
+./uftpd -q -B 2097152 $LOG_OPTS $ADDR_OPTS $DIR_OPTS
+[ $? -eq 0 ] && netstat -nlu | grep -q ':1044 ' && echo -e '\033[42m' ----- UFTPD ready ----- '\033[40m'
+
+./sinkdo.sh /dev/shm/uftpd /dev/shm/sink
+
+
+---------------------------------------------------
+
+IMGDIR=/home/lpouzenc/git/eficast/testimage
+#RATE_OPTS="-R90000 -W 400 -s 20"
+RATE_OPTS="-C tfmcc -s 20"
+LOG_OPTS="-x2 -S /tmp/uftpd.csv"
+ADDR_OPTS="-M ff02::42 -P ff02::43 -I 3/6" # -I 3/6 is virbr0 ipv6
+
+./uftp -f $RATE_OPTS $LOG_OPTS $ADDR_OPTS -- $IMGDIR/*
diff --git a/draft/uftp/sinkcat.sh b/draft/uftp/sinkcat.sh
new file mode 100755
index 0000000..20ac948
--- /dev/null
+++ b/draft/uftp/sinkcat.sh
@@ -0,0 +1,39 @@
+#!/bin/busybox sh
+
+if [ $# -ne 1 ]
+then cat <<EOT
+Usage: $(basename $0) <sink-dir>
+ Concatenate then delete files as soon they appear in sink-dir to stdout.
+ If multiple files are found in sink, the first in alphabetical order is choosen.
+ <sink-dir> must not exists, this program must create it (avoiding mistakes).
+ Dropping an empty file in dir-sink will clean exit this program.
+EOT
+ exit 1
+fi
+
+SINKDIR=$1
+mkdir "$SINKDIR" && cd "$SINKDIR"
+if [ $? -ne 0 ]
+then echo "Cannot mkdir/chdir to '$SINKDIR'" >&2
+ exit 2
+fi
+
+while true
+do
+ f=$(ls | head -n1)
+ if [ -n "$f" ]
+ then if [ -f "$f" -a -r "$f" ]
+ then size=$(stat -c'%s' -- "$f")
+ # Do the actual work on the following line
+ cat -- "$f" && rm -v -- "$f" >&2
+ # Normal exit condition
+ if [ $size -eq 0 ]
+ then cd / && rmdir -v -- "$SINKDIR" >&2
+ exit 0
+ fi
+ else echo "'$SINKDIR/$f' is not a readable file" >&2
+ exit 3
+ fi
+ fi
+ sleep 1
+done
diff --git a/draft/uftp/sinkdo.sh b/draft/uftp/sinkdo.sh
new file mode 100755
index 0000000..1b46437
--- /dev/null
+++ b/draft/uftp/sinkdo.sh
@@ -0,0 +1,57 @@
+#!/bin/busybox sh
+
+if [ $# -ne 2 ]
+then cat <<EOT
+Usage: $(basename $0) <land-dir> <sink-dir>
+EOT
+ exit 1
+fi
+
+LANDDIR=$1
+SINKDIR=$2
+cd "$LANDDIR" || exit 2
+
+curtask="(start)"
+while true
+do
+ f=$(ls | head -n1)
+ if [ -z "$f" ]
+ then sleep 1
+ continue
+ fi
+ if [ ! -f "$f" -o ! -r "$f" ]
+ then echo "'$LANDDIR/$f' is not a readable file" >&2
+ exit 2
+ fi
+ size=$(stat -c'%s' -- "$f")
+ task=${f:0:2}
+ if [ "$curtask" == "$task" ]
+ then # Next file of an already started task
+ mv "$f" "$SINKDIR/"
+ else # Switch to the next task
+ if [ -d "$SINKDIR" ]
+ then # Inform sinkcat about end-of-data
+ touch -- "$SINKDIR/zz"
+ wait
+ # sinkcat always rmdir "$SINKDIR" on normal exit
+ if [ -d "$SINKDIR" ]
+ then echo "Task $task has ran into troubles" >&2
+ exit 3
+ fi
+ fi
+ echo "Switching from task $curtask to $task" >&2
+ curtask=$task
+ if [ "$task" == "99" ]
+ then # Normal exit condition
+ rm -v "$f" >&2
+ reset
+ echo "All task completed sucessfully" >&2
+ exit 0
+ else # Start a new task
+ chmod +x -- "$f" # XXX Checks on $f (is a script ?)
+ sinkcat.sh $SINKDIR | "./$f" &
+ while [ ! -d "$SINKDIR" ]; do sleep 1; done
+ rm -v "$f" >&2
+ fi
+ fi
+done
diff --git a/draft/uftp/trace-lost-buf.txt b/draft/uftp/trace-lost-buf.txt
new file mode 100644
index 0000000..38d737e
--- /dev/null
+++ b/draft/uftp/trace-lost-buf.txt
@@ -0,0 +1,485 @@
+UFTP version 4.9.2 Copyright (C) 2001-2016 Dennis A. Bush
+--25769-- REDIR: 0x57d3ff0 (libc.so.6:__GI_memcmp) redirected to 0x4c2eca0 (__GI_memcmp)
+--25769-- REDIR: 0x57cf200 (libc.so.6:__GI_strcmp) redirected to 0x4c2d220 (__GI_strcmp)
+--25769-- REDIR: 0x57d0dd0 (libc.so.6:strnlen) redirected to 0x4c2c120 (strnlen)
+Starting at Mon Dec 19 17:26:27 2016
+Transfer rate: dynamic via TFMCC
+Using private multicast address ff02::43 Group ID: ED047C7C
+Initializing group
+--25769-- REDIR: 0xffffffffff600000 (???:???) redirected to 0x380bd803 (vgPlain_amd64_linux_REDIR_FOR_vgettimeofday)
+Sending ANNOUNCE 1
+Received REGISTER from client 0x7AECB2FE
+Sending REG_CONF 2.1
+Sending ANNOUNCE 2
+Sending ANNOUNCE 3
+Sending ANNOUNCE 4
+Sending ANNOUNCE 5
+Sending ANNOUNCE 6
+Sending ANNOUNCE 7
+Sending ANNOUNCE 8
+Sending ANNOUNCE 9
+Sending ANNOUNCE 10
+Sending ANNOUNCE 11
+Sending ANNOUNCE 12
+Sending ANNOUNCE 13
+Sending ANNOUNCE 14
+Sending ANNOUNCE 15
+Sending ANNOUNCE 16
+Sending ANNOUNCE 17
+Sending ANNOUNCE 18
+Sending ANNOUNCE 19
+Sending ANNOUNCE 20
+--25769-- REDIR: 0x57d1030 (libc.so.6:strncmp) redirected to 0x4a23730 (_vgnU_ifunc_wrapper)
+--25769-- REDIR: 0x586e9f0 (libc.so.6:__strncmp_sse42) redirected to 0x4c2ca30 (__strncmp_sse42)
+----- 10-restore-mbr.00.sh -----
+File ID: 0001 Name: 10-restore-mbr.00.sh
+ sending as: 10-restore-mbr.00.sh
+Bytes: 50 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.212 seconds
+Total elapsed time: 0.212 seconds
+Overall throughput: 0.23 KB/s
+----- 10-restore-mbr.aa -----
+File ID: 0002 Name: 10-restore-mbr.aa
+ sending as: 10-restore-mbr.aa
+Bytes: 512 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.045 seconds
+Total elapsed time: 0.045 seconds
+Overall throughput: 11.01 KB/s
+----- 20-partclone-sda2.img.00.sh -----
+File ID: 0003 Name: 20-partclone-sda2.img.00.sh
+ sending as: 20-partclone-sda2.img.00.sh
+Bytes: 112 Blocks: 1 Sections: 1
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.100 seconds
+Total elapsed time: 0.100 seconds
+Overall throughput: 1.10 KB/s
+----- 20-partclone-sda2.img.aa -----
+File ID: 0004 Name: 20-partclone-sda2.img.aa
+ sending as: 20-partclone-sda2.img.aa
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 468 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Sending section 3
+Got 363 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 525 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 157 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 40 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 133 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 45 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 2
+Got 15 NAKs for section 0 from client 0x7AECB2FE
+Sending section 3
+Sending section 4
+Sending section 5
+Got 213 NAKs for section 3 from client 0x7AECB2FE
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 3
+Sending section 0
+Sending section 3
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 25.278 seconds
+Total elapsed time: 25.278 seconds
+Overall throughput: 4051.00 KB/s
+----- 20-partclone-sda2.img.ab -----
+File ID: 0005 Name: 20-partclone-sda2.img.ab
+ sending as: 20-partclone-sda2.img.ab
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 85 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 141 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 86 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 511 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 35 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 785 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Sending DONE 1.1
+Got 238 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Sending section 5
+Got 129 NAKs for section 3 from client 0x7AECB2FE
+Sending section 7
+Sending DONE 1.1
+Got 354 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 3
+Sending section 5
+Sending DONE 1.1
+Got 28 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 5
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 23.408 seconds
+Total elapsed time: 23.408 seconds
+Overall throughput: 4374.56 KB/s
+----- 20-partclone-sda2.img.ac -----
+File ID: 0006 Name: 20-partclone-sda2.img.ac
+ sending as: 20-partclone-sda2.img.ac
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 10 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 158 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 254 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 162 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 482 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 152 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 273 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 195 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Sending section 5
+Sending section 6
+Got 240 NAKs for section 4 from client 0x7AECB2FE
+Sending section 7
+Sending DONE 1.1
+Got 2 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 4
+Sending section 6
+Sending DONE 1.1
+Got 25 NAKs for section 4 from client 0x7AECB2FE
+Got 53 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 4
+Sending section 5
+Sending DONE 1.1
+Got 52 NAKs for section 3 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 5
+Sending section 3
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 21.765 seconds
+Total elapsed time: 21.765 seconds
+Overall throughput: 4704.82 KB/s
+----- 20-partclone-sda2.img.ad -----
+File ID: 0007 Name: 20-partclone-sda2.img.ad
+ sending as: 20-partclone-sda2.img.ad
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 202 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 116 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 341 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Sending section 5
+Got 744 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Sending section 7
+Got 634 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 422 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 4
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 21.724 seconds
+Total elapsed time: 21.724 seconds
+Overall throughput: 4713.78 KB/s
+----- 20-partclone-sda2.img.ae -----
+File ID: 0008 Name: 20-partclone-sda2.img.ae
+ sending as: 20-partclone-sda2.img.ae
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 197 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 28 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 784 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 140 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 203 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 257 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 279 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 104 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 3
+Sending section 4
+Got 400 NAKs for section 2 from client 0x7AECB2FE
+Sending section 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 3
+Sending section 2
+Sending DONE 1.1
+Got 32 NAKs for section 5 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 4
+Sending section 5
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 21.747 seconds
+Total elapsed time: 21.747 seconds
+Overall throughput: 4708.69 KB/s
+----- 20-partclone-sda2.img.af -----
+File ID: 0009 Name: 20-partclone-sda2.img.af
+ sending as: 20-partclone-sda2.img.af
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 310 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Got 162 NAKs for section 1 from client 0x7AECB2FE
+Sending section 3
+Got 326 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Sending section 5
+Got 59 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 502 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 308 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending section 2
+Sending section 4
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Got 122 NAKs for section 5 from client 0x7AECB2FE
+Got 40 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 3
+Sending section 5
+Sending section 6
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 23.670 seconds
+Total elapsed time: 23.670 seconds
+Overall throughput: 4326.17 KB/s
+----- 20-partclone-sda2.img.ag -----
+File ID: 000A Name: 20-partclone-sda2.img.ag
+ sending as: 20-partclone-sda2.img.ag
+Bytes: 104857600 Blocks: 80660 Sections: 8
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 337 NAKs for section 0 from client 0x7AECB2FE
+Sending section 2
+Sending section 3
+Got 1629 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Got 289 NAKs for section 3 from client 0x7AECB2FE
+Sending section 5
+Got 372 NAKs for section 4 from client 0x7AECB2FE
+Sending section 6
+Got 33 NAKs for section 5 from client 0x7AECB2FE
+Sending section 7
+Got 525 NAKs for section 6 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 157 NAKs for section 7 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 2
+Got 26 NAKs for section 0 from client 0x7AECB2FE
+Sending section 3
+Got 4 NAKs for section 2 from client 0x7AECB2FE
+Sending section 4
+Sending section 5
+Sending section 6
+Sending section 7
+Sending DONE 1.1
+Sending DONE 2.1
+Starting pass 3
+Sending section 0
+Sending section 2
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 21.727 seconds
+Total elapsed time: 21.727 seconds
+Overall throughput: 4712.95 KB/s
+----- 20-partclone-sda2.img.ah -----
+File ID: 000B Name: 20-partclone-sda2.img.ah
+ sending as: 20-partclone-sda2.img.ah
+Bytes: 23054408 Blocks: 17735 Sections: 2
+Sending FILEINFO 1.1
+Rejecting COMPLETE from 0x7AECB2FE: invalid file ID 000A, expected 000B
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending section 0
+Sending section 1
+Got 194 NAKs for section 0 from client 0x7AECB2FE
+Sending DONE 1.1
+Got 81 NAKs for section 1 from client 0x7AECB2FE
+Sending DONE 2.1
+Starting pass 2
+Sending section 0
+Sending section 1
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 9.598 seconds
+Total elapsed time: 9.598 seconds
+Overall throughput: 2345.77 KB/s
+----- 99-end -----
+File ID: 000C Name: 99-end
+ sending as: 99-end
+Bytes: 0 Blocks: 0 Sections: 0
+Sending FILEINFO 1.1
+Received FILEINFO_ACK from client 0x7AECB2FE
+Sending file
+Starting pass 1
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Transfer status:
+Host: 0x7AECB2FE Status: Completed time: 0.007 seconds
+Total elapsed time: 0.007 seconds
+Overall throughput: 0.00 KB/s
+-----------------------------
+Finishing group
+Sending DONE 1.1
+Got COMPLETE from client 0x7AECB2FE
+Late completions:
+Sending DONE_CONF 2.1
+Group complete
+uftp: Finishing at Mon Dec 19 17:29:20 2016
+==25769==
+==25769== HEAP SUMMARY:
+==25769== in use at exit: 1,300 bytes in 1 blocks
+==25769== total heap usage: 20,607 allocs, 20,606 frees, 3,601,627,892 bytes allocated
+==25769==
+==25769== Searching for pointers to 1 not-freed blocks
+==25769== Checked 25,760,600 bytes
+==25769==
+==25769== 1,300 bytes in 1 blocks are definitely lost in loss record 1 of 1
+==25769== at 0x4C2AD10: calloc (vg_replace_malloc.c:623)
+==25769== by 0x407C1C: safe_calloc (uftp_common.c:2058)
+==25769== by 0x40FE89: create_cc_list (server_transfer.c:129)
+==25769== by 0x418FD1: transfer_receive_thread (server_phase.c:859)
+==25769== by 0x41A9AC: transfer_phase (server_phase.c:1186)
+==25769== by 0x414420: send_file (server_send.c:199)
+==25769== by 0x415A60: send_files (server_send.c:588)
+==25769== by 0x4214D9: main (server_main.c:42)
+==25769==
+==25769== LEAK SUMMARY:
+==25769== definitely lost: 1,300 bytes in 1 blocks
+==25769== indirectly lost: 0 bytes in 0 blocks
+==25769== possibly lost: 0 bytes in 0 blocks
+==25769== still reachable: 0 bytes in 0 blocks
+==25769== suppressed: 0 bytes in 0 blocks
+==25769==
+==25769== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+==25769== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)