public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/tftp] rawhide: rebase to the latest upstream release
@ 2026-09-08 10:49
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-09-08 10:49 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/tftp
Branch : rawhide
Commit : b2788cd12c6c2d787192c0a496ed0cd7fb339ea2
Author : Lukáš Zaoral <lzaoral@redhat.com>
Date : 2026-09-08T12:01:24+02:00
Stats : +302/-332 in 9 file(s)
URL : https://src.fedoraproject.org/rpms/tftp/c/b2788cd12c6c2d787192c0a496ed0cd7fb339ea2?branch=rawhide
Log:
rebase to the latest upstream release
Resolves: rhbz#2529277
---
diff --git a/.gitignore b/.gitignore
index 20f5e37..a773a32 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ tftp-hpa-0.49.tar.bz2
/tftp-hpa-5.4.tar.sign
/tftp-hpa-6.0.tar.gz
/tftp-hpa-6.0.tar.sign
+/tftp-hpa-6.1.tar.gz
+/tftp-hpa-6.1.tar.sign
diff --git a/sources b/sources
index 38914a2..6e9deca 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (tftp-hpa-6.0.tar.gz) = 85620c5ce5b7fdeb074a0093c640ace941954189328c2a42b0339b74007767221567240731a15d529c5308c868f03fe9464f9ce6a666932fb738d3ed153dd66f
-SHA512 (tftp-hpa-6.0.tar.sign) = 697595d1ef3bb114b9acc4a95950e4244fb6375a6b97ba0604946a97cc2e4c72be8c7d68040d9d1424ef0fc53aef1d6ae440e7149deb59ec124ddf1e135b9103
+SHA512 (tftp-hpa-6.1.tar.gz) = e6901af35a98f21ba270cff8870fd41f4151f1521aa7e5d38b0cfd9d6f0ab1221f822c76614e8771423b114dfcefd48c802454cf3eef174a075ebd69e757a032
+SHA512 (tftp-hpa-6.1.tar.sign) = 3f1653439f28ccb948a49a3445eb1beb65a3e8fab7d22d55663b6d90d4ccf84855f97cb6d2731f664755cffaaa5e17db52a81967f40cac985f4fd44de57bc281
diff --git a/tftp-enhanced-logging.patch b/tftp-enhanced-logging.patch
index f47c406..71f6e96 100644
--- a/tftp-enhanced-logging.patch
+++ b/tftp-enhanced-logging.patch
@@ -1,8 +1,8 @@
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 9c1d195..98f7950 100644
+index aaf1f9c..b8ef4f4 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -1026,7 +1026,7 @@ int main(int argc, char **argv)
+@@ -1059,7 +1059,7 @@ int main(int argc, char **argv)
static char *rewrite_access(const struct formats *,
char *, int, int, const char **);
static int validate_access(char *, int, const struct formats *, const char **);
@@ -11,7 +11,7 @@ index 9c1d195..98f7950 100644
static void tftp_recvfile(const struct formats *, struct tftphdr *, int);
static const struct formats formats[] = {
-@@ -1119,6 +1119,9 @@ int tftp(struct tftphdr *tp, int size)
+@@ -1152,6 +1152,9 @@ static int tftp(struct tftphdr *tp, int size)
if (!file) {
ecode =
(*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
@@ -21,7 +21,7 @@ index 9c1d195..98f7950 100644
if (ecode) {
nak(ecode, errmsgptr);
exit(0);
-@@ -1145,12 +1148,12 @@ int tftp(struct tftphdr *tp, int size)
+@@ -1178,12 +1181,12 @@ static int tftp(struct tftphdr *tp, int size)
if (tp_opcode == WRQ)
(*pf->f_recv) (pf, (struct tftphdr *)ackbuf, ap - ackbuf);
else
@@ -36,45 +36,33 @@ index 9c1d195..98f7950 100644
}
exit(0); /* Request completed */
}
-@@ -1672,7 +1675,7 @@ static int validate_access(char *filename, int mode,
+@@ -1716,7 +1719,7 @@ static int validate_access(char *filename, int mode,
/*
* Send the requested file.
*/
-static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oacklen)
+static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oacklen, char *filename)
{
- struct tftphdr *dp;
struct tftphdr *ap; /* ack packet */
-@@ -1783,6 +1786,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
- break;
- }
- }
-+ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
-+ tmpbuf, INET6_ADDRSTRLEN);
-+ if (!tmp_p) {
+ uint16_t ap_opcode, ap_block;
+@@ -1790,6 +1793,15 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
+ errno = result.error;
+ tftpd_log(LOG_WARNING, "tftpd: read(ack): %m");
+ break;
++ case TFTP_XFER_OK:
++ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
++ tmpbuf, INET6_ADDRSTRLEN);
++ if (!tmp_p) {
+ tmp_p = tmpbuf;
+ strcpy(tmpbuf, "???");
-+ }
-+ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
- abort:
- tftpio_stop(io);
- io = NULL;
-@@ -1856,6 +1866,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
- xfree(packets);
- xfree(lengths);
++ }
++ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
++ break;
+ default:
+ break;
}
-+ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
-+ tmpbuf, INET6_ADDRSTRLEN);
-+ if (!tmp_p) {
-+ tmp_p = tmpbuf;
-+ strcpy(tmpbuf, "???");
-+ }
-+ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
- abort:
- (void)fclose(file);
- #endif
diff --git a/tftpd/tftpd.h b/tftpd/tftpd.h
-index b6658d4..a52adc5 100644
+index 3727ba4..4626a55 100644
--- a/tftpd/tftpd.h
+++ b/tftpd/tftpd.h
@@ -34,7 +34,7 @@ struct formats {
@@ -84,5 +72,8 @@ index b6658d4..a52adc5 100644
- void (*f_send) (const struct formats *, struct tftphdr *, int);
+ void (*f_send) (const struct formats *, struct tftphdr *, int, char *);
void (*f_recv) (const struct formats *, struct tftphdr *, int);
- int f_convert;
+ bool f_convert;
};
+--
+2.55.0
+
diff --git a/tftp-hpa-5.2-osh.patch b/tftp-hpa-5.2-osh.patch
index 460b5a8..3296a45 100644
--- a/tftp-hpa-5.2-osh.patch
+++ b/tftp-hpa-5.2-osh.patch
@@ -1,9 +1,9 @@
# Fix leaked_handle: Handle variable "fd" going out of scope leaks the handle.
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 98f7950..b3fd06c 100644
+index b8ef4f4..bfe9323 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -1636,6 +1636,7 @@ static int validate_access(char *filename, int mode,
+@@ -1680,6 +1680,7 @@ static int validate_access(char *filename, int mode,
if (mode == RRQ) {
if (!unixperms && (stbuf.st_mode & (S_IREAD >> 6)) == 0) {
@@ -11,7 +11,7 @@ index 98f7950..b3fd06c 100644
*errmsg = "File must have global read permissions";
return (EACCESS);
}
-@@ -1645,6 +1646,7 @@ static int validate_access(char *filename, int mode,
+@@ -1689,6 +1690,7 @@ static int validate_access(char *filename, int mode,
} else {
if (!unixperms) {
if ((stbuf.st_mode & (S_IWRITE >> 6)) == 0) {
@@ -19,7 +19,7 @@ index 98f7950..b3fd06c 100644
*errmsg = "File must have global write permissions";
return (EACCESS);
}
-@@ -1653,6 +1655,7 @@ static int validate_access(char *filename, int mode,
+@@ -1697,6 +1699,7 @@ static int validate_access(char *filename, int mode,
#ifdef HAVE_FTRUNCATE
/* We didn't get to truncate the file at open() time */
if (ftruncate(fd, (off_t) 0)) {
diff --git a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
index 8ab101b..83d0eb4 100644
--- a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
+++ b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
@@ -5,9 +5,9 @@ Subject: [PATCH] tftp: propagate errors to exit code in single command mode
---
tftp/extern.h | 4 +-
- tftp/main.c | 144 ++++++++++++++++++++++++++++----------------------
- tftp/tftp.c | 37 +++++++++++--
- 3 files changed, 115 insertions(+), 70 deletions(-)
+ tftp/main.c | 152 ++++++++++++++++++++++++++++----------------------
+ tftp/tftp.c | 42 +++++++++++---
+ 3 files changed, 122 insertions(+), 76 deletions(-)
diff --git a/tftp/extern.h b/tftp/extern.h
index 7740cb7..295b8e9 100644
@@ -25,49 +25,51 @@ index 7740cb7..295b8e9 100644
#endif
diff --git a/tftp/main.c b/tftp/main.c
-index d895a30..e8900ef 100644
+index 1b618b1..bbcab02 100644
--- a/tftp/main.c
+++ b/tftp/main.c
-@@ -82,22 +82,22 @@ unsigned int portrange_to = 0;
+@@ -84,23 +84,23 @@ static unsigned int portrange_to = 0;
unsigned int blocksize = SEGSIZE;
unsigned int windowsize;
--void get(int, char **);
--void help(int, char **);
--void modecmd(int, char **);
--void put(int, char **);
--void quit(int, char **);
--void setascii(int, char **);
--void setbinary(int, char **);
--void setblocksize(int, char **);
--void setpeer(int, char **);
--void setrexmt(int, char **);
--void settimeout(int, char **);
--void settrace(int, char **);
--void setverbose(int, char **);
--void status(int, char **);
--void setliteral(int, char **);
--void setwindowsize(int, char **);
-+int get(int, char **);
-+int help(int, char **);
-+int modecmd(int, char **);
-+int put(int, char **);
-+int quit(int, char **);
-+int setascii(int, char **);
-+int setbinary(int, char **);
-+int setblocksize(int, char **);
-+int setpeer(int, char **);
-+int setrexmt(int, char **);
-+int settimeout(int, char **);
-+int settrace(int, char **);
-+int setverbose(int, char **);
-+int status(int, char **);
-+int setliteral(int, char **);
-+int setwindowsize(int, char **);
+-static void get(int, char **);
+-static void help(int, char **);
+-static void modecmd(int, char **);
+-static void put(int, char **);
+-static void quit(int, char **);
+-static void setascii(int, char **);
+-static void setbinary(int, char **);
+-static void setblocksize(int, char **);
+-static void setpeer(int, char **);
+-static void setrexmt(int, char **);
+-static void settimeout(int, char **);
+-static void settrace(int, char **);
+-static void set_verbosity(const char *, bool);
+-static void setverbose(int, char **);
+-static void status(int, char **);
+-static void setliteral(int, char **);
+-static void setwindowsize(int, char **);
++static int get(int, char **);
++static int help(int, char **);
++static int modecmd(int, char **);
++static int put(int, char **);
++static int quit(int, char **);
++static int setascii(int, char **);
++static int setbinary(int, char **);
++static int setblocksize(int, char **);
++static int setpeer(int, char **);
++static int setrexmt(int, char **);
++static int settimeout(int, char **);
++static int settrace(int, char **);
++static int set_verbosity(const char *, bool);
++static int setverbose(int, char **);
++static int status(int, char **);
++static int setliteral(int, char **);
++static int setwindowsize(int, char **);
static void command(void);
-@@ -113,7 +113,7 @@ static void settftpmode(const struct modes *);
+@@ -116,7 +116,7 @@ static void settftpmode(const struct modes *);
struct cmd {
const char *name;
const char *help;
@@ -76,16 +78,16 @@ index d895a30..e8900ef 100644
};
static const struct cmd cmdtab[] = {
-@@ -243,7 +243,7 @@ static const char short_options[] = "+46vVlm:cR:B:W:w:h";
+@@ -246,7 +246,7 @@ static const char short_options[] = "+46vVlm:cR:B:W:w:abh";
int main(int argc, char *argv[])
{
union sock_addr sa;
- int optc;
+ int optc, ret;
static int pargc, peerargc;
- static int iscmd = 0;
+ static bool iscmd;
static char **pargv;
-@@ -418,9 +418,9 @@ int main(int argc, char *argv[])
+@@ -428,9 +428,9 @@ int main(int argc, char *argv[])
if (sigsetjmp(toplevel, 1) != 0)
exit(EX_UNAVAILABLE);
@@ -97,16 +99,16 @@ index d895a30..e8900ef 100644
}
#ifdef WITH_READLINE
#ifdef HAVE_READLINE_HISTORY_H
-@@ -475,7 +475,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
+@@ -485,7 +485,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
#endif
}
--void setpeer(int argc, char *argv[])
-+int setpeer(int argc, char *argv[])
+-static void setpeer(int argc, char *argv[])
++static int setpeer(int argc, char *argv[])
{
int err;
-@@ -487,7 +487,7 @@ void setpeer(int argc, char *argv[])
+@@ -497,7 +497,7 @@ static void setpeer(int argc, char *argv[])
}
if ((argc < 2) || (argc > 3)) {
printf("usage: %s host-name [port]\n", argv[0]);
@@ -115,33 +117,33 @@ index d895a30..e8900ef 100644
}
peeraddr.sa.sa_family = ai_fam;
-@@ -496,7 +496,7 @@ void setpeer(int argc, char *argv[])
+@@ -506,7 +506,7 @@ static void setpeer(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
- connected = 0;
+ connected = false;
- return;
+ return EX_NOHOST;
}
ai_fam = peeraddr.sa.sa_family;
if (f == -1) { /* socket not open */
-@@ -533,7 +533,7 @@ void setpeer(int argc, char *argv[])
+@@ -543,7 +543,7 @@ static void setpeer(int argc, char *argv[])
if (*ep || myport > 65535UL) {
printf("%s: bad port number\n", argv[2]);
- connected = 0;
+ connected = false;
- return;
+ return EX_USAGE;
}
- port = htons((u_short) myport);
+ port = htons((uint16_t) myport);
}
-@@ -549,16 +549,17 @@ void setpeer(int argc, char *argv[])
+@@ -560,16 +560,17 @@ static void setpeer(int argc, char *argv[])
hostname, tp, (unsigned int)ntohs(port));
}
- connected = 1;
+ connected = true;
+ return 0;
}
--void modecmd(int argc, char *argv[])
-+int modecmd(int argc, char *argv[])
+-static void modecmd(int argc, char *argv[])
++static int modecmd(int argc, char *argv[])
{
const struct modes *p;
const char *sep;
@@ -153,7 +155,7 @@ index d895a30..e8900ef 100644
}
if (argc == 2) {
for (p = modes; p->m_name; p++)
-@@ -566,7 +567,7 @@ void modecmd(int argc, char *argv[])
+@@ -577,7 +578,7 @@ static void modecmd(int argc, char *argv[])
break;
if (p->m_name) {
settftpmode(p);
@@ -162,7 +164,7 @@ index d895a30..e8900ef 100644
}
printf("%s: unknown mode\n", argv[1]);
/* drop through and print usage message */
-@@ -580,21 +581,23 @@ void modecmd(int argc, char *argv[])
+@@ -591,21 +592,23 @@ static void modecmd(int argc, char *argv[])
sep = " | ";
}
printf(" ]\n");
@@ -170,8 +172,8 @@ index d895a30..e8900ef 100644
+ return EX_USAGE;
}
--void setbinary(int argc, char *argv[])
-+int setbinary(int argc, char *argv[])
+-static void setbinary(int argc, char *argv[])
++static int setbinary(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
@@ -179,8 +181,8 @@ index d895a30..e8900ef 100644
+ return 0;
}
--void setascii(int argc, char *argv[])
-+int setascii(int argc, char *argv[])
+-static void setascii(int argc, char *argv[])
++static int setascii(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
@@ -189,16 +191,16 @@ index d895a30..e8900ef 100644
}
static void settftpmode(const struct modes *newmode)
-@@ -607,7 +610,7 @@ static void settftpmode(const struct modes *newmode)
+@@ -618,7 +621,7 @@ static void settftpmode(const struct modes *newmode)
/*
* Send file(s).
*/
--void put(int argc, char *argv[])
-+int put(int argc, char *argv[])
+-static void put(int argc, char *argv[])
++static int put(int argc, char *argv[])
{
int fd;
int n, err;
-@@ -621,14 +624,14 @@ void put(int argc, char *argv[])
+@@ -633,14 +636,14 @@ static void put(int argc, char *argv[])
}
if (argc < 2) {
putusage(argv[0]);
@@ -215,15 +217,15 @@ index d895a30..e8900ef 100644
}
cp = argv[argc - 1];
targ = strchr(cp, ':');
-@@ -639,14 +642,14 @@ void put(int argc, char *argv[])
+@@ -651,14 +654,14 @@ static void put(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
- connected = 0;
+ connected = false;
- return;
+ return EX_NOHOST;
}
ai_fam = peeraddr.sa.sa_family;
- connected = 1;
+ connected = true;
}
if (!connected) {
printf("No target machine specified.\n");
@@ -232,7 +234,7 @@ index d895a30..e8900ef 100644
}
if (argc < 4) {
cp = argc == 2 ? tail(targ) : argv[1];
-@@ -654,17 +657,18 @@ void put(int argc, char *argv[])
+@@ -666,17 +669,18 @@ static void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -254,7 +256,7 @@ index d895a30..e8900ef 100644
for (n = 1; n < argc - 1; n++) {
const char *base = tail(argv[n]);
char *remotepath = xmalloc(strlen(targ) + 1 + strlen(base) + 1);
-@@ -674,6 +678,7 @@ void put(int argc, char *argv[])
+@@ -686,6 +690,7 @@ static void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(argv[n]);
@@ -262,7 +264,7 @@ index d895a30..e8900ef 100644
free(remotepath);
continue;
}
-@@ -681,9 +686,11 @@ void put(int argc, char *argv[])
+@@ -693,9 +698,11 @@ static void put(int argc, char *argv[])
printf("putting %s to %s:%s [%s]\n",
argv[n], hostname, remotepath, mode->m_mode);
sa_set_port(&peeraddr, port);
@@ -274,13 +276,13 @@ index d895a30..e8900ef 100644
+ return err;
}
- static void putusage(char *s)
-@@ -695,10 +702,10 @@ static void putusage(char *s)
+ static void putusage(const char *s)
+@@ -707,10 +714,10 @@ static void putusage(const char *s)
/*
* Receive file(s).
*/
--void get(int argc, char *argv[])
-+int get(int argc, char *argv[])
+-static void get(int argc, char *argv[])
++static int get(int argc, char *argv[])
{
int fd;
- int n;
@@ -288,7 +290,7 @@ index d895a30..e8900ef 100644
char *cp;
char *src;
-@@ -710,28 +717,28 @@ void get(int argc, char *argv[])
+@@ -722,28 +729,28 @@ static void get(int argc, char *argv[])
}
if (argc < 2) {
getusage(argv[0]);
@@ -321,7 +323,7 @@ index d895a30..e8900ef 100644
continue;
}
ai_fam = peeraddr.sa.sa_family;
-@@ -744,13 +751,13 @@ void get(int argc, char *argv[])
+@@ -756,13 +763,13 @@ static void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -337,7 +339,7 @@ index d895a30..e8900ef 100644
break;
}
cp = tail(src); /* new .. jdg */
-@@ -759,14 +766,16 @@ void get(int argc, char *argv[])
+@@ -771,14 +778,16 @@ static void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -354,17 +356,17 @@ index d895a30..e8900ef 100644
+ return err;
}
- static void getusage(char *s)
-@@ -777,7 +786,7 @@ static void getusage(char *s)
-
+ static void getusage(const char *s)
+@@ -790,7 +799,7 @@ static void getusage(const char *s)
int rexmtval = TIMEOUT;
+ int maxtimeout = TIMEOUT_LIMIT * TIMEOUT;
--void setrexmt(int argc, char *argv[])
-+int setrexmt(int argc, char *argv[])
+-static void setrexmt(int argc, char *argv[])
++static int setrexmt(int argc, char *argv[])
{
int t;
-@@ -788,18 +797,19 @@ void setrexmt(int argc, char *argv[])
+@@ -801,7 +810,7 @@ static void setrexmt(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -372,21 +374,20 @@ index d895a30..e8900ef 100644
+ return EX_USAGE;
}
t = atoi(argv[1]);
- if (t < 0)
- printf("%s: bad value\n", argv[1]);
- else
+ if (t < 1)
+@@ -810,9 +819,10 @@ static void setrexmt(int argc, char *argv[])
rexmtval = t;
+ maxtimeout = rexmtval * TIMEOUT_LIMIT;
+ }
+ return 0;
}
- int maxtimeout = 5 * TIMEOUT;
-
--void settimeout(int argc, char *argv[])
-+int settimeout(int argc, char *argv[])
+-static void settimeout(int argc, char *argv[])
++static int settimeout(int argc, char *argv[])
{
int t;
-@@ -810,16 +820,17 @@ void settimeout(int argc, char *argv[])
+@@ -823,16 +833,17 @@ static void settimeout(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -394,19 +395,19 @@ index d895a30..e8900ef 100644
+ return EX_USAGE;
}
t = atoi(argv[1]);
- if (t < 0)
+ if (t < 1)
printf("%s: bad value\n", argv[1]);
else
maxtimeout = t;
+ return 0;
}
--void setblocksize(int argc, char *argv[])
-+int setblocksize(int argc, char *argv[])
+-static void setblocksize(int argc, char *argv[])
++static int setblocksize(int argc, char *argv[])
{
if (argc < 2) {
getmoreargs("blocksize ", "(size) ");
-@@ -828,15 +839,16 @@ void setblocksize(int argc, char *argv[])
+@@ -841,15 +852,16 @@ static void setblocksize(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s size\n", argv[0]);
@@ -420,12 +421,12 @@ index d895a30..e8900ef 100644
+ return 0;
}
--void setwindowsize(int argc, char *argv[])
-+int setwindowsize(int argc, char *argv[])
+-static void setwindowsize(int argc, char *argv[])
++static int setwindowsize(int argc, char *argv[])
{
if (argc < 2) {
getmoreargs("windowsize ", "(size) ");
-@@ -845,23 +857,25 @@ void setwindowsize(int argc, char *argv[])
+@@ -858,23 +870,25 @@ static void setwindowsize(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s size\n", argv[0]);
@@ -439,8 +440,8 @@ index d895a30..e8900ef 100644
+ return 0;
}
--void setliteral(int argc, char *argv[])
-+int setliteral(int argc, char *argv[])
+-static void setliteral(int argc, char *argv[])
++static int setliteral(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
@@ -449,38 +450,38 @@ index d895a30..e8900ef 100644
+ return 0;
}
--void status(int argc, char *argv[])
-+int status(int argc, char *argv[])
+-static void status(int argc, char *argv[])
++static int status(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -876,6 +890,7 @@ void status(int argc, char *argv[])
+@@ -889,6 +903,7 @@ static void status(int argc, char *argv[])
rexmtval, maxtimeout);
printf("Blocksize: %u, windowsize: %u\n", blocksize,
windowsize ? windowsize : 1);
+ return 0;
}
- void intr(int sig)
-@@ -1018,7 +1033,7 @@ static int makeargv(char *str, char **argp)
+ static void intr(int sig)
+@@ -1031,7 +1046,7 @@ static int makeargv(char *str, char **argp)
return argc;
}
--void quit(int argc, char *argv[])
-+int quit(int argc, char *argv[])
+-static void quit(int argc, char *argv[])
++static int quit(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -1028,7 +1043,7 @@ void quit(int argc, char *argv[])
+@@ -1041,7 +1056,7 @@ static void quit(int argc, char *argv[])
/*
* Help command.
*/
--void help(int argc, char *argv[])
-+int help(int argc, char *argv[])
+-static void help(int argc, char *argv[])
++static int help(int argc, char *argv[])
{
const struct cmd *c;
-@@ -1038,7 +1053,7 @@ void help(int argc, char *argv[])
+@@ -1051,7 +1066,7 @@ static void help(int argc, char *argv[])
printf("Commands may be abbreviated. Commands are:\n\n");
for (c = cmdtab; c->name; c++)
printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help);
@@ -489,15 +490,15 @@ index d895a30..e8900ef 100644
}
while (--argc > 0) {
const char *errtype;
-@@ -1050,22 +1065,25 @@ void help(int argc, char *argv[])
+@@ -1063,18 +1078,20 @@ static void help(int argc, char *argv[])
else
printf("%s\n", c->help);
}
+ return 0;
}
--void settrace(int argc, char *argv[])
-+int settrace(int argc, char *argv[])
+-static void settrace(int argc, char *argv[])
++static int settrace(int argc, char *argv[])
{
(void)argc;
(void)argv; /* Quiet unused warning */
@@ -507,21 +508,39 @@ index d895a30..e8900ef 100644
+ return 0;
}
--void setverbose(int argc, char *argv[])
-+int setverbose(int argc, char *argv[])
+-static void set_verbosity(const char *to, bool startup)
++static int set_verbosity(const char *to, bool startup)
{
- (void)argc;
- (void)argv; /* Quiet unused warning */
+ const char *name;
+
+@@ -1090,7 +1107,7 @@ static void set_verbosity(const char *to, bool startup)
+ exit(EX_USAGE);
+ } else {
+ printf("Invalid verbosity level: %s\n", to);
+- return;
++ return EX_USAGE;
+ }
+ }
+ } else {
+@@ -1111,10 +1128,11 @@ static void set_verbosity(const char *to, bool startup)
- verbose = !verbose;
- printf("Verbose mode %s.\n", verbose ? "on" : "off");
+ if (!startup)
+ printf("Verbosity set to level %d (%s).\n", verbose, name);
+ return 0;
}
+
+-static void setverbose(int argc, char *argv[])
++static int setverbose(int argc, char *argv[])
+ {
+ (void)argc;
+- set_verbosity(argv[1], false);
++ return set_verbosity(argv[1], false);
+ }
diff --git a/tftp/tftp.c b/tftp/tftp.c
-index 332d652..0a48459 100644
+index b752787..4968ae3 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
-@@ -48,7 +48,7 @@ static void tpacket(const char *, struct tftphdr *, int);
+@@ -128,7 +128,7 @@ static const struct tftp_xfer_ops client_xfer_ops = {
/*
* Send the requested file.
*/
@@ -529,17 +548,17 @@ index 332d652..0a48459 100644
+int tftp_sendfile(int fd, const char *name, const char *mode,
unsigned int requested_window)
{
- struct tftphdr *dp, *ap;
-@@ -59,7 +59,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- FILE *file = NULL;
- char * volatile packets = NULL;
- int * volatile lengths = NULL;
+ struct tftphdr *ap;
+@@ -140,7 +140,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ struct client_xfer_context context;
+ struct tftp_xfer xfer;
+ struct tftp_xfer_result result;
- int n, size;
+ int n, size, err = 0;
- size_t packetsize;
- volatile int packet_count, final;
- int convert = !strcmp(mode, "netascii");
-@@ -72,8 +72,10 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ bool convert = !strcmp(mode, "netascii");
+ unsigned int window;
+ unsigned int negotiated_block, negotiated_window;
+@@ -151,8 +151,10 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
startclock();
file = fdopen(fd, convert ? "rt" : "rb");
@@ -551,31 +570,31 @@ index 332d652..0a48459 100644
ap = (struct tftphdr *)ackbuf;
tftp_signal(SIGALRM, timer, 0);
-@@ -81,6 +83,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+@@ -160,6 +162,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
sizeof(ackbuf));
if (size < 0) {
fprintf(stderr, "tftp: %s: %s\n", name, strerror(errno));
+ err = EX_OSERR;
- goto abort_packets;
+ goto abort;
}
-@@ -92,6 +95,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+@@ -171,6 +174,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
tpacket("sent", ap, size);
if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
perror("tftp: sendto");
+ err = EX_OSERR;
- goto abort_packets;
+ goto abort;
}
- alarm(rexmtval);
-@@ -100,6 +104,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- alarm(0);
+ r_timeout = timeout;
+@@ -178,6 +182,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ n = client_recv_time(response, sizeof(response), &from, &r_timeout);
if (n < 0) {
perror("tftp: recvfrom");
+ err = EX_OSERR;
- goto abort_packets;
+ goto abort;
}
- sa_set_port(&peeraddr, SOCKPORT(&from));
-@@ -111,12 +116,14 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ if (n < 2)
+@@ -188,12 +193,14 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
ap_block = ntohs(rp->th_block);
if (ap_opcode == ERROR) {
printf("Error code %d: %s\n", ap_block, rp->th_msg);
@@ -590,42 +609,40 @@ index 332d652..0a48459 100644
goto abort;
}
segsize = (int)negotiated_block;
-@@ -143,6 +150,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- size = readit(file, &dp, convert);
- if (size < 0) {
- nak(errno + 100, NULL);
-+ err = EX_OSERR;
- goto abort_packets;
- }
- dp->th_opcode = htons((u_short)DATA);
-@@ -168,6 +176,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- if (sendto(f, dp, lengths[n], 0, &peeraddr.sa,
- SOCKLEN(&peeraddr)) != lengths[n]) {
- perror("tftp: sendto");
-+ err = EX_OSERR;
- goto abort_packets;
- }
- }
-@@ -178,6 +187,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- alarm(0);
- if (n < 0) {
- perror("tftp: recvfrom");
-+ err = EX_OSERR;
- goto abort_packets;
- }
- sa_set_port(&peeraddr, SOCKPORT(&from));
-@@ -189,6 +199,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
- ap_block = ntohs(ap->th_block);
- if (ap_opcode == ERROR) {
- printf("Error code %d: %s\n", ap_block, ap->th_msg);
-+ err = EX_PROTOCOL;
- goto abort_packets;
- }
- expected_ack = ntohs(((struct tftphdr *)(packets +
-@@ -216,12 +227,14 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+@@ -213,6 +220,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ io = tftp_io_reader_start(file, convert, window, window, segsize, false);
+ if (!io) {
+ nak(errno + 100, NULL);
++ err = EX_OSERR;
+ goto abort;
+ }
+
+@@ -234,17 +242,21 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ switch (result.status) {
+ case TFTP_XFER_READ_ERROR:
+ nak(result.error + 100, NULL);
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_SEND_ERROR:
+ errno = result.error;
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_RECV_ERROR:
+ errno = result.error;
+ perror("tftp: recvfrom");
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_PEER_ERROR:
+ printf("Error code %d: %s\n", ntohs(ap->th_code), ap->th_msg);
++ err = EX_PROTOCOL;
+ break;
+ default:
+ break;
+@@ -256,13 +268,15 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
stopclock();
if (amount > 0)
- printstats("Sent", (unsigned long)amount);
+ printstats("Sent", amount);
+
+ return err;
}
@@ -634,19 +651,22 @@ index 332d652..0a48459 100644
* Receive a file.
*/
-void tftp_recvfile(int fd, const char *name, const char *mode,
+- unsigned int requested_window)
+int tftp_recvfile(int fd, const char *name, const char *mode,
- unsigned int requested_window)
++ unsigned int requested_window)
{
- struct tftphdr *ap, *dp;
-@@ -229,6 +242,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- socklen_t fromlen;
- FILE *file = NULL;
- volatile int n, size, packets_in_window = 0, first_data = 0, final;
-+ int err = 0;
- int convert = !strcmp(mode, "netascii");
- volatile unsigned int window;
+ struct tftphdr *ap;
+ union sock_addr from;
+@@ -275,7 +289,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ const struct tftphdr * volatile initial_reply = NULL;
+ volatile int initial_reply_len = 0;
+ volatile int initial_packet_len = -1;
+- int n, size;
++ int n, size, err = 0;
+ bool convert = !strcmp(mode, "netascii");
+ unsigned int window;
unsigned int negotiated_block, negotiated_window;
-@@ -239,14 +253,17 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+@@ -286,14 +300,17 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
startclock();
file = fdopen(fd, convert ? "wt" : "wb");
@@ -655,7 +675,7 @@ index 332d652..0a48459 100644
+ err = EX_OSERR;
goto abort;
+ }
- dp = w_init();
+ initial_packet = xmalloc(TFTP_XFER_MAX_PACKET_SIZE);
ap = (struct tftphdr *)ackbuf;
size = makerequest(RRQ, name, ap, mode, blocksize, requested_window,
sizeof(ackbuf));
@@ -665,83 +685,80 @@ index 332d652..0a48459 100644
goto abort;
}
tftp_signal(SIGALRM, timer, 0);
-@@ -259,6 +276,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+@@ -306,6 +323,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
tpacket("sent", ap, size);
if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
perror("tftp: sendto");
+ err = EX_OSERR;
goto abort;
}
- alarm(rexmtval);
-@@ -277,12 +295,14 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- tpacket("received", dp, n);
+ r_timeout = timeout;
+@@ -314,6 +332,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ &from, &r_timeout);
+ if (n < 0) {
+ perror("tftp: recvfrom");
++ err = EX_OSERR;
+ goto abort;
+ }
+ if (n < 2)
+@@ -324,12 +343,14 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
if (opcode == ERROR) {
- printf("Error code %d: %s\n", ntohs(dp->th_code), dp->th_msg);
+ printf("Error code %d: %s\n",
+ ntohs(initial_packet->th_code), initial_packet->th_msg);
+ err = EX_PROTOCOL;
goto abort;
}
if (requested_options && opcode == OACK) {
- if (!parse_oack(dp, n, blocksize, requested_window,
+ if (!parse_oack(initial_packet, n, blocksize, requested_window,
&negotiated_block, &negotiated_window)) {
nak(EOPTNEG, "Invalid option response");
+ err = EX_PROTOCOL;
goto abort;
}
segsize = (int)negotiated_block;
-@@ -306,6 +326,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- tpacket("sent", ap, size);
- if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
- perror("tftp: sendto");
-+ err = EX_OSERR;
- goto abort;
- }
- write_behind(file, convert);
-@@ -329,6 +350,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- if (sendto(f, ap, 4, 0, &peeraddr.sa,
- SOCKLEN(&peeraddr)) != 4) {
- perror("tftp: sendto");
-+ err = EX_OSERR;
- goto abort;
- }
- write_behind(file, convert);
-@@ -340,6 +362,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- alarm(0);
- if (n < 0) {
- perror("tftp: recvfrom");
-+ err = EX_OSERR;
- goto abort;
- }
- if (trace)
-@@ -352,6 +375,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- packet_block = ntohs(dp->th_block);
- if (opcode == ERROR) {
- printf("Error code %d: %s\n", packet_block, dp->th_msg);
-+ err = EX_PROTOCOL;
- goto abort;
- }
- if (opcode != DATA || n < 4)
-@@ -369,11 +393,13 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- }
- if (n - 4 > segsize) {
- nak(EBADOP, "Data packet too large");
-+ err = EX_PROTOCOL;
- goto abort;
- }
- size = writeit(file, &dp, n - 4, convert);
- if (size < 0) {
- nak(errno + 100, NULL);
-+ err = EX_OSERR;
- goto abort;
- }
- amount += size;
-@@ -390,6 +416,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
- if (sendto(f, ap, 4, 0, &peeraddr.sa,
- SOCKLEN(&peeraddr)) != 4) {
- perror("tftp: sendto");
-+ err = EX_OSERR;
- goto abort;
- }
- write_behind(file, convert);
+@@ -355,6 +376,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ io = tftp_io_writer_start(file, convert, window, segsize, false);
+ if (!io) {
+ nak(errno + 100, NULL);
++ err = EX_OSERR;
+ goto abort;
+ }
+
+@@ -381,21 +403,26 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ switch (result.status) {
+ case TFTP_XFER_BAD_DATA:
+ nak(EBADOP, "Data packet too large");
++ err = EX_PROTOCOL;
+ break;
+ case TFTP_XFER_WRITE_ERROR:
+ nak(result.error + 100, NULL);
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_SEND_ERROR:
+ errno = result.error;
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_RECV_ERROR:
+ errno = result.error;
+ perror("tftp: recvfrom");
++ err = EX_OSERR;
+ break;
+ case TFTP_XFER_PEER_ERROR:
+ printf("Error code %d: %s\n", ntohs(result.packet->th_code),
+ result.packet->th_msg);
++ err = EX_PROTOCOL;
+ break;
+ default:
+ break;
+@@ -412,6 +439,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ stopclock();
+ if (amount > 0)
+ printstats("Received", amount);
++ return err;
+ }
+
+ static int
--
2.55.0
diff --git a/tftp-hpa-6.0-stats.patch b/tftp-hpa-6.0-stats.patch
deleted file mode 100644
index 386a93d..0000000
--- a/tftp-hpa-6.0-stats.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 7b4b6f75214c1c64d86f6c333db5dede33ef5e43 Mon Sep 17 00:00:00 2001
-From: Lukáš Zaoral via Syslinux <syslinux@syslinux.org>
-Date: Wed, 15 Apr 2026 10:15:23 +0200
-Subject: tftp: correctly convert μs to s to fix transfer statistics
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Before this patch, the microseconds difference was computed incorrectly
-leading to wrong transfer statistics. The value should be divided by
-a million and not by 100,000.
-
-$ ./tftp/tftp localhost -v -c get 10MB
-Connected to localhost (::1), port 69
-getting from localhost:10MB to 10MB [netascii]
-Received 10485760 bytes in -7.5 seconds [-11164298 bit/s]
-
-Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
-Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
-Signed-off-by: H. Peter Anvin <hpa@zytor.com>
----
- tftp/tftp.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tftp/tftp.c b/tftp/tftp.c
-index abc25b9..d9c9394 100644
---- a/tftp/tftp.c
-+++ b/tftp/tftp.c
-@@ -638,8 +638,8 @@ static void printstats(const char *direction, unsigned long amount)
- {
- double delta;
-
-- delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) -
-- (tstart.tv_sec + (tstart.tv_usec / 100000.0));
-+ delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) -
-+ (tstart.tv_sec + (tstart.tv_usec / 1000000.0));
- if (verbose) {
- printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
- printf(" [%.0f bit/s]", (amount * 8.) / delta);
---
-cgit 1.3.1-korg
diff --git a/tftp.service b/tftp.service
index c26ad3b..0c88dd9 100644
--- a/tftp.service
+++ b/tftp.service
@@ -4,8 +4,7 @@ Requires=tftp.socket
Documentation=man:in.tftpd
[Service]
-ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot
-StandardInput=socket
+ExecStart=/usr/sbin/in.tftpd --systemd -s /var/lib/tftpboot
[Install]
Also=tftp.socket
diff --git a/tftp.socket b/tftp.socket
index 8764c1d..3bb6622 100644
--- a/tftp.socket
+++ b/tftp.socket
@@ -1,5 +1,6 @@
[Unit]
Description=Tftp Server Activation Socket
+PartOf=tftp.service
[Socket]
ListenDatagram=69
diff --git a/tftp.spec b/tftp.spec
index 61aeb5a..6692742 100644
--- a/tftp.spec
+++ b/tftp.spec
@@ -2,7 +2,7 @@
Summary: The client for the Trivial File Transfer Protocol (TFTP)
Name: tftp
-Version: 6.0
+Version: 6.1
Release: 1%{?dist}
License: BSD-4-Clause-UC
URL: http://www.kernel.org/pub/software/network/tftp/
@@ -15,9 +15,6 @@ Source3: tftp.socket
Source4: tftp.service
Source5: tftp-server-tmpfiles.conf
-# Upstream patches
-Patch: tftp-hpa-6.0-stats.patch
-
# To-be upstreamed patches
Patch: tftp-enhanced-logging.patch
Patch: tftp-hpa-5.2-osh.patch
@@ -96,6 +93,10 @@ install -D -p -m 644 %SOURCE5 %{buildroot}%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/tftp.socket
%changelog
+* Mon Sep 07 2026 Lukáš Zaoral <lzaoral@redhat.com> - 6.1-1
+- rebase to the latest upstream release (rhbz#2529277)
+- use the native support for systemd socket activation in tftpd
+
* Mon Aug 31 2026 Lukáš Zaoral <lzaoral@redhat.com> - 6.0-1
- rebase to the latest upstream release (rhbz#2525859)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [rpms/tftp] rawhide: rebase to the latest upstream release
@ 2026-09-03 9:12
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-09-03 9:12 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/tftp
Branch : rawhide
Commit : b2b5876d55ea3c28d665b9c7d9b0b46f3f536080
Author : Lukáš Zaoral <lzaoral@redhat.com>
Date : 2026-09-01T16:13:48+02:00
Stats : +370/-264 in 10 file(s)
URL : https://src.fedoraproject.org/rpms/tftp/c/b2b5876d55ea3c28d665b9c7d9b0b46f3f536080?branch=rawhide
Log:
rebase to the latest upstream release
Resolves: rhbz#2525859
---
diff --git a/.gitignore b/.gitignore
index cda16ac..20f5e37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@ tftp-hpa-0.49.tar.bz2
/tftp-hpa-5.3.tar.gz
/tftp-hpa-5.4.tar.gz
/tftp-hpa-5.4.tar.sign
+/tftp-hpa-6.0.tar.gz
+/tftp-hpa-6.0.tar.sign
diff --git a/sources b/sources
index a4ae615..38914a2 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (tftp-hpa-5.4.tar.gz) = a7f42f7e128b553da4f5b67cb494cb0f95ec6b05300bd0ed650ccf2ce658cc9fee9b462f0a08d92800275608d830d243e2016d6a50d9ba656beefb9beb892739
-SHA512 (tftp-hpa-5.4.tar.sign) = a8db01ccb5e71b0b4e200112964fede7480134b9412232a1ed58923ed5fcc3758ed80f1496761146f4274b68b46afc3530bbbdc57621fe570ea71a78fb320d17
+SHA512 (tftp-hpa-6.0.tar.gz) = 85620c5ce5b7fdeb074a0093c640ace941954189328c2a42b0339b74007767221567240731a15d529c5308c868f03fe9464f9ce6a666932fb738d3ed153dd66f
+SHA512 (tftp-hpa-6.0.tar.sign) = 697595d1ef3bb114b9acc4a95950e4244fb6375a6b97ba0604946a97cc2e4c72be8c7d68040d9d1424ef0fc53aef1d6ae440e7149deb59ec124ddf1e135b9103
diff --git a/tftp-0.42-tftpboot.patch b/tftp-0.42-tftpboot.patch
index 98b92f9..fbd7218 100644
--- a/tftp-0.42-tftpboot.patch
+++ b/tftp-0.42-tftpboot.patch
@@ -1,11 +1,11 @@
diff --git a/README.security b/README.security
-index 644babb..24f5103 100644
+index 8ff9e85..df2fa38 100644
--- a/README.security
+++ b/README.security
-@@ -13,10 +13,10 @@ probably the following:
+@@ -23,10 +23,10 @@ probably the following:
1. Create a separate "tftpd" user and group only used for tftpd;
- 2. Have all your boot files in a single directory tree (usually called
+ 2. Have all your boot files in a single directory tree (usually called
- /tftpboot).
-3. Specify "-p -u tftpd -s /tftpboot" on the tftpd command line; if
+ /var/lib/tftpboot).
@@ -15,8 +15,8 @@ index 644babb..24f5103 100644
+ "-p -c -U 002 -u tftpd -s /var/lib/tftpboot" (replace 002 with whatever
umask is appropriate for your setup.)
- =======================================
-@@ -36,12 +36,12 @@ directly. Thus, if your /etc/inetd.conf looks like this (all on one
+ When the -s (chroot) option is used, tftpd needs to be started as
+@@ -51,12 +51,12 @@ directly. Thus, if your /etc/inetd.conf looks like this (all on one
line):
tftp dgram udp wait root /usr/sbin/tcpd
diff --git a/tftp-doc.patch b/tftp-doc.patch
deleted file mode 100644
index c3733d9..0000000
--- a/tftp-doc.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/tftp/main.c
-+++ b/tftp/main.c
-@@ -165,9 +165,11 @@ static void usage(int errcode)
- {
- fprintf(stderr,
- #ifdef HAVE_IPV6
-- "Usage: %s [-4][-6][-v][-l][-m mode] [host [port]] [-c command]\n",
-+ "Usage: %s [-4][-6][-v][-V][-l][-m mode] [-R port:port] "
-+ "[host [port]] [-c command]\n",
- #else
-- "Usage: %s [-v][-l][-m mode] [host [port]] [-c command]\n",
-+ "Usage: %s [-v][-V][-l][-m mode] [-R port:port] "
-+ "[host [port]] [-c command]\n",
- #endif
- _progname);
- exit(errcode);
diff --git a/tftp-enhanced-logging.patch b/tftp-enhanced-logging.patch
index cfb345f..f47c406 100644
--- a/tftp-enhanced-logging.patch
+++ b/tftp-enhanced-logging.patch
@@ -1,6 +1,8 @@
+diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
+index 9c1d195..98f7950 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -1089,7 +1089,7 @@ int main(int argc, char **argv)
+@@ -1026,7 +1026,7 @@ int main(int argc, char **argv)
static char *rewrite_access(const struct formats *,
char *, int, int, const char **);
static int validate_access(char *, int, const struct formats *, const char **);
@@ -9,7 +11,7 @@
static void tftp_recvfile(const struct formats *, struct tftphdr *, int);
static const struct formats formats[] = {
-@@ -1180,6 +1180,9 @@ int tftp(struct tftphdr *tp, int size)
+@@ -1119,6 +1119,9 @@ int tftp(struct tftphdr *tp, int size)
if (!file) {
ecode =
(*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
@@ -19,7 +21,7 @@
if (ecode) {
nak(ecode, errmsgptr);
exit(0);
-@@ -1203,12 +1206,12 @@ int tftp(struct tftphdr *tp, int size)
+@@ -1145,12 +1148,12 @@ int tftp(struct tftphdr *tp, int size)
if (tp_opcode == WRQ)
(*pf->f_recv) (pf, (struct tftphdr *)ackbuf, ap - ackbuf);
else
@@ -34,7 +36,7 @@
}
exit(0); /* Request completed */
}
-@@ -1655,7 +1658,7 @@ static int validate_access(char *filename, int mode,
+@@ -1672,7 +1675,7 @@ static int validate_access(char *filename, int mode,
/*
* Send the requested file.
*/
@@ -43,10 +45,24 @@
{
struct tftphdr *dp;
struct tftphdr *ap; /* ack packet */
-@@ -1746,6 +1749,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
- if (!++block)
- block = rollover_val;
- } while (size == segsize);
+@@ -1783,6 +1786,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
+ break;
+ }
+ }
++ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
++ tmpbuf, INET6_ADDRSTRLEN);
++ if (!tmp_p) {
++ tmp_p = tmpbuf;
++ strcpy(tmpbuf, "???");
++ }
++ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
+ abort:
+ tftpio_stop(io);
+ io = NULL;
+@@ -1856,6 +1866,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
+ xfree(packets);
+ xfree(lengths);
+ }
+ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
+ tmpbuf, INET6_ADDRSTRLEN);
+ if (!tmp_p) {
@@ -56,10 +72,12 @@
+ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
abort:
(void)fclose(file);
- }
+ #endif
+diff --git a/tftpd/tftpd.h b/tftpd/tftpd.h
+index b6658d4..a52adc5 100644
--- a/tftpd/tftpd.h
+++ b/tftpd/tftpd.h
-@@ -33,7 +33,7 @@ struct formats {
+@@ -34,7 +34,7 @@ struct formats {
const char *f_mode;
char *(*f_rewrite) (const struct formats *, char *, int, int, const char **);
int (*f_validate) (char *, int, const struct formats *, const char **);
diff --git a/tftp-hpa-5.2-osh.patch b/tftp-hpa-5.2-osh.patch
index 7435a3e..460b5a8 100644
--- a/tftp-hpa-5.2-osh.patch
+++ b/tftp-hpa-5.2-osh.patch
@@ -1,9 +1,9 @@
# Fix leaked_handle: Handle variable "fd" going out of scope leaks the handle.
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 6dcf14f..b267364 100644
+index 98f7950..b3fd06c 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -1616,6 +1623,7 @@ static int validate_access(char *filename, int mode,
+@@ -1636,6 +1636,7 @@ static int validate_access(char *filename, int mode,
if (mode == RRQ) {
if (!unixperms && (stbuf.st_mode & (S_IREAD >> 6)) == 0) {
@@ -11,7 +11,7 @@ index 6dcf14f..b267364 100644
*errmsg = "File must have global read permissions";
return (EACCESS);
}
-@@ -1625,6 +1633,7 @@ static int validate_access(char *filename, int mode,
+@@ -1645,6 +1646,7 @@ static int validate_access(char *filename, int mode,
} else {
if (!unixperms) {
if ((stbuf.st_mode & (S_IWRITE >> 6)) == 0) {
@@ -19,7 +19,7 @@ index 6dcf14f..b267364 100644
*errmsg = "File must have global write permissions";
return (EACCESS);
}
-@@ -1633,6 +1642,7 @@ static int validate_access(char *filename, int mode,
+@@ -1653,6 +1655,7 @@ static int validate_access(char *filename, int mode,
#ifdef HAVE_FTRUNCATE
/* We didn't get to truncate the file at open() time */
if (ftruncate(fd, (off_t) 0)) {
@@ -27,34 +27,3 @@ index 6dcf14f..b267364 100644
*errmsg = "Cannot reset file size";
return (EACCESS);
}
-
-From 5f60355c4bd10b866847a0d58a9582bda7db72aa Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
-Date: Wed, 6 Apr 2022 09:34:46 +0200
-Subject: [PATCH] tftpd: Fix a possible usage of -1 file descriptor in
- standalone mode
-
----
- tftpd/tftpd.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 00fa1cf..afd595d 100644
---- a/tftpd/tftpd.c
-+++ b/tftpd/tftpd.c
-@@ -672,6 +672,13 @@ int main(int argc, char **argv)
- exit(EX_USAGE);
- }
- ai_fam = AF_INET6;
-+
-+ if (fd6 < 0) {
-+ syslog(LOG_ERR,
-+ "IPv6 was disabled but address %s is in address "
-+ "family AF_INET6", address);
-+ exit(EX_USAGE);
-+ }
- }
- break;
- #endif
---
-2.35.1
diff --git a/tftp-hpa-5.3-stats.patch b/tftp-hpa-5.3-stats.patch
deleted file mode 100644
index 571ab30..0000000
--- a/tftp-hpa-5.3-stats.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 7b1051cafcfb4fd61c840e489cecea8380177aa4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
-Date: Tue, 14 Apr 2026 17:58:41 +0200
-Subject: [PATCH] =?UTF-8?q?tftp:=20correctly=20convert=20=CE=BCs=20to=20s?=
- =?UTF-8?q?=20to=20fix=20transfer=20statistics?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Before this patch, the microseconds difference was computed incorrectly
-leading to wrong transfer statistics. The value should be divided by
-a million and not by ten thousand.
-
-$ ./tftp/tftp localhost -v -c get 10MB
-Connected to localhost (::1), port 69
-getting from localhost:10MB to 10MB [netascii]
-Received 10485760 bytes in -7.5 seconds [-11164298 bit/s]
-
-Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
-Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
----
- tftp/tftp.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tftp/tftp.c b/tftp/tftp.c
-index 14c3a75..e161527 100644
---- a/tftp/tftp.c
-+++ b/tftp/tftp.c
-@@ -406,8 +406,8 @@ static void printstats(const char *direction, unsigned long amount)
- {
- double delta;
-
-- delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) -
-- (tstart.tv_sec + (tstart.tv_usec / 100000.0));
-+ delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) -
-+ (tstart.tv_sec + (tstart.tv_usec / 1000000.0));
- if (verbose) {
- printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
- printf(" [%.0f bit/s]", (amount * 8.) / delta);
---
-2.55.0
-
diff --git a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
index 47c8351..8ab101b 100644
--- a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
+++ b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
@@ -5,32 +5,32 @@ Subject: [PATCH] tftp: propagate errors to exit code in single command mode
---
tftp/extern.h | 4 +-
- tftp/main.c | 132 ++++++++++++++++++++++++++++----------------------
- tftp/tftp.c | 22 +++++++--
- 3 files changed, 94 insertions(+), 64 deletions(-)
+ tftp/main.c | 144 ++++++++++++++++++++++++++++----------------------
+ tftp/tftp.c | 37 +++++++++++--
+ 3 files changed, 115 insertions(+), 70 deletions(-)
diff --git a/tftp/extern.h b/tftp/extern.h
-index 9fd424b..c1e1980 100644
+index 7740cb7..295b8e9 100644
--- a/tftp/extern.h
+++ b/tftp/extern.h
@@ -10,8 +10,8 @@
#include "config.h"
--void tftp_recvfile(int, const char *, const char *);
--void tftp_sendfile(int, const char *, const char *);
-+int tftp_recvfile(int, const char *, const char *);
-+int tftp_sendfile(int, const char *, const char *);
+-void tftp_recvfile(int, const char *, const char *, unsigned int);
+-void tftp_sendfile(int, const char *, const char *, unsigned int);
++int tftp_recvfile(int, const char *, const char *, unsigned int);
++int tftp_sendfile(int, const char *, const char *, unsigned int);
extern sigjmp_buf toplevel;
#endif
diff --git a/tftp/main.c b/tftp/main.c
-index eed02bf..e7b338c 100644
+index d895a30..e8900ef 100644
--- a/tftp/main.c
+++ b/tftp/main.c
-@@ -77,20 +77,20 @@ int portrange = 0;
- unsigned int portrange_from = 0;
- unsigned int portrange_to = 0;
+@@ -82,22 +82,22 @@ unsigned int portrange_to = 0;
+ unsigned int blocksize = SEGSIZE;
+ unsigned int windowsize;
-void get(int, char **);
-void help(int, char **);
@@ -39,6 +39,7 @@ index eed02bf..e7b338c 100644
-void quit(int, char **);
-void setascii(int, char **);
-void setbinary(int, char **);
+-void setblocksize(int, char **);
-void setpeer(int, char **);
-void setrexmt(int, char **);
-void settimeout(int, char **);
@@ -46,6 +47,7 @@ index eed02bf..e7b338c 100644
-void setverbose(int, char **);
-void status(int, char **);
-void setliteral(int, char **);
+-void setwindowsize(int, char **);
+int get(int, char **);
+int help(int, char **);
+int modecmd(int, char **);
@@ -53,6 +55,7 @@ index eed02bf..e7b338c 100644
+int quit(int, char **);
+int setascii(int, char **);
+int setbinary(int, char **);
++int setblocksize(int, char **);
+int setpeer(int, char **);
+int setrexmt(int, char **);
+int settimeout(int, char **);
@@ -60,10 +63,11 @@ index eed02bf..e7b338c 100644
+int setverbose(int, char **);
+int status(int, char **);
+int setliteral(int, char **);
++int setwindowsize(int, char **);
static void command(void);
-@@ -104,7 +104,7 @@ static void settftpmode(const struct modes *);
+@@ -113,7 +113,7 @@ static void settftpmode(const struct modes *);
struct cmd {
const char *name;
const char *help;
@@ -71,37 +75,29 @@ index eed02bf..e7b338c 100644
+ int (*handler) (int, char **);
};
- struct cmd cmdtab[] = {
-@@ -161,7 +161,7 @@ char *tail(char *);
-
- char *xstrdup(const char *);
-
--static void usage(int errcode)
-+static int usage(int errcode)
- {
- fprintf(stderr,
- #ifdef HAVE_IPV6
-@@ -176,7 +176,7 @@ static void usage(int errcode)
+ static const struct cmd cmdtab[] = {
+@@ -243,7 +243,7 @@ static const char short_options[] = "+46vVlm:cR:B:W:w:h";
int main(int argc, char *argv[])
{
union sock_addr sa;
-- int arg;
-+ int arg, ret;
+- int optc;
++ int optc, ret;
static int pargc, peerargc;
static int iscmd = 0;
- char **pargv;
-@@ -315,8 +315,8 @@ int main(int argc, char *argv[])
- pargv[1]);
- exit(EX_USAGE);
- }
+ static char **pargv;
+@@ -418,9 +418,9 @@ int main(int argc, char *argv[])
+ if (sigsetjmp(toplevel, 1) != 0)
+ exit(EX_UNAVAILABLE);
+
- (*c->handler) (pargc, pargv);
-- exit(0);
+ ret = (*c->handler) (pargc, pargv);
+ xfree(splitbuf);
+- exit(0);
+ exit(ret);
}
#ifdef WITH_READLINE
#ifdef HAVE_READLINE_HISTORY_H
-@@ -371,7 +371,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
+@@ -475,7 +475,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
#endif
}
@@ -110,7 +106,7 @@ index eed02bf..e7b338c 100644
{
int err;
-@@ -383,7 +383,7 @@ void setpeer(int argc, char *argv[])
+@@ -487,7 +487,7 @@ void setpeer(int argc, char *argv[])
}
if ((argc < 2) || (argc > 3)) {
printf("usage: %s host-name [port]\n", argv[0]);
@@ -119,7 +115,7 @@ index eed02bf..e7b338c 100644
}
peeraddr.sa.sa_family = ai_fam;
-@@ -392,7 +392,7 @@ void setpeer(int argc, char *argv[])
+@@ -496,7 +496,7 @@ void setpeer(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
connected = 0;
@@ -128,7 +124,7 @@ index eed02bf..e7b338c 100644
}
ai_fam = peeraddr.sa.sa_family;
if (f == -1) { /* socket not open */
-@@ -429,7 +429,7 @@ void setpeer(int argc, char *argv[])
+@@ -533,7 +533,7 @@ void setpeer(int argc, char *argv[])
if (*ep || myport > 65535UL) {
printf("%s: bad port number\n", argv[2]);
connected = 0;
@@ -137,7 +133,7 @@ index eed02bf..e7b338c 100644
}
port = htons((u_short) myport);
}
-@@ -445,16 +445,17 @@ void setpeer(int argc, char *argv[])
+@@ -549,16 +549,17 @@ void setpeer(int argc, char *argv[])
hostname, tp, (unsigned int)ntohs(port));
}
connected = 1;
@@ -157,7 +153,7 @@ index eed02bf..e7b338c 100644
}
if (argc == 2) {
for (p = modes; p->m_name; p++)
-@@ -462,7 +463,7 @@ void modecmd(int argc, char *argv[])
+@@ -566,7 +567,7 @@ void modecmd(int argc, char *argv[])
break;
if (p->m_name) {
settftpmode(p);
@@ -166,7 +162,7 @@ index eed02bf..e7b338c 100644
}
printf("%s: unknown mode\n", argv[1]);
/* drop through and print usage message */
-@@ -476,21 +477,23 @@ void modecmd(int argc, char *argv[])
+@@ -580,21 +581,23 @@ void modecmd(int argc, char *argv[])
sep = " | ";
}
printf(" ]\n");
@@ -193,7 +189,7 @@ index eed02bf..e7b338c 100644
}
static void settftpmode(const struct modes *newmode)
-@@ -503,7 +506,7 @@ static void settftpmode(const struct modes *newmode)
+@@ -607,7 +610,7 @@ static void settftpmode(const struct modes *newmode)
/*
* Send file(s).
*/
@@ -202,7 +198,7 @@ index eed02bf..e7b338c 100644
{
int fd;
int n, err;
-@@ -517,14 +520,14 @@ void put(int argc, char *argv[])
+@@ -621,14 +624,14 @@ void put(int argc, char *argv[])
}
if (argc < 2) {
putusage(argv[0]);
@@ -219,7 +215,7 @@ index eed02bf..e7b338c 100644
}
cp = argv[argc - 1];
targ = strchr(cp, ':');
-@@ -535,14 +538,14 @@ void put(int argc, char *argv[])
+@@ -639,14 +642,14 @@ void put(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
connected = 0;
@@ -236,7 +232,7 @@ index eed02bf..e7b338c 100644
}
if (argc < 4) {
cp = argc == 2 ? tail(targ) : argv[1];
-@@ -550,17 +553,18 @@ void put(int argc, char *argv[])
+@@ -654,17 +657,18 @@ void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -247,9 +243,9 @@ index eed02bf..e7b338c 100644
printf("putting %s to %s:%s [%s]\n",
cp, hostname, targ, mode->m_mode);
sa_set_port(&peeraddr, port);
-- tftp_sendfile(fd, targ, mode->m_mode);
+- tftp_sendfile(fd, targ, mode->m_mode, windowsize);
- return;
-+ err = tftp_sendfile(fd, targ, mode->m_mode);
++ err = tftp_sendfile(fd, targ, mode->m_mode, windowsize);
+ return err;
}
/* this assumes the target is a directory */
@@ -258,7 +254,7 @@ index eed02bf..e7b338c 100644
for (n = 1; n < argc - 1; n++) {
const char *base = tail(argv[n]);
char *remotepath = xmalloc(strlen(targ) + 1 + strlen(base) + 1);
-@@ -570,6 +574,7 @@ void put(int argc, char *argv[])
+@@ -674,6 +678,7 @@ void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(argv[n]);
@@ -266,12 +262,12 @@ index eed02bf..e7b338c 100644
free(remotepath);
continue;
}
-@@ -577,9 +582,11 @@ void put(int argc, char *argv[])
+@@ -681,9 +686,11 @@ void put(int argc, char *argv[])
printf("putting %s to %s:%s [%s]\n",
argv[n], hostname, remotepath, mode->m_mode);
sa_set_port(&peeraddr, port);
-- tftp_sendfile(fd, remotepath, mode->m_mode);
-+ err |= tftp_sendfile(fd, remotepath, mode->m_mode);
+- tftp_sendfile(fd, remotepath, mode->m_mode, windowsize);
++ err |= tftp_sendfile(fd, remotepath, mode->m_mode, windowsize);
free(remotepath);
}
+
@@ -279,7 +275,7 @@ index eed02bf..e7b338c 100644
}
static void putusage(char *s)
-@@ -591,10 +598,10 @@ static void putusage(char *s)
+@@ -695,10 +702,10 @@ static void putusage(char *s)
/*
* Receive file(s).
*/
@@ -292,7 +288,7 @@ index eed02bf..e7b338c 100644
char *cp;
char *src;
-@@ -606,28 +613,28 @@ void get(int argc, char *argv[])
+@@ -710,28 +717,28 @@ void get(int argc, char *argv[])
}
if (argc < 2) {
getusage(argv[0]);
@@ -317,7 +313,7 @@ index eed02bf..e7b338c 100644
-
*src++ = 0;
peeraddr.sa.sa_family = ai_fam;
- err = set_sock_addr(argv[n], &peeraddr, &hostname);
+ err = set_sock_addr(argv[n], &peeraddr, &hostname, false);
if (err) {
printf("Warning: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
@@ -325,7 +321,7 @@ index eed02bf..e7b338c 100644
continue;
}
ai_fam = peeraddr.sa.sa_family;
-@@ -640,13 +647,13 @@ void get(int argc, char *argv[])
+@@ -744,13 +751,13 @@ void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -336,12 +332,12 @@ index eed02bf..e7b338c 100644
printf("getting from %s:%s to %s [%s]\n",
hostname, src, cp, mode->m_mode);
sa_set_port(&peeraddr, port);
-- tftp_recvfile(fd, src, mode->m_mode);
-+ err = tftp_recvfile(fd, src, mode->m_mode);
+- tftp_recvfile(fd, src, mode->m_mode, windowsize);
++ err = tftp_recvfile(fd, src, mode->m_mode, windowsize);
break;
}
cp = tail(src); /* new .. jdg */
-@@ -655,14 +662,16 @@ void get(int argc, char *argv[])
+@@ -759,14 +766,16 @@ void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -352,14 +348,14 @@ index eed02bf..e7b338c 100644
printf("getting from %s:%s to %s [%s]\n",
hostname, src, cp, mode->m_mode);
sa_set_port(&peeraddr, port);
-- tftp_recvfile(fd, src, mode->m_mode);
-+ err |= tftp_recvfile(fd, src, mode->m_mode);
+- tftp_recvfile(fd, src, mode->m_mode, windowsize);
++ err |= tftp_recvfile(fd, src, mode->m_mode, windowsize);
}
+ return err;
}
static void getusage(char *s)
-@@ -673,7 +682,7 @@ static void getusage(char *s)
+@@ -777,7 +786,7 @@ static void getusage(char *s)
int rexmtval = TIMEOUT;
@@ -368,7 +364,7 @@ index eed02bf..e7b338c 100644
{
int t;
-@@ -685,18 +694,19 @@ void setrexmt(int argc, char *argv[])
+@@ -788,18 +797,19 @@ void setrexmt(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -390,7 +386,7 @@ index eed02bf..e7b338c 100644
{
int t;
-@@ -708,24 +718,26 @@ void settimeout(int argc, char *argv[])
+@@ -810,16 +820,17 @@ void settimeout(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -405,6 +401,44 @@ index eed02bf..e7b338c 100644
+ return 0;
}
+-void setblocksize(int argc, char *argv[])
++int setblocksize(int argc, char *argv[])
+ {
+ if (argc < 2) {
+ getmoreargs("blocksize ", "(size) ");
+@@ -828,15 +839,16 @@ void setblocksize(int argc, char *argv[])
+ }
+ if (argc != 2) {
+ printf("usage: %s size\n", argv[0]);
+- return;
++ return EX_USAGE;
+ }
+ if (!parse_uint_range(argv[1], 8, MAX_SEGSIZE, &blocksize)) {
+ printf("%s: bad block size (valid range is 8-%d)\n",
+ argv[1], MAX_SEGSIZE);
+ }
++ return 0;
+ }
+
+-void setwindowsize(int argc, char *argv[])
++int setwindowsize(int argc, char *argv[])
+ {
+ if (argc < 2) {
+ getmoreargs("windowsize ", "(size) ");
+@@ -845,23 +857,25 @@ void setwindowsize(int argc, char *argv[])
+ }
+ if (argc != 2) {
+ printf("usage: %s size\n", argv[0]);
+- return;
++ return EX_USAGE;
+ }
+ if (!parse_uint_range(argv[1], 1, TFTP_MAX_WINDOWSIZE, &windowsize)) {
+ printf("%s: bad window size (valid range is 1-%u)\n",
+ argv[1], TFTP_MAX_WINDOWSIZE);
+ }
++ return 0;
+ }
+
-void setliteral(int argc, char *argv[])
+int setliteral(int argc, char *argv[])
{
@@ -420,16 +454,16 @@ index eed02bf..e7b338c 100644
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -738,6 +750,7 @@ void status(int argc, char *argv[])
- literal ? "on" : "off");
- printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n",
+@@ -876,6 +890,7 @@ void status(int argc, char *argv[])
rexmtval, maxtimeout);
+ printf("Blocksize: %u, windowsize: %u\n", blocksize,
+ windowsize ? windowsize : 1);
+ return 0;
}
void intr(int sig)
-@@ -872,7 +885,7 @@ static void makeargv(void)
- *argp++ = 0;
+@@ -1018,7 +1033,7 @@ static int makeargv(char *str, char **argp)
+ return argc;
}
-void quit(int argc, char *argv[])
@@ -437,16 +471,16 @@ index eed02bf..e7b338c 100644
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -882,7 +895,7 @@ void quit(int argc, char *argv[])
+@@ -1028,7 +1043,7 @@ void quit(int argc, char *argv[])
/*
* Help command.
*/
-void help(int argc, char *argv[])
+int help(int argc, char *argv[])
{
- struct cmd *c;
+ const struct cmd *c;
-@@ -892,7 +905,7 @@ void help(int argc, char *argv[])
+@@ -1038,7 +1053,7 @@ void help(int argc, char *argv[])
printf("Commands may be abbreviated. Commands are:\n\n");
for (c = cmdtab; c->name; c++)
printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help);
@@ -454,8 +488,8 @@ index eed02bf..e7b338c 100644
+ return 0;
}
while (--argc > 0) {
- char *arg;
-@@ -905,22 +918,25 @@ void help(int argc, char *argv[])
+ const char *errtype;
+@@ -1050,22 +1065,25 @@ void help(int argc, char *argv[])
else
printf("%s\n", c->help);
}
@@ -484,67 +518,114 @@ index eed02bf..e7b338c 100644
+ return 0;
}
diff --git a/tftp/tftp.c b/tftp/tftp.c
-index e161527..8e5bb65 100644
+index 332d652..0a48459 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
-@@ -45,11 +45,11 @@ static void tpacket(const char *, struct tftphdr *, int);
+@@ -48,7 +48,7 @@ static void tpacket(const char *, struct tftphdr *, int);
/*
* Send the requested file.
*/
--void tftp_sendfile(int fd, const char *name, const char *mode)
-+int tftp_sendfile(int fd, const char *name, const char *mode)
+-void tftp_sendfile(int fd, const char *name, const char *mode,
++int tftp_sendfile(int fd, const char *name, const char *mode,
+ unsigned int requested_window)
{
- struct tftphdr *ap; /* data and ack packets */
- struct tftphdr *dp;
-- int n;
-+ int n, err;
- volatile int is_request;
- volatile u_short block;
- volatile int size, convert;
-@@ -67,6 +67,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
- block = 0;
- is_request = 1; /* First packet is the actual WRQ */
- amount = 0;
-+ err = 0;
+ struct tftphdr *dp, *ap;
+@@ -59,7 +59,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ FILE *file = NULL;
+ char * volatile packets = NULL;
+ int * volatile lengths = NULL;
+- int n, size;
++ int n, size, err = 0;
+ size_t packetsize;
+ volatile int packet_count, final;
+ int convert = !strcmp(mode, "netascii");
+@@ -72,8 +72,10 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+
+ startclock();
+ file = fdopen(fd, convert ? "rt" : "rb");
+- if (!file)
++ if (!file) {
++ err = EX_OSERR;
+ goto abort;
++ }
+ ap = (struct tftphdr *)ackbuf;
tftp_signal(SIGALRM, timer, 0);
- do {
-@@ -81,6 +82,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -81,6 +83,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ sizeof(ackbuf));
+ if (size < 0) {
+ fprintf(stderr, "tftp: %s: %s\n", name, strerror(errno));
++ err = EX_OSERR;
+ goto abort_packets;
+ }
+
+@@ -92,6 +95,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ tpacket("sent", ap, size);
+ if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ goto abort_packets;
+ }
+ alarm(rexmtval);
+@@ -100,6 +104,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ alarm(0);
+ if (n < 0) {
+ perror("tftp: recvfrom");
++ err = EX_OSERR;
+ goto abort_packets;
+ }
+ sa_set_port(&peeraddr, SOCKPORT(&from));
+@@ -111,12 +116,14 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ ap_block = ntohs(rp->th_block);
+ if (ap_opcode == ERROR) {
+ printf("Error code %d: %s\n", ap_block, rp->th_msg);
++ err = EX_PROTOCOL;
+ goto abort;
+ }
+ if (requested_options && ap_opcode == OACK) {
+ if (!parse_oack(rp, n, blocksize, requested_window,
+ &negotiated_block, &negotiated_window)) {
+ nak(EOPTNEG, "Invalid option response");
++ err = EX_PROTOCOL;
+ goto abort;
+ }
+ segsize = (int)negotiated_block;
+@@ -143,6 +150,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
size = readit(file, &dp, convert);
if (size < 0) {
nak(errno + 100, NULL);
+ err = EX_OSERR;
- break;
+ goto abort_packets;
+ }
+ dp->th_opcode = htons((u_short)DATA);
+@@ -168,6 +176,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ if (sendto(f, dp, lengths[n], 0, &peeraddr.sa,
+ SOCKLEN(&peeraddr)) != lengths[n]) {
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ goto abort_packets;
}
- dp->th_opcode = htons((u_short) DATA);
-@@ -95,6 +97,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
- &peeraddr.sa, SOCKLEN(&peeraddr));
- if (n != size + 4) {
- perror("tftp: sendto");
-+ err = EX_OSERR;
- goto abort;
}
- read_ahead(file, convert);
-@@ -108,6 +111,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -178,6 +187,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
alarm(0);
if (n < 0) {
perror("tftp: recvfrom");
+ err = EX_OSERR;
- goto abort;
+ goto abort_packets;
}
- sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */
-@@ -118,6 +122,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
- ap_block = ntohs((u_short) ap->th_block);
+ sa_set_port(&peeraddr, SOCKPORT(&from));
+@@ -189,6 +199,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
+ ap_block = ntohs(ap->th_block);
if (ap_opcode == ERROR) {
printf("Error code %d: %s\n", ap_block, ap->th_msg);
+ err = EX_PROTOCOL;
- goto abort;
+ goto abort_packets;
}
- if (ap_opcode == ACK) {
-@@ -150,16 +155,18 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+ expected_ack = ntohs(((struct tftphdr *)(packets +
+@@ -216,12 +227,14 @@ void tftp_sendfile(int fd, const char *name, const char *mode,
stopclock();
if (amount > 0)
- printstats("Sent", amount);
+ printstats("Sent", (unsigned long)amount);
+
+ return err;
}
@@ -552,65 +633,115 @@ index e161527..8e5bb65 100644
/*
* Receive a file.
*/
--void tftp_recvfile(int fd, const char *name, const char *mode)
-+int tftp_recvfile(int fd, const char *name, const char *mode)
+-void tftp_recvfile(int fd, const char *name, const char *mode,
++int tftp_recvfile(int fd, const char *name, const char *mode,
+ unsigned int requested_window)
{
- struct tftphdr *ap;
- struct tftphdr *dp;
-- int n;
-+ int n, err;
- volatile u_short block;
- volatile int size, firsttrip;
- volatile unsigned long amount;
-@@ -177,6 +184,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
- block = 1;
- firsttrip = 1;
- amount = 0;
-+ err = 0;
-
+ struct tftphdr *ap, *dp;
+@@ -229,6 +242,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ socklen_t fromlen;
+ FILE *file = NULL;
+ volatile int n, size, packets_in_window = 0, first_data = 0, final;
++ int err = 0;
+ int convert = !strcmp(mode, "netascii");
+ volatile unsigned int window;
+ unsigned int negotiated_block, negotiated_window;
+@@ -239,14 +253,17 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+
+ startclock();
+ file = fdopen(fd, convert ? "wt" : "wb");
+- if (!file)
++ if (!file) {
++ err = EX_OSERR;
+ goto abort;
++ }
+ dp = w_init();
+ ap = (struct tftphdr *)ackbuf;
+ size = makerequest(RRQ, name, ap, mode, blocksize, requested_window,
+ sizeof(ackbuf));
+ if (size < 0) {
+ fprintf(stderr, "tftp: %s: %s\n", name, strerror(errno));
++ err = EX_OSERR;
+ goto abort;
+ }
tftp_signal(SIGALRM, timer, 0);
- do {
-@@ -202,6 +210,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
- SOCKLEN(&peeraddr)) != size) {
- alarm(0);
+@@ -259,6 +276,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ tpacket("sent", ap, size);
+ if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ goto abort;
+ }
+ alarm(rexmtval);
+@@ -277,12 +295,14 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ tpacket("received", dp, n);
+ if (opcode == ERROR) {
+ printf("Error code %d: %s\n", ntohs(dp->th_code), dp->th_msg);
++ err = EX_PROTOCOL;
+ goto abort;
+ }
+ if (requested_options && opcode == OACK) {
+ if (!parse_oack(dp, n, blocksize, requested_window,
+ &negotiated_block, &negotiated_window)) {
+ nak(EOPTNEG, "Invalid option response");
++ err = EX_PROTOCOL;
+ goto abort;
+ }
+ segsize = (int)negotiated_block;
+@@ -306,6 +326,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ tpacket("sent", ap, size);
+ if (sendto(f, ap, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) {
perror("tftp: sendto");
+ err = EX_OSERR;
goto abort;
}
write_behind(file, convert);
-@@ -215,6 +224,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -329,6 +350,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ if (sendto(f, ap, 4, 0, &peeraddr.sa,
+ SOCKLEN(&peeraddr)) != 4) {
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ goto abort;
+ }
+ write_behind(file, convert);
+@@ -340,6 +362,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
alarm(0);
if (n < 0) {
perror("tftp: recvfrom");
+ err = EX_OSERR;
goto abort;
}
- sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */
-@@ -225,6 +235,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
- dp_block = ntohs((u_short) dp->th_block);
- if (dp_opcode == ERROR) {
- printf("Error code %d: %s\n", dp_block, dp->th_msg);
-+ err = EX_PROTOCOL;
- goto abort;
- }
- if (dp_opcode == DATA) {
-@@ -249,6 +260,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+ if (trace)
+@@ -352,6 +375,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ packet_block = ntohs(dp->th_block);
+ if (opcode == ERROR) {
+ printf("Error code %d: %s\n", packet_block, dp->th_msg);
++ err = EX_PROTOCOL;
+ goto abort;
+ }
+ if (opcode != DATA || n < 4)
+@@ -369,11 +393,13 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ }
+ if (n - 4 > segsize) {
+ nak(EBADOP, "Data packet too large");
++ err = EX_PROTOCOL;
+ goto abort;
+ }
size = writeit(file, &dp, n - 4, convert);
if (size < 0) {
nak(errno + 100, NULL);
+ err = EX_OSERR;
- break;
+ goto abort;
}
amount += size;
-@@ -263,6 +275,8 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
- stopclock();
- if (amount > 0)
- printstats("Received", amount);
-+
-+ return err;
- }
-
- static int
+@@ -390,6 +416,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode,
+ if (sendto(f, ap, 4, 0, &peeraddr.sa,
+ SOCKLEN(&peeraddr)) != 4) {
+ perror("tftp: sendto");
++ err = EX_OSERR;
+ goto abort;
+ }
+ write_behind(file, convert);
--
2.55.0
diff --git a/tftp-hpa-6.0-stats.patch b/tftp-hpa-6.0-stats.patch
new file mode 100644
index 0000000..386a93d
--- /dev/null
+++ b/tftp-hpa-6.0-stats.patch
@@ -0,0 +1,41 @@
+From 7b4b6f75214c1c64d86f6c333db5dede33ef5e43 Mon Sep 17 00:00:00 2001
+From: Lukáš Zaoral via Syslinux <syslinux@syslinux.org>
+Date: Wed, 15 Apr 2026 10:15:23 +0200
+Subject: tftp: correctly convert μs to s to fix transfer statistics
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Before this patch, the microseconds difference was computed incorrectly
+leading to wrong transfer statistics. The value should be divided by
+a million and not by 100,000.
+
+$ ./tftp/tftp localhost -v -c get 10MB
+Connected to localhost (::1), port 69
+getting from localhost:10MB to 10MB [netascii]
+Received 10485760 bytes in -7.5 seconds [-11164298 bit/s]
+
+Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+---
+ tftp/tftp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tftp/tftp.c b/tftp/tftp.c
+index abc25b9..d9c9394 100644
+--- a/tftp/tftp.c
++++ b/tftp/tftp.c
+@@ -638,8 +638,8 @@ static void printstats(const char *direction, unsigned long amount)
+ {
+ double delta;
+
+- delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) -
+- (tstart.tv_sec + (tstart.tv_usec / 100000.0));
++ delta = (tstop.tv_sec + (tstop.tv_usec / 1000000.0)) -
++ (tstart.tv_sec + (tstart.tv_usec / 1000000.0));
+ if (verbose) {
+ printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
+ printf(" [%.0f bit/s]", (amount * 8.) / delta);
+--
+cgit 1.3.1-korg
diff --git a/tftp.spec b/tftp.spec
index 0a6ffdf..61aeb5a 100644
--- a/tftp.spec
+++ b/tftp.spec
@@ -2,12 +2,12 @@
Summary: The client for the Trivial File Transfer Protocol (TFTP)
Name: tftp
-Version: 5.4
-Release: 2%{?dist}
+Version: 6.0
+Release: 1%{?dist}
License: BSD-4-Clause-UC
URL: http://www.kernel.org/pub/software/network/tftp/
-Source0: https://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-5.4.tar.gz
-Source1: https://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-5.4.tar.sign
+Source0: https://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.gz
+Source1: https://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.sign
# gpg --keyserver pgp.mit.edu --recv-key 6D0107BC69EE5A274FD9B60C2DB3C3321B6DDF86
# gpg --output hpa.gpg --armor --export hpa@zytor.com
Source2: hpa.gpg
@@ -15,10 +15,10 @@ Source3: tftp.socket
Source4: tftp.service
Source5: tftp-server-tmpfiles.conf
+# Upstream patches
+Patch: tftp-hpa-6.0-stats.patch
+
# To-be upstreamed patches
-# https://www.syslinux.org/archives/2026-April/026959.html
-Patch: tftp-hpa-5.3-stats.patch
-Patch: tftp-doc.patch
Patch: tftp-enhanced-logging.patch
Patch: tftp-hpa-5.2-osh.patch
Patch: tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
@@ -96,6 +96,9 @@ install -D -p -m 644 %SOURCE5 %{buildroot}%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/tftp.socket
%changelog
+* Mon Aug 31 2026 Lukáš Zaoral <lzaoral@redhat.com> - 6.0-1
+- rebase to the latest upstream release (rhbz#2525859)
+
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 5.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [rpms/tftp] rawhide: rebase to the latest upstream release
@ 2026-07-09 20:16
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-07-09 20:16 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/tftp
Branch : rawhide
Commit : bd72f25d76768aac22f03954243463b291287b42
Author : Lukáš Zaoral <lzaoral@redhat.com>
Date : 2026-07-09T17:07:51+02:00
Stats : +232/-460 in 14 file(s)
URL : https://src.fedoraproject.org/rpms/tftp/c/bd72f25d76768aac22f03954243463b291287b42?branch=rawhide
Log:
rebase to the latest upstream release
- add gpg verification
Resolves: rhbz#2497090
---
diff --git a/.gitignore b/.gitignore
index 3b0dd17..cda16ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ tftp-hpa-0.49.tar.bz2
/tftp-hpa-5.1.tar.bz2
/tftp-hpa-5.2.tar.bz2
/tftp-hpa-5.3.tar.gz
+/tftp-hpa-5.4.tar.gz
+/tftp-hpa-5.4.tar.sign
diff --git a/hpa.gpg b/hpa.gpg
new file mode 100644
index 0000000..af92d9b
--- /dev/null
+++ b/hpa.gpg
@@ -0,0 +1,78 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+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
+y99GG4IENy/i
+=vWRx
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/sources b/sources
index 566ed25..a4ae615 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
-SHA512 (tftp-hpa-5.3.tar.gz) = 919eefca1b702b72824957b77cc89547cd9ed67a44761cf7ed010baeab4b972bb6befa1002fd09943af628c2a5b1c181339396b6aa9d2766d9b10b97623068a3
+SHA512 (tftp-hpa-5.4.tar.gz) = a7f42f7e128b553da4f5b67cb494cb0f95ec6b05300bd0ed650ccf2ce658cc9fee9b462f0a08d92800275608d830d243e2016d6a50d9ba656beefb9beb892739
+SHA512 (tftp-hpa-5.4.tar.sign) = a8db01ccb5e71b0b4e200112964fede7480134b9412232a1ed58923ed5fcc3758ed80f1496761146f4274b68b46afc3530bbbdc57621fe570ea71a78fb320d17
diff --git a/tftp-0.42-tftpboot.patch b/tftp-0.42-tftpboot.patch
index a0de58d..98b92f9 100644
--- a/tftp-0.42-tftpboot.patch
+++ b/tftp-0.42-tftpboot.patch
@@ -1,19 +1,8 @@
-diff -up tftp-hpa-0.48/tftp-xinetd.tftpboot tftp-hpa-0.48/tftp-xinetd
---- tftp-hpa-0.48/tftp-xinetd.tftpboot 2007-01-31 00:51:05.000000000 +0100
-+++ tftp-hpa-0.48/tftp-xinetd 2008-05-20 12:05:53.000000000 +0200
-@@ -10,7 +10,7 @@ service tftp
- wait = yes
- user = root
- server = /usr/sbin/in.tftpd
-- server_args = -s /tftpboot
-+ server_args = -s /var/lib/tftpboot
- disable = yes
- per_source = 11
- cps = 100 2
-diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security
---- tftp-hpa-0.48/README.security.tftpboot 2008-05-29 17:36:32.000000000 +0200
-+++ tftp-hpa-0.48/README.security 2008-05-29 17:37:21.000000000 +0200
-@@ -17,10 +17,10 @@ probably the following:
+diff --git a/README.security b/README.security
+index 644babb..24f5103 100644
+--- a/README.security
++++ b/README.security
+@@ -13,10 +13,10 @@ probably the following:
1. Create a separate "tftpd" user and group only used for tftpd;
2. Have all your boot files in a single directory tree (usually called
@@ -27,7 +16,7 @@ diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security
umask is appropriate for your setup.)
=======================================
-@@ -40,12 +40,12 @@ directly. Thus, if your /etc/inetd.conf
+@@ -36,12 +36,12 @@ directly. Thus, if your /etc/inetd.conf looks like this (all on one
line):
tftp dgram udp wait root /usr/sbin/tcpd
@@ -42,10 +31,24 @@ diff -up tftp-hpa-0.48/README.security.tftpboot tftp-hpa-0.48/README.security
You should make sure that you are using "wait" option in tftpd; you
also need to have tftpd spawned as root in order for chroot (-s) to
-diff -up tftp-hpa-0.48/tftpd/sample.rules.tftpboot tftp-hpa-0.48/tftpd/sample.rules
---- tftp-hpa-0.48/tftpd/sample.rules.tftpboot 2008-05-29 17:38:46.000000000 +0200
-+++ tftp-hpa-0.48/tftpd/sample.rules 2008-05-29 17:38:05.000000000 +0200
-@@ -30,5 +30,5 @@ rg \\ / # Convert backslashes to slash
+diff --git a/tftp-xinetd b/tftp-xinetd
+index 982fe09..d04b48a 100644
+--- a/tftp-xinetd
++++ b/tftp-xinetd
+@@ -10,7 +10,7 @@ service tftp
+ wait = yes
+ user = root
+ server = /usr/sbin/in.tftpd
+- server_args = -s /tftpboot
++ server_args = -s /var/lib/tftpboot
+ disable = yes
+ per_source = 11
+ cps = 100 2
+diff --git a/tftpd/sample.rules b/tftpd/sample.rules
+index 55b56be..1741a4c 100644
+--- a/tftpd/sample.rules
++++ b/tftpd/sample.rules
+@@ -29,5 +29,5 @@ rg \\ / # Convert backslashes to slashes
rg \# @ # Convert hash marks to @ signs
rg /../ /..no../ # Convert /../ to /..no../
e ^ok/ # These are always ok
diff --git a/tftp-doc.patch b/tftp-doc.patch
index 041e902..c3733d9 100644
--- a/tftp-doc.patch
+++ b/tftp-doc.patch
@@ -1,6 +1,6 @@
---- tftp-hpa-5.2/tftp/main.c 2013-04-19 09:34:09.737410319 +0200
-+++ tftp-hpa-5.2/tftp/main.c 2013-04-19 09:42:53.559946374 +0200
-@@ -195,9 +195,11 @@
+--- a/tftp/main.c
++++ b/tftp/main.c
+@@ -165,9 +165,11 @@ static void usage(int errcode)
{
fprintf(stderr,
#ifdef HAVE_IPV6
@@ -12,5 +12,5 @@
+ "Usage: %s [-v][-V][-l][-m mode] [-R port:port] "
+ "[host [port]] [-c command]\n",
#endif
- program);
+ _progname);
exit(errcode);
diff --git a/tftp-enhanced-logging.patch b/tftp-enhanced-logging.patch
index 4d548a9..cfb345f 100644
--- a/tftp-enhanced-logging.patch
+++ b/tftp-enhanced-logging.patch
@@ -1,51 +1,25 @@
-diff -up tftp-hpa-5.3/tftpd/tftpd.c.logging tftp-hpa-5.3/tftpd/tftpd.c
---- tftp-hpa-5.3/tftpd/tftpd.c.logging 2025-12-26 22:35:01.117565067 +0100
-+++ tftp-hpa-5.3/tftpd/tftpd.c 2025-12-26 22:36:09.040318780 +0100
-@@ -1053,14 +1053,14 @@ int main(int argc, char **argv)
-
- static char *rewrite_access(char *, int, int, const char **);
+--- a/tftpd/tftpd.c
++++ b/tftpd/tftpd.c
+@@ -1089,7 +1089,7 @@ int main(int argc, char **argv)
+ static char *rewrite_access(const struct formats *,
+ char *, int, int, const char **);
static int validate_access(char *, int, const struct formats *, const char **);
-static void tftp_sendfile(const struct formats *, struct tftphdr *, int);
+static void tftp_sendfile(const struct formats *, struct tftphdr *, int, char *);
static void tftp_recvfile(const struct formats *, struct tftphdr *, int);
- struct formats {
- const char *f_mode;
- char *(*f_rewrite) (char *, int, int, const char **);
- int (*f_validate) (char *, int, const struct formats *, const char **);
-- void (*f_send) (const struct formats *, struct tftphdr *, int);
-+ void (*f_send) (const struct formats *, struct tftphdr *, int, char *);
- void (*f_recv) (const struct formats *, struct tftphdr *, int);
- int f_convert;
- };
-@@ -1125,6 +1125,9 @@ int tftp(struct tftphdr *tp, int size)
- nak(EACCESS, errmsgptr); /* File denied by mapping rule */
- exit(0);
- }
-+ ecode =
-+ (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
-+
- if (verbosity >= 1) {
- tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
- tmpbuf, INET6_ADDRSTRLEN);
-@@ -1143,9 +1146,14 @@ int tftp(struct tftphdr *tp, int size)
- tp_opcode == WRQ ? "WRQ" : "RRQ",
- tmp_p, origfilename,
- filename);
-+
-+ if (ecode == 1) {
-+ syslog(LOG_NOTICE, "Client %s File not found %s\n",
-+ tmp_p,filename);
-+ }
-+
- }
-- ecode =
-- (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
-+
- if (ecode) {
- nak(ecode, errmsgptr);
- exit(0);
-@@ -1168,12 +1176,12 @@ int tftp(struct tftphdr *tp, int size)
+ static const struct formats formats[] = {
+@@ -1180,6 +1180,9 @@ int tftp(struct tftphdr *tp, int size)
+ if (!file) {
+ ecode =
+ (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
++ if (ecode == 1)
++ tftpd_log(LOG_NOTICE, "Client %s File not found %s\n",
++ tmp_p, filename);
+ if (ecode) {
+ nak(ecode, errmsgptr);
+ exit(0);
+@@ -1203,12 +1206,12 @@ int tftp(struct tftphdr *tp, int size)
if (tp_opcode == WRQ)
(*pf->f_recv) (pf, (struct tftphdr *)ackbuf, ap - ackbuf);
else
@@ -60,7 +34,7 @@ diff -up tftp-hpa-5.3/tftpd/tftpd.c.logging tftp-hpa-5.3/tftpd/tftpd.c
}
exit(0); /* Request completed */
}
-@@ -1555,7 +1563,7 @@ static int validate_access(char *filenam
+@@ -1655,7 +1658,7 @@ static int validate_access(char *filename, int mode,
/*
* Send the requested file.
*/
@@ -69,17 +43,28 @@ diff -up tftp-hpa-5.3/tftpd/tftpd.c.logging tftp-hpa-5.3/tftpd/tftpd.c
{
struct tftphdr *dp;
struct tftphdr *ap; /* ack packet */
-@@ -1646,6 +1654,13 @@ static void tftp_sendfile(const struct f
+@@ -1746,6 +1749,13 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
if (!++block)
block = rollover_val;
} while (size == segsize);
+ tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
-+ tmpbuf, INET6_ADDRSTRLEN);
++ tmpbuf, INET6_ADDRSTRLEN);
+ if (!tmp_p) {
+ tmp_p = tmpbuf;
+ strcpy(tmpbuf, "???");
+ }
-+ syslog(LOG_NOTICE, "Client %s finished %s",tmp_p,filename);
++ tftpd_log(LOG_NOTICE, "Client %s finished %s", tmp_p, filename);
abort:
(void)fclose(file);
}
+--- a/tftpd/tftpd.h
++++ b/tftpd/tftpd.h
+@@ -33,7 +33,7 @@ struct formats {
+ const char *f_mode;
+ char *(*f_rewrite) (const struct formats *, char *, int, int, const char **);
+ int (*f_validate) (char *, int, const struct formats *, const char **);
+- void (*f_send) (const struct formats *, struct tftphdr *, int);
++ void (*f_send) (const struct formats *, struct tftphdr *, int, char *);
+ void (*f_recv) (const struct formats *, struct tftphdr *, int);
+ int f_convert;
+ };
diff --git a/tftp-hpa-5.2-osh.patch b/tftp-hpa-5.2-osh.patch
index 4a955aa..7435a3e 100644
--- a/tftp-hpa-5.2-osh.patch
+++ b/tftp-hpa-5.2-osh.patch
@@ -1,9 +1,9 @@
# Fix leaked_handle: Handle variable "fd" going out of scope leaks the handle.
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 364e7d2..cbd6093 100644
+index 6dcf14f..b267364 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -1505,6 +1505,7 @@ static int validate_access(char *filename, int mode,
+@@ -1616,6 +1623,7 @@ static int validate_access(char *filename, int mode,
if (mode == RRQ) {
if (!unixperms && (stbuf.st_mode & (S_IREAD >> 6)) == 0) {
@@ -11,7 +11,7 @@ index 364e7d2..cbd6093 100644
*errmsg = "File must have global read permissions";
return (EACCESS);
}
-@@ -1514,6 +1515,7 @@ static int validate_access(char *filename, int mode,
+@@ -1625,6 +1633,7 @@ static int validate_access(char *filename, int mode,
} else {
if (!unixperms) {
if ((stbuf.st_mode & (S_IWRITE >> 6)) == 0) {
@@ -19,7 +19,7 @@ index 364e7d2..cbd6093 100644
*errmsg = "File must have global write permissions";
return (EACCESS);
}
-@@ -1522,6 +1524,7 @@ static int validate_access(char *filename, int mode,
+@@ -1633,6 +1642,7 @@ static int validate_access(char *filename, int mode,
#ifdef HAVE_FTRUNCATE
/* We didn't get to truncate the file at open() time */
if (ftruncate(fd, (off_t) 0)) {
@@ -28,40 +28,10 @@ index 364e7d2..cbd6093 100644
return (EACCESS);
}
-
-# Patches for negative_returns: "fd" is passed to a parameter of pmtu_discovery_off
-# that cannot be negative
-From 0b44159b3a2f51d350f309d3f6d14a17e74e8231 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
-Date: Wed, 6 Apr 2022 09:33:33 +0200
-Subject: [PATCH 1/2] tftpd: Correctly disable path MTU discovery in
- standalone mode
-
----
- tftpd/tftpd.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 364e7d2..00fa1cf 100644
---- a/tftpd/tftpd.c
-+++ b/tftpd/tftpd.c
-@@ -769,7 +769,7 @@ int main(int argc, char **argv)
- }
-
- /* Disable path MTU discovery */
-- pmtu_discovery_off(fd);
-+ pmtu_discovery_off(fdmax);
-
- /* This means we don't want to wait() for children */
- #ifdef SA_NOCLDWAIT
---
-2.35.1
-
-
From 5f60355c4bd10b866847a0d58a9582bda7db72aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Wed, 6 Apr 2022 09:34:46 +0200
-Subject: [PATCH 2/2] tftpd: Fix a possible usage of -1 file descriptor in
+Subject: [PATCH] tftpd: Fix a possible usage of -1 file descriptor in
standalone mode
---
@@ -72,7 +42,7 @@ diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
index 00fa1cf..afd595d 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
-@@ -622,6 +622,13 @@ int main(int argc, char **argv)
+@@ -672,6 +672,13 @@ int main(int argc, char **argv)
exit(EX_USAGE);
}
ai_fam = AF_INET6;
@@ -88,4 +58,3 @@ index 00fa1cf..afd595d 100644
#endif
--
2.35.1
-
diff --git a/tftp-hpa-5.3-cmd_arg.patch b/tftp-hpa-5.3-cmd_arg.patch
deleted file mode 100644
index 51583fd..0000000
--- a/tftp-hpa-5.3-cmd_arg.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-diff -up tftp-hpa-5.3/config.h.cmd_arg tftp-hpa-5.3/config.h
---- tftp-hpa-5.3/config.h.cmd_arg 2024-05-30 00:40:13.000000000 +0200
-+++ tftp-hpa-5.3/config.h 2025-12-26 22:27:30.933202754 +0100
-@@ -277,6 +277,7 @@ typedef int socklen_t;
- /* Prototypes for libxtra functions */
-
- void *xmalloc(size_t);
-+void *xrealloc(void *, size_t);
- char *xstrdup(const char *);
-
- #ifndef HAVE_SIGHANDLER_T
-diff -up tftp-hpa-5.3/lib/xrealloc.c.cmd_arg tftp-hpa-5.3/lib/xrealloc.c
---- tftp-hpa-5.3/lib/xrealloc.c.cmd_arg 2025-12-26 22:19:59.751870026 +0100
-+++ tftp-hpa-5.3/lib/xrealloc.c 2025-12-26 22:19:59.751870026 +0100
-@@ -0,0 +1,20 @@
-+/*
-+ * xrealloc.c
-+ *
-+ * Simple error-checking version of realloc()
-+ *
-+ */
-+
-+#include "config.h"
-+
-+void *xrealloc(void *ptr, size_t size)
-+{
-+ void *p = realloc(ptr, size);
-+
-+ if (!p) {
-+ fprintf(stderr, "Out of memory!\n");
-+ exit(128);
-+ }
-+
-+ return p;
-+}
-diff -up tftp-hpa-5.3/tftp/main.c.cmd_arg tftp-hpa-5.3/tftp/main.c
---- tftp-hpa-5.3/tftp/main.c.cmd_arg 2024-05-30 00:40:13.000000000 +0200
-+++ tftp-hpa-5.3/tftp/main.c 2025-12-26 22:19:59.752870023 +0100
-@@ -89,11 +89,14 @@ int connected;
- const struct modes *mode;
- #ifdef WITH_READLINE
- char *line = NULL;
-+char *remote_pth = NULL;
- #else
- char line[LBUFLEN];
-+char remote_pth[LBUFLEN];
- #endif
- int margc;
--char *margv[20];
-+char **margv;
-+int sizeof_margv=0;
- const char *prompt = "tftp> ";
- sigjmp_buf toplevel;
- void intr(int);
-@@ -379,6 +382,10 @@ static void getmoreargs(const char *part
- free(line);
- line = NULL;
- }
-+ if (remote_pth) {
-+ free(remote_pth);
-+ remote_pth = NULL;
-+ }
- line = xmalloc(len + elen + 1);
- strcpy(line, partial);
- strcpy(line + len, eline);
-@@ -535,6 +542,7 @@ void put(int argc, char *argv[])
- int fd;
- int n, err;
- char *cp, *targ;
-+ long dirlen, namelen, lastlen=0;
-
- if (argc < 2) {
- getmoreargs("send ", "(file) ");
-@@ -588,9 +596,22 @@ void put(int argc, char *argv[])
- }
- /* this assumes the target is a directory */
- /* on a remote unix system. hmmmm. */
-- cp = strchr(targ, '\0');
-- *cp++ = '/';
-+ dirlen = strlen(targ)+1;
-+#ifdef WITH_READLINE
-+ remote_pth = xmalloc(dirlen+1);
-+#endif
-+ strcpy(remote_pth, targ);
-+ remote_pth[dirlen-1] = '/';
-+ cp = remote_pth + dirlen;
- for (n = 1; n < argc - 1; n++) {
-+#ifdef WITH_READLINE
-+ namelen = strlen(tail(argv[n])) + 1;
-+ if (namelen > lastlen) {
-+ remote_pth = xrealloc(remote_pth, dirlen + namelen + 1);
-+ cp = remote_pth + dirlen;
-+ lastlen = namelen;
-+ }
-+#endif
- strcpy(cp, tail(argv[n]));
- fd = open(argv[n], O_RDONLY | mode->m_openflags);
- if (fd < 0) {
-@@ -600,9 +621,9 @@ void put(int argc, char *argv[])
- }
- if (verbose)
- printf("putting %s to %s:%s [%s]\n",
-- argv[n], hostname, targ, mode->m_mode);
-+ argv[n], hostname, remote_pth, mode->m_mode);
- sa_set_port(&peeraddr, port);
-- tftp_sendfile(fd, targ, mode->m_mode);
-+ tftp_sendfile(fd, remote_pth, mode->m_mode);
- }
- }
-
-@@ -801,6 +822,10 @@ static void command(void)
- free(line);
- line = NULL;
- }
-+ if (remote_pth) {
-+ free(remote_pth);
-+ remote_pth = NULL;
-+ }
- line = readline(prompt);
- if (!line)
- exit(0); /* EOF */
-@@ -872,7 +897,13 @@ struct cmd *getcmd(char *name)
- static void makeargv(void)
- {
- char *cp;
-- char **argp = margv;
-+ char **argp;
-+
-+ if (!sizeof_margv) {
-+ sizeof_margv = 20;
-+ margv = xmalloc(sizeof_margv * sizeof(char *));
-+ }
-+ argp = margv;
-
- margc = 0;
- for (cp = line; *cp;) {
-@@ -882,6 +913,11 @@ static void makeargv(void)
- break;
- *argp++ = cp;
- margc += 1;
-+ if (margc == sizeof_margv) {
-+ sizeof_margv += 20;
-+ margv = xrealloc(margv, sizeof_margv * sizeof(char *));
-+ argp = margv + margc;
-+ }
- while (*cp != '\0' && !isspace(*cp))
- cp++;
- if (*cp == '\0')
diff --git a/tftp-hpa-5.3-pktinfo.patch b/tftp-hpa-5.3-pktinfo.patch
deleted file mode 100644
index 716b27c..0000000
--- a/tftp-hpa-5.3-pktinfo.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff -up tftp-hpa-5.3/tftpd/recvfrom.c.pktinfo tftp-hpa-5.3/tftpd/recvfrom.c
---- tftp-hpa-5.3/tftpd/recvfrom.c.pktinfo 2024-05-30 00:40:13.000000000 +0200
-+++ tftp-hpa-5.3/tftpd/recvfrom.c 2025-12-26 22:30:37.142522362 +0100
-@@ -170,16 +170,16 @@ myrecvfrom(int s, void *buf, int len, un
-
- /* Try to enable getting the return address */
- #ifdef IP_RECVDSTADDR
-- if (from->sa.sa_family == AF_INET)
-+ if (from->sa.sa_family == AF_INET || !from->sa.sa_family)
- setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
- #endif
- #ifdef IP_PKTINFO
-- if (from->sa.sa_family == AF_INET)
-+ if (from->sa.sa_family == AF_INET || !from->sa.sa_family)
- setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
- #endif
- #ifdef HAVE_IPV6
- #ifdef IPV6_RECVPKTINFO
-- if (from->sa.sa_family == AF_INET6)
-+ if (from->sa.sa_family == AF_INET6 || !from->sa.sa_family)
- setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
- #endif
- #endif
diff --git a/tftp-hpa-5.3-setjmp.patch b/tftp-hpa-5.3-setjmp.patch
deleted file mode 100644
index d8b053e..0000000
--- a/tftp-hpa-5.3-setjmp.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From b9f2335e88dcb3939015843c7143f1533c755a46 Mon Sep 17 00:00:00 2001
-From: "H. Peter Anvin" <hpa@zytor.com>
-Date: Wed, 29 May 2024 17:35:14 -0700
-Subject: tftpd: shut up one more setjmp complaint
-
-One more place where the compiler complains about setjmp. Work around
-it by creating yet another static variable. Ugly, but it works.
-
-Signed-off-by: H. Peter Anvin <hpa@zytor.com>
----
- tftpd/tftpd.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
-index 14182f3..d9b3f46 100644
---- a/tftpd/tftpd.c
-+++ b/tftpd/tftpd.c
-@@ -1660,17 +1660,21 @@ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oac
- /*
- * Receive a file.
- */
--static void tftp_recvfile(const struct formats *pf, struct tftphdr *oap, int oacklen)
-+static void tftp_recvfile(const struct formats *pf,
-+ struct tftphdr *oack, int oacklen)
- {
- struct tftphdr *dp;
- int n, size;
- /* These are "static" to avoid longjmp funnies */
-+ static struct tftphdr *oap;
- static struct tftphdr *ap; /* ack buffer */
- static u_short block = 0;
- static int acksize;
- u_short dp_opcode, dp_block;
- unsigned long r_timeout;
-
-+ oap = oack;
-+
- dp = w_init();
- do {
- timeout = rexmtval;
---
-cgit 1.2.3-korg
-
diff --git a/tftp-hpa-5.3-stats.patch b/tftp-hpa-5.3-stats.patch
index e770465..571ab30 100644
--- a/tftp-hpa-5.3-stats.patch
+++ b/tftp-hpa-5.3-stats.patch
@@ -1,4 +1,4 @@
-From 1b6c4905ded296dd1e593d8a75ef565a8e16f4fa Mon Sep 17 00:00:00 2001
+From 7b1051cafcfb4fd61c840e489cecea8380177aa4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Tue, 14 Apr 2026 17:58:41 +0200
Subject: [PATCH] =?UTF-8?q?tftp:=20correctly=20convert=20=CE=BCs=20to=20s?=
@@ -23,10 +23,10 @@ Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tftp/tftp.c b/tftp/tftp.c
-index 33a4175..2ba3de2 100644
+index 14c3a75..e161527 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
-@@ -398,8 +398,8 @@ static void printstats(const char *direction, unsigned long amount)
+@@ -406,8 +406,8 @@ static void printstats(const char *direction, unsigned long amount)
{
double delta;
@@ -38,5 +38,5 @@ index 33a4175..2ba3de2 100644
printf("%s %lu bytes in %.1f seconds", direction, amount, delta);
printf(" [%.0f bit/s]", (amount * 8.) / delta);
--
-2.53.0
+2.55.0
diff --git a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
index d1cb572..47c8351 100644
--- a/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
+++ b/tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
@@ -1,4 +1,4 @@
-From 662053b769c1c15ad0ff2a9eee72cb74ccede34a Mon Sep 17 00:00:00 2001
+From 817a17dfddca3c1213a8a5dc848b043caefee139 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Wed, 16 Jul 2025 15:03:43 +0200
Subject: [PATCH] tftp: propagate errors to exit code in single command mode
@@ -10,10 +10,10 @@ Subject: [PATCH] tftp: propagate errors to exit code in single command mode
3 files changed, 94 insertions(+), 64 deletions(-)
diff --git a/tftp/extern.h b/tftp/extern.h
-index 9c578e6..7923eac 100644
+index 9fd424b..c1e1980 100644
--- a/tftp/extern.h
+++ b/tftp/extern.h
-@@ -36,8 +36,8 @@
+@@ -10,8 +10,8 @@
#include "config.h"
@@ -25,10 +25,10 @@ index 9c578e6..7923eac 100644
#endif
diff --git a/tftp/main.c b/tftp/main.c
-index ac06330..74f63f8 100644
+index eed02bf..e7b338c 100644
--- a/tftp/main.c
+++ b/tftp/main.c
-@@ -102,20 +102,20 @@ int portrange = 0;
+@@ -77,20 +77,20 @@ int portrange = 0;
unsigned int portrange_from = 0;
unsigned int portrange_to = 0;
@@ -63,7 +63,7 @@ index ac06330..74f63f8 100644
static void command(void);
-@@ -129,7 +129,7 @@ static void settftpmode(const struct modes *);
+@@ -104,7 +104,7 @@ static void settftpmode(const struct modes *);
struct cmd {
const char *name;
const char *help;
@@ -72,16 +72,16 @@ index ac06330..74f63f8 100644
};
struct cmd cmdtab[] = {
-@@ -188,7 +188,7 @@ char *xstrdup(const char *);
+@@ -161,7 +161,7 @@ char *tail(char *);
- const char *program;
+ char *xstrdup(const char *);
-static void usage(int errcode)
+static int usage(int errcode)
{
fprintf(stderr,
#ifdef HAVE_IPV6
-@@ -203,7 +203,7 @@ static void usage(int errcode)
+@@ -176,7 +176,7 @@ static void usage(int errcode)
int main(int argc, char *argv[])
{
union sock_addr sa;
@@ -90,7 +90,7 @@ index ac06330..74f63f8 100644
static int pargc, peerargc;
static int iscmd = 0;
char **pargv;
-@@ -342,8 +342,8 @@ int main(int argc, char *argv[])
+@@ -315,8 +315,8 @@ int main(int argc, char *argv[])
pargv[1]);
exit(EX_USAGE);
}
@@ -101,7 +101,7 @@ index ac06330..74f63f8 100644
}
#ifdef WITH_READLINE
#ifdef HAVE_READLINE_HISTORY_H
-@@ -398,7 +398,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
+@@ -371,7 +371,7 @@ static void getmoreargs(const char *partial, const char *mprompt)
#endif
}
@@ -110,7 +110,7 @@ index ac06330..74f63f8 100644
{
int err;
-@@ -410,7 +410,7 @@ void setpeer(int argc, char *argv[])
+@@ -383,7 +383,7 @@ void setpeer(int argc, char *argv[])
}
if ((argc < 2) || (argc > 3)) {
printf("usage: %s host-name [port]\n", argv[0]);
@@ -119,7 +119,7 @@ index ac06330..74f63f8 100644
}
peeraddr.sa.sa_family = ai_fam;
-@@ -419,7 +419,7 @@ void setpeer(int argc, char *argv[])
+@@ -392,7 +392,7 @@ void setpeer(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
connected = 0;
@@ -128,7 +128,7 @@ index ac06330..74f63f8 100644
}
ai_fam = peeraddr.sa.sa_family;
if (f == -1) { /* socket not open */
-@@ -456,7 +456,7 @@ void setpeer(int argc, char *argv[])
+@@ -429,7 +429,7 @@ void setpeer(int argc, char *argv[])
if (*ep || myport > 65535UL) {
printf("%s: bad port number\n", argv[2]);
connected = 0;
@@ -137,7 +137,7 @@ index ac06330..74f63f8 100644
}
port = htons((u_short) myport);
}
-@@ -472,16 +472,17 @@ void setpeer(int argc, char *argv[])
+@@ -445,16 +445,17 @@ void setpeer(int argc, char *argv[])
hostname, tp, (unsigned int)ntohs(port));
}
connected = 1;
@@ -157,7 +157,7 @@ index ac06330..74f63f8 100644
}
if (argc == 2) {
for (p = modes; p->m_name; p++)
-@@ -489,7 +490,7 @@ void modecmd(int argc, char *argv[])
+@@ -462,7 +463,7 @@ void modecmd(int argc, char *argv[])
break;
if (p->m_name) {
settftpmode(p);
@@ -166,7 +166,7 @@ index ac06330..74f63f8 100644
}
printf("%s: unknown mode\n", argv[1]);
/* drop through and print usage message */
-@@ -503,21 +504,23 @@ void modecmd(int argc, char *argv[])
+@@ -476,21 +477,23 @@ void modecmd(int argc, char *argv[])
sep = " | ";
}
printf(" ]\n");
@@ -193,7 +193,7 @@ index ac06330..74f63f8 100644
}
static void settftpmode(const struct modes *newmode)
-@@ -530,7 +533,7 @@ static void settftpmode(const struct modes *newmode)
+@@ -503,7 +506,7 @@ static void settftpmode(const struct modes *newmode)
/*
* Send file(s).
*/
@@ -202,7 +202,7 @@ index ac06330..74f63f8 100644
{
int fd;
int n, err;
-@@ -544,14 +547,14 @@ void put(int argc, char *argv[])
+@@ -517,14 +520,14 @@ void put(int argc, char *argv[])
}
if (argc < 2) {
putusage(argv[0]);
@@ -219,7 +219,7 @@ index ac06330..74f63f8 100644
}
cp = argv[argc - 1];
targ = strchr(cp, ':');
-@@ -562,14 +565,14 @@ void put(int argc, char *argv[])
+@@ -535,14 +538,14 @@ void put(int argc, char *argv[])
printf("Error: %s\n", gai_strerror(err));
printf("%s: unknown host\n", argv[1]);
connected = 0;
@@ -236,7 +236,7 @@ index ac06330..74f63f8 100644
}
if (argc < 4) {
cp = argc == 2 ? tail(targ) : argv[1];
-@@ -587,14 +590,14 @@ void put(int argc, char *argv[])
+@@ -550,17 +553,18 @@ void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -254,34 +254,32 @@ index ac06330..74f63f8 100644
}
/* this assumes the target is a directory */
/* on a remote unix system. hmmmm. */
-@@ -605,6 +608,7 @@ void put(int argc, char *argv[])
- strcpy(remote_pth, targ);
- remote_pth[dirlen-1] = '/';
- cp = remote_pth + dirlen;
+ err = 0;
for (n = 1; n < argc - 1; n++) {
- #ifdef WITH_READLINE
- namelen = strlen(tail(argv[n])) + 1;
-@@ -619,14 +623,17 @@ void put(int argc, char *argv[])
+ const char *base = tail(argv[n]);
+ char *remotepath = xmalloc(strlen(targ) + 1 + strlen(base) + 1);
+@@ -570,6 +574,7 @@ void put(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(argv[n]);
+ err = EX_OSERR;
+ free(remotepath);
continue;
}
- if (verbose)
+@@ -577,9 +582,11 @@ void put(int argc, char *argv[])
printf("putting %s to %s:%s [%s]\n",
- argv[n], hostname, remote_pth, mode->m_mode);
+ argv[n], hostname, remotepath, mode->m_mode);
sa_set_port(&peeraddr, port);
-- tftp_sendfile(fd, remote_pth, mode->m_mode);
-+ err |= tftp_sendfile(fd, remote_pth, mode->m_mode);
+- tftp_sendfile(fd, remotepath, mode->m_mode);
++ err |= tftp_sendfile(fd, remotepath, mode->m_mode);
+ free(remotepath);
}
+
+ return err;
}
static void putusage(char *s)
-@@ -615,10 +622,10 @@ static void putusage(char *s)
+@@ -591,10 +598,10 @@ static void putusage(char *s)
/*
* Receive file(s).
*/
@@ -294,7 +292,7 @@ index ac06330..74f63f8 100644
char *cp;
char *src;
-@@ -630,28 +637,28 @@ void get(int argc, char *argv[])
+@@ -606,28 +613,28 @@ void get(int argc, char *argv[])
}
if (argc < 2) {
getusage(argv[0]);
@@ -327,7 +325,7 @@ index ac06330..74f63f8 100644
continue;
}
ai_fam = peeraddr.sa.sa_family;
-@@ -664,13 +671,13 @@ void get(int argc, char *argv[])
+@@ -640,13 +647,13 @@ void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -343,7 +341,7 @@ index ac06330..74f63f8 100644
break;
}
cp = tail(src); /* new .. jdg */
-@@ -679,14 +686,16 @@ void get(int argc, char *argv[])
+@@ -655,14 +662,16 @@ void get(int argc, char *argv[])
if (fd < 0) {
fprintf(stderr, "tftp: ");
perror(cp);
@@ -361,7 +359,7 @@ index ac06330..74f63f8 100644
}
static void getusage(char *s)
-@@ -697,7 +706,7 @@ static void getusage(char *s)
+@@ -673,7 +682,7 @@ static void getusage(char *s)
int rexmtval = TIMEOUT;
@@ -370,7 +368,7 @@ index ac06330..74f63f8 100644
{
int t;
-@@ -709,18 +718,19 @@ void setrexmt(int argc, char *argv[])
+@@ -685,18 +694,19 @@ void setrexmt(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -392,7 +390,7 @@ index ac06330..74f63f8 100644
{
int t;
-@@ -732,24 +742,26 @@ void settimeout(int argc, char *argv[])
+@@ -708,24 +718,26 @@ void settimeout(int argc, char *argv[])
}
if (argc != 2) {
printf("usage: %s value\n", argv[0]);
@@ -422,7 +420,7 @@ index ac06330..74f63f8 100644
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -762,6 +774,7 @@ void status(int argc, char *argv[])
+@@ -738,6 +750,7 @@ void status(int argc, char *argv[])
literal ? "on" : "off");
printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n",
rexmtval, maxtimeout);
@@ -430,7 +428,7 @@ index ac06330..74f63f8 100644
}
void intr(int sig)
-@@ -891,7 +904,7 @@ static void makeargv(void)
+@@ -872,7 +885,7 @@ static void makeargv(void)
*argp++ = 0;
}
@@ -439,7 +437,7 @@ index ac06330..74f63f8 100644
{
(void)argc;
(void)argv; /* Quiet unused warning */
-@@ -901,7 +914,7 @@ void quit(int argc, char *argv[])
+@@ -882,7 +895,7 @@ void quit(int argc, char *argv[])
/*
* Help command.
*/
@@ -448,7 +446,7 @@ index ac06330..74f63f8 100644
{
struct cmd *c;
-@@ -911,7 +924,7 @@ void help(int argc, char *argv[])
+@@ -892,7 +905,7 @@ void help(int argc, char *argv[])
printf("Commands may be abbreviated. Commands are:\n\n");
for (c = cmdtab; c->name; c++)
printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help);
@@ -457,7 +455,7 @@ index ac06330..74f63f8 100644
}
while (--argc > 0) {
char *arg;
-@@ -924,22 +937,25 @@ void help(int argc, char *argv[])
+@@ -905,22 +918,25 @@ void help(int argc, char *argv[])
else
printf("%s\n", c->help);
}
@@ -486,10 +484,10 @@ index ac06330..74f63f8 100644
+ return 0;
}
diff --git a/tftp/tftp.c b/tftp/tftp.c
-index 33a4175..19e60dc 100644
+index e161527..8e5bb65 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
-@@ -61,11 +61,11 @@ static void tpacket(const char *, struct tftphdr *, int);
+@@ -45,11 +45,11 @@ static void tpacket(const char *, struct tftphdr *, int);
/*
* Send the requested file.
*/
@@ -503,15 +501,15 @@ index 33a4175..19e60dc 100644
volatile int is_request;
volatile u_short block;
volatile int size, convert;
-@@ -83,6 +83,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -67,6 +67,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
block = 0;
is_request = 1; /* First packet is the actual WRQ */
amount = 0;
+ err = 0;
- tftp_signal(SIGALRM, timer);
+ tftp_signal(SIGALRM, timer, 0);
do {
-@@ -93,6 +94,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -81,6 +82,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
size = readit(file, &dp, convert);
if (size < 0) {
nak(errno + 100, NULL);
@@ -519,7 +517,7 @@ index 33a4175..19e60dc 100644
break;
}
dp->th_opcode = htons((u_short) DATA);
-@@ -107,6 +109,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -95,6 +97,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
&peeraddr.sa, SOCKLEN(&peeraddr));
if (n != size + 4) {
perror("tftp: sendto");
@@ -527,7 +525,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
read_ahead(file, convert);
-@@ -120,6 +123,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -108,6 +111,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
alarm(0);
if (n < 0) {
perror("tftp: recvfrom");
@@ -535,7 +533,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */
-@@ -130,6 +134,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -118,6 +122,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
ap_block = ntohs((u_short) ap->th_block);
if (ap_opcode == ERROR) {
printf("Error code %d: %s\n", ap_block, ap->th_msg);
@@ -543,7 +541,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
if (ap_opcode == ACK) {
-@@ -162,16 +167,18 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+@@ -150,16 +155,18 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
stopclock();
if (amount > 0)
printstats("Sent", amount);
@@ -564,15 +562,15 @@ index 33a4175..19e60dc 100644
volatile u_short block;
volatile int size, firsttrip;
volatile unsigned long amount;
-@@ -189,6 +196,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -177,6 +184,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
block = 1;
firsttrip = 1;
amount = 0;
+ err = 0;
- tftp_signal(SIGALRM, timer);
+ tftp_signal(SIGALRM, timer, 0);
do {
-@@ -210,6 +218,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -202,6 +210,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
SOCKLEN(&peeraddr)) != size) {
alarm(0);
perror("tftp: sendto");
@@ -580,7 +578,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
write_behind(file, convert);
-@@ -223,6 +232,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -215,6 +224,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
alarm(0);
if (n < 0) {
perror("tftp: recvfrom");
@@ -588,7 +586,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */
-@@ -233,6 +243,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -225,6 +235,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
dp_block = ntohs((u_short) dp->th_block);
if (dp_opcode == ERROR) {
printf("Error code %d: %s\n", dp_block, dp->th_msg);
@@ -596,7 +594,7 @@ index 33a4175..19e60dc 100644
goto abort;
}
if (dp_opcode == DATA) {
-@@ -257,6 +268,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -249,6 +260,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
size = writeit(file, &dp, n - 4, convert);
if (size < 0) {
nak(errno + 100, NULL);
@@ -604,7 +602,7 @@ index 33a4175..19e60dc 100644
break;
}
amount += size;
-@@ -271,6 +283,8 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+@@ -263,6 +275,8 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
stopclock();
if (amount > 0)
printstats("Received", amount);
@@ -614,5 +612,5 @@ index 33a4175..19e60dc 100644
static int
--
-2.52.0
+2.55.0
diff --git a/tftp-off-by-one.patch b/tftp-off-by-one.patch
deleted file mode 100644
index 98b0874..0000000
--- a/tftp-off-by-one.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-Resolves: #1485943
-
---- a/tftpd/tftpd.c 2017-08-28 09:12:11.681299000 +0200
-+++ b/tftpd/tftpd.c 2017-08-28 13:30:03.109312000 +0200
-@@ -1388,24 +1388,25 @@
- return strlen(p);
-
- case 'x':
-- if (output) {
-- if (from.sa.sa_family == AF_INET) {
-+ if (from.sa.sa_family == AF_INET) {
-+ if (output) {
- sprintf(output, "%08lX",
- (unsigned long)ntohl(from.si.sin_addr.s_addr));
-- l = 8;
-+ }
-+ l = 8;
- #ifdef HAVE_IPV6
-- } else {
-- unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
-- p = tb;
-- for (l = 0; l < 16; l++) {
-- sprintf(p, "%02X", *c);
-- c++;
-- p += 2;
-- }
-+ } else {
-+ unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
-+ p = tb;
-+ for (l = 0; l < 16; l++) {
-+ sprintf(p, "%02X", *c);
-+ c++;
-+ p += 2;
-+ }
-+ if (output)
- strcpy(output, tb);
-- l = strlen(tb);
-+ l = strlen(tb);
- #endif
-- }
- }
- return l;
-
-
diff --git a/tftp.spec b/tftp.spec
index 287b17d..793980e 100644
--- a/tftp.spec
+++ b/tftp.spec
@@ -2,21 +2,20 @@
Summary: The client for the Trivial File Transfer Protocol (TFTP)
Name: tftp
-Version: 5.3
-Release: 4%{?dist}
+Version: 5.4
+Release: 1%{?dist}
License: BSD-4-Clause-UC
URL: http://www.kernel.org/pub/software/network/tftp/
-Source0: https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/snapshot/tftp-hpa-%{version}.tar.gz
-Source1: tftp.socket
-Source2: tftp.service
-Source3: tftp-server-tmpfiles.conf
-
-# Upstream patches
-# https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/patch/?id=b9f2335e88dcb3939015843c7143f1533c755a46
-Patch: tftp-hpa-5.3-setjmp.patch
+Source0: https://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-5.4.tar.gz
+Source1: https://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-5.4.tar.sign
+# gpg --keyserver pgp.mit.edu --recv-key 6D0107BC69EE5A274FD9B60C2DB3C3321B6DDF86
+# gpg --output hpa.gpg --armor --export hpa@zytor.com
+Source2: hpa.gpg
+Source3: tftp.socket
+Source4: tftp.service
+Source5: tftp-server-tmpfiles.conf
# To-be upstreamed patches
-Patch: tftp-hpa-5.3-cmd_arg.patch
# https://www.syslinux.org/archives/2026-April/026959.html
Patch: tftp-hpa-5.3-stats.patch
Patch: tftp-doc.patch
@@ -26,13 +25,9 @@ Patch: tftp-hpa-5.3-tftp-exit-code-cmdmode.patch
# Downstream-only patches
Patch: tftp-0.42-tftpboot.patch
-# Code removed upstream in https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/patch/?id=b6d9029420315dc60237d1d4fb29306ae172c120
-Patch: tftp-hpa-5.3-pktinfo.patch
-# Code removed upstream in https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/patch/?id=04d7b0db0672ef5c7c36886e00f136672881a9ef
-Patch: tftp-off-by-one.patch
-BuildRequires: autoconf
BuildRequires: gcc
+BuildRequires: gpgverify
BuildRequires: make
BuildRequires: readline-devel
BuildRequires: systemd-rpm-macros
@@ -59,26 +54,21 @@ enabled unless it is expressly needed. The TFTP server is run by using
systemd socket activation, and is disabled by default.
%prep
+gzip -cd '%{SOURCE0}' > 'tftp-hpa-%{version}.tar'
+%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='tftp-hpa-%{version}.tar'
%autosetup -p1 -n tftp-hpa-%{version}
%build
-autoreconf
%configure
%make_build
%install
-mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
-mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8}
-mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
-mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tftpboot
-mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir}
-mkdir -p ${RPM_BUILD_ROOT}%{_unitdir}
-
%make_install INSTALLROOT=%{buildroot} SBINDIR=%{_sbindir} MANDIR=%{_mandir}
-install -p -m 644 %SOURCE1 ${RPM_BUILD_ROOT}%{_unitdir}
-install -p -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir}
-install -p -m 644 %SOURCE3 ${RPM_BUILD_ROOT}%{_tmpfilesdir}/%{name}.conf
+mkdir -p %{buildroot}%{_localstatedir}/lib/tftpboot
+install -D -p -m 644 %SOURCE3 %{buildroot}%{_unitdir}/%{name}.socket
+install -D -p -m 644 %SOURCE4 %{buildroot}%{_unitdir}/%{name}.service
+install -D -p -m 644 %SOURCE5 %{buildroot}%{_tmpfilesdir}/%{name}.conf
%post server
%systemd_post tftp.socket
@@ -106,6 +96,10 @@ install -p -m 644 %SOURCE3 ${RPM_BUILD_ROOT}%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/tftp.socket
%changelog
+* Thu Jul 09 2026 Lukáš Zaoral <lzaoral@redhat.com> - 5.4-1
+- rebase to the latest upstream release (rhbz#2497090)
+- add gpg verification
+
* Wed Apr 15 2026 Lukáš Zaoral <lzaoral@redhat.com> - 5.3-4
- clean-up patches
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-08 10:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 10:49 [rpms/tftp] rawhide: rebase to the latest upstream release
-- strict thread matches above, loose matches on Subject: below --
2026-09-03 9:12
2026-07-09 20:16
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox