3

I'm trying to set up a TFTP server using tftp-hpa, and according to the manpage I can use the --verbosity option to get more output.

Unfortunately I can't find anything that explains what I should pass to this option. How do I use it?

  • --verbosity loud
  • --verbosity 5
  • --verbosity 255
  • --verbosity DEBUG

Is this documented anywhere? Nothing I have tried so far produces any messages on stdout.

Malvineous
  • 6,524
  • 5
  • 52
  • 76

2 Answers2

4

To add to this, I also discovered that tftpd-hpa only logs to syslog, not stdout/stderr, even when running in foreground mode. This is why no matter what I set the verbosity flag to, I was not seeing any output.

Since I am running it in Docker and want logs to go to stdout/stderr so I can view them with the docker logs command, I had to run a syslog client in the Docker container as well to receive the messages tftpd-hpa was sending.

I found an example online that I borrowed, which used syslog-ng and configured it to write everything to stdout.

With this running, the logs appear:

$ docker logs abc123
Jul  3 09:37:57 vorticon syslog-ng[7]: syslog-ng starting up; version='3.30.1'
Jul  3 09:39:00 host in.tftpd[11]: remap: input: test2a.txt
Jul  3 09:39:00 host in.tftpd[11]: remap: rule 0: rewrite: 192.168.0.1/test2a.txt
Jul  3 09:39:00 host in.tftpd[11]: remap: done
Jul  3 09:39:00 host in.tftpd[11]: RRQ from 192.168.0.1 filename test2a.txt remapped to 192.168.0.1/test2a.txt
Jul  3 09:39:00 host in.tftpd[11]: sending NAK (1, File not found) to 192.168.0.1
Malvineous
  • 6,524
  • 5
  • 52
  • 76
3

The --verbosity value takes an integer value. As usual, the best source of truth is the code itself which can be found at https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/tree/

Here is the relevant part of the code from tftpd.c that parses the --verbosity parameter. It confirms that it takes an integer value. Also shown is the relationship between -v and --verbosity as described in the man page.

case 'v':
    verbosity++;
    break;
case OPT_VERBOSITY:
    verbosity = atoi(optarg);
    break;

It is not specified what the maximum verbosity level is (as that could change with different versions of the source code). But a search of the latest source code finds that the verbosity value is significant from 0-4. Any value above 4 has no extra effect.

kaylum
  • 531
  • 3
  • 6