Avoid error log for transfer stop w/o error code.

A number of tftp clients, including the one in Intel's pxe boot loader,
may intentionally stop a transfer using error code 0 (i.e., EUNDEF).
These are not real errors.  Avoid spamming log files with these by
logging them at level LOG_DEBUG instead.

Discussed on -hackers with an initial patch proposal; this change is an
improved approach suggested by kan@.
This commit is contained in:
Ed Maste 2012-02-21 14:59:07 +00:00
parent 526d0bd547
commit 9a2856b439
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231973

View File

@ -463,7 +463,8 @@ receive_packet(int peer, char *data, int size, struct sockaddr_storage *from,
}
if (pkt->th_opcode == ERROR) {
tftp_log(LOG_ERR, "Got ERROR packet: %s", pkt->th_msg);
tftp_log(pkt->th_code == EUNDEF ? LOG_DEBUG : LOG_ERR,
"Got ERROR packet: %s", pkt->th_msg);
return (RP_ERROR);
}