From 55688c14edafeaec5074a3be2ab65033b068c3c1 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 4 Oct 2022 20:48:28 +0100 Subject: [PATCH] pass remote host and port to callback as params 2..3 This allows the callback to handle the response differently depending on who is asking - for example, to refuse requests from clients on a blocklist --- pkgs/tufted/tftp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tufted/tftp.lua b/pkgs/tufted/tftp.lua index 55d22aa..f7e0ac5 100644 --- a/pkgs/tufted/tftp.lua +++ b/pkgs/tufted/tftp.lua @@ -286,7 +286,7 @@ function tftp:listen(rrq_generator_callback, wrq_generator_callback, hosts, port }``` On error, responds to the client with an ERROR packet, and returns nil. ]] - local okay, generator, tsize = pcall(callbacks[request.opcode], request.filename) + local okay, generator, tsize = pcall(callbacks[request.opcode], request.filename, host, port) if not okay then requestsocket:sendto(self.ERROR(ERR_NOTFOUND), host, port) return nil