Your TFTP lunapark with blackjack and C ++ 17

image







Preamble



I work on the GNU Linux embedded software development team for telecommunications equipment. During development, our team gets a huge number of firmwares for our equipment: release versions, pre-release versions, test debug builds, builds for different branches from the task tracker - and all this for different hardware platforms.







The firmware, in this case, is ...

, 70, :









To identify firmware files in the document management system and tracker, MD5 hashes in * .md5 files are used. As a result, we have several trees in the file system for storing firmware.







, , TFTP.









" " , TFTP md5-, .









, TFTP Firmware Server server-fw.







:







  • RFC1350 "THE TFTP PROTOCOL (REVISION 2)"
  • RFC2347 "TFTP Option Extension"
  • RFC2348 "TFTP Blocksize Option"
  • RFC7440 "TFTP Windowsize Option" ()


v0.2.0







$ bin/server-fw -h
Simple tftp firmware server 'server-fw' v0.2 licensed GPL-3.0
(c) 2019-2021 Vitaliy.V.Shirinkin, e-mail: vitaliy.shirinkin@gmail.com
Some features:
  - Recursive search requested files by md5 sum in search directory
  - Use Firebird SQL server as file storage (optional requirement)
Usage: bin/server-fw [<option1> [<option1 argument>]] [<option2> [<option2 argument>]] ... 
Possible options:
  {-h|-H|-?|--help} Show help message
  {-l|-L|--ip|--listen} {<IPv4>|[<IPv6>]}[:port] Listening address and port
    (default 0.0.0.0:69)
    Sample IPv4: 192.168.0.1:69
    Sample IPv6: [::1]:69
  {-s|-S|--syslog} <0...7> SYSLOG level flooding (default 6)
  --lib-dir <directory> System library directory
  --lib-name <name> Firebird library filename (default libfbclient.so)
  --root-dir <directory> Server root directory
  --search <directory> Directory for recursive search by md5 sum (may be much)
  --fb-db <database> Firebird access database name
  --fb-user <username> Firebird access user name
  --fb-pass <password> Firebird access password
  --fb-role <role> Firebird access role
  --fb-dialect <1...3> Firebird server dialect (default 3)
  --daemon Run as daemon
  --retransmit <N> Maximum retransmit count if fail
  --file-chuser <user name> Set user owner for created files (default root)
  --file-chgrp <group name> Set group owner for created files (default root)
    Warning: if user/group not exist then use root
  --file-chmod <permissions> Set permissions for created files (default 0664)
    Warning: can set only r/w bits - maximum 0666; can't set x-bits and superbits
      
      





( --root-dir) ( --search). GET .

( --file-chmod) ( --file-chuser --file-chgrp).







/etc/default/server-fw.







/etc/default/server-fw
IP --listen
SYSLOG --syslog
ROOT_DIR --root-dir
SERACH --search
FILE_CHUSER --file-chuser
FILE_CHGRP --file-chgrp
FILE_CHMOD --file-chmod


GET :







  • md5-, :

    —

    —
  • :

    —

    —


PUT, .







OC Ubuntu 18.04 ( )







(GNU Linux):







$ mkdir server-fw
$ git clone https://github.com/shvit/server-fw.git server-fw
...
$ cd server-fw
$ make deb
...
$
      
      







mail netascii, octet ( , - ? . ).







"windowsize" , .









:



All Articles