summaryrefslogtreecommitdiffstats
path: root/network/linksys-tftp
diff options
context:
space:
mode:
Diffstat (limited to 'network/linksys-tftp')
-rw-r--r--network/linksys-tftp/README21
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-r1-Makefile.patch28
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch196
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-r1-fno-common.patch11
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-r1-header.patch52
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-stdc-main.patch292
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftp.patch157
-rw-r--r--network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch111
-rw-r--r--network/linksys-tftp/linksys-tftp.SlackBuild96
-rw-r--r--network/linksys-tftp/linksys-tftp.info10
-rw-r--r--network/linksys-tftp/slack-desc19
11 files changed, 993 insertions, 0 deletions
diff --git a/network/linksys-tftp/README b/network/linksys-tftp/README
new file mode 100644
index 0000000000..892d659812
--- /dev/null
+++ b/network/linksys-tftp/README
@@ -0,0 +1,21 @@
+Linksys-tftp is a BSD tftp client for the non-standard tftp
+authentication process used by some Linksys routers.
+
+These routers include the BEFW11, WRT54G and WRT54GL
+
+They all need a password for the tftp firmware file transfer to work.
+
+For example to upgrade a Linksys WRT54G router at 192.168.1.1 with
+tomato firmware, WRT54G_WRT54GL.bin, where the password is admin
+
+#linksys-tftp 192.168.1.1
+linksys-tftp>verbose
+linksys-tftp>binary
+linksys-tftp>blocksize 512
+linksys-tftp>rexmt 1
+linksys-tftp>timeout 120
+linksys-tftp>trace
+linksys-tftp>put WRT54G_WRT54GL.bin admin
+linksys-tftp>quit
+
+atftp can be used with the -P option, instead of linksys-tftp.
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-r1-Makefile.patch b/network/linksys-tftp/linksys-tftp-1.2.1-r1-Makefile.patch
new file mode 100644
index 0000000000..b374e808ec
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-r1-Makefile.patch
@@ -0,0 +1,28 @@
+Fix LDFLAGS (bug http://bugs.gentoo.org/336956 ) and
+CFLAGS (bug http://bugs.gentoo.org/240894 ) by
+Michael Weber <xmw@gentoo.org>
+
+--- linksys-tftp-1.2.1/Makefile
++++ linksys-tftp-1.2.1/Makefile
+@@ -19,18 +19,18 @@
+ # We override /usr/include/arpa/tftp.h with our own because
+ # we want tu_block to be unsigned short, not short as on most platforms
+ #
+-CFLAGS= -I. -O2 -Dsin=sin_x
++CFLAGS += -I. -Dsin=sin_x
+ #DEBUG
+ # CFLAGS= -I. -Wall -ggdb -Dsin=sin_x
+ SRCS= main.c tftp.c tftpsubs.c
+ OBJS= main.o tftp.o tftpsubs.o
+ DOBJS= tftpsubs.o
+-CC= gcc
++CC?= gcc
+
+ all: linksys-tftp
+
+ linksys-tftp: ${OBJS}
+- ${CC} -o $@ ${CFLAGS} ${OBJS}
++ ${CC} -o $@ ${CFLAGS} ${OBJS} ${LDFLAGS}
+
+ clean:
+ rm -f ${OBJS} ${DOBJS} *core linksys-tftp
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch b/network/linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch
new file mode 100644
index 0000000000..94ccee0c9e
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch
@@ -0,0 +1,196 @@
+--- a/main.c
++++ b/main.c
+@@ -159,7 +159,7 @@ setpeer(argc, argv)
+
+ if (!argv[1]) {
+ printf("usage: %s host-name [port] (Default port is 69/udp)\n", argv[0]);
+- return;
++ return 0;
+ }
+ host = gethostbyname(argv[1]);
+ if (host) {
+@@ -172,7 +172,7 @@ setpeer(argc, argv)
+ if (sin.sin_addr.s_addr == -1) {
+ connected = 0;
+ printf("%s: unknown host\n", argv[1]);
+- return;
++ return 0;
+ }
+ strcpy(hostname, argv[1]);
+ }
+@@ -182,7 +182,7 @@ setpeer(argc, argv)
+ if (port < 0) {
+ printf("%s: bad port number\n", argv[2]);
+ connected = 0;
+- return;
++ return 0;
+ }
+ port = htons(port);
+ }
+@@ -209,7 +209,7 @@ modecmd(argc, argv)
+
+ if (argc < 2) {
+ printf("Using %s mode to transfer files.\n", mode);
+- return;
++ return 0;
+ }
+ if (argc == 2) {
+ for (p = modes; p->m_name; p++)
+@@ -217,7 +217,7 @@ modecmd(argc, argv)
+ break;
+ if (p->m_name) {
+ setmode(p->m_mode);
+- return;
++ return 0;
+ }
+ printf("%s: unknown mode\n", argv[1]);
+ /* drop through and print usage message */
+@@ -231,7 +231,7 @@ modecmd(argc, argv)
+ sep = " | ";
+ }
+ printf(" ]\n");
+- return;
++ return 0;
+ }
+
+ setbinary(argc, argv)
+@@ -265,31 +265,32 @@ put(argc, argv)
+
+ if (argc < 3) {
+ putusage(argv[0]);
+- return;
++ return 0;
+ }
+ linkpass = argv[2];
+ if (!connected) {
+ fprintf(stderr,"No target machine specified.\n");
+- return;
++ return 0;
+ }
+ cp = argv[1];
+ fd = open(cp, O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "tftp: "); perror(cp);
+- return;
++ return 0;
+ }
+ if (verbose)
+ printf("putting %s to %s:%s [%s] AUTH %s\n",
+ cp, hostname, cp, mode, linkpass);
+ sin.sin_port = port;
+ sendfile(fd, cp, mode, linkpass);
+- return;
++ return 0;
+ }
+
+ putusage(s)
+ char *s;
+ {
+ printf("usage: %s file [linksys pass] (you must be connected)\n", s);
++ return 0;
+ }
+
+ /*
+@@ -304,18 +305,18 @@ get(argc, argv)
+
+ if (argc < 3) {
+ getusage(argv[0]);
+- return;
++ return 0;
+ }
+ linkpass = argv[2];
+ if (!connected) {
+ fprintf(stderr,"No target machine specified.\n");
+- return;
++ return 0;
+ }
+ cp = argv[1];
+ fd = creat(cp, 0644);
+ if (fd < 0) {
+ fprintf(stderr, "tftp: "); perror(cp);
+- return;
++ return 0;
+ }
+ if (verbose)
+ printf("getting from %s:%s to %s [%s] AUTH %s\n",
+@@ -323,7 +324,7 @@ get(argc, argv)
+ sin.sin_port = port;
+ recvfile(fd, cp, mode, linkpass);
+
+- return;
++ return 0;
+ }
+
+ getusage(s)
+@@ -349,7 +350,7 @@ setrexmt(argc, argv)
+ }
+ if (argc != 2) {
+ printf("usage: %s value\n", argv[0]);
+- return;
++ return 0;
+ }
+ t = atoi(argv[1]);
+ if (t < 0)
+@@ -375,7 +376,7 @@ settimeout(argc, argv)
+ }
+ if (argc != 2) {
+ printf("usage: %s value\n", argv[0]);
+- return;
++ return 0;
+ }
+ t = atoi(argv[1]);
+ if (t < 0)
+@@ -450,7 +451,7 @@ getcmd(name)
+ longest = 0;
+ nmatches = 0;
+ found = 0;
+- if(!name) return;
++ if(!name) return 0;
+ for (c = cmdtab; p = c->name; c++) {
+ for (q = name; *q == *p++; q++)
+ if (*q == 0) /* exact match? */
+@@ -513,7 +514,7 @@ help(argc, argv)
+ printf("Commands may be abbreviated. Commands are:\n\n");
+ for (c = cmdtab; c->name; c++)
+ printf("%-*s\t%s\n", HELPINDENT, c->name, c->help);
+- return;
++ return 0;
+ }
+ while (--argc > 0) {
+ register char *arg;
+@@ -557,7 +558,7 @@ setblocksize(argc, argv)
+ }
+ if (argc != 2) {
+ printf("usage: %s value\n", argv[0]);
+- return;
++ return 0;
+ }
+ t = atoi(argv[1]);
+ if (t < 8 || t > 1432)
+@@ -570,5 +571,5 @@ banner() {
+ printf("Mike Lynn\tabaddon [at] 802.11ninja.net\n");
+ printf("Linksys TFTP Client for *BSD/Linux\tThe Firmware gets sexier\n");
+ printf("Modified Berkeley TFTP client Release: %s\n\n",svers);
+- return;
++ return 0;
+ }
+--- a/tftpsubs.c
++++ b/tftpsubs.c
+@@ -116,7 +116,7 @@ read_ahead(file, convert)
+
+ b = &bfs[nextone]; /* look at "next" buffer */
+ if (b->counter != BF_FREE) /* nop if not free */
+- return;
++ return 0;
+ nextone = !nextone; /* "incr" next buffer ptr */
+
+ dp = (struct tftphdr *)b->buf;
+@@ -131,7 +131,7 @@ read_ahead(file, convert)
+ b->counter += i;
+ } while (i != 0 && !(i < 0 && errno != EINTR) &&
+ b->counter < segsize);
+- return;
++ return 0;
+ }
+
+ p = dp->th_data;
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-r1-fno-common.patch b/network/linksys-tftp/linksys-tftp-1.2.1-r1-fno-common.patch
new file mode 100644
index 0000000000..a639776198
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-r1-fno-common.patch
@@ -0,0 +1,11 @@
+--- a/tftp.c
++++ b/tftp.c
+@@ -50,7 +50,7 @@ extern int segsize;
+ #define PKTSIZE (1432+4) /* SEGSIZE+4 */
+ char ackbuf[PKTSIZE];
+ int timeout;
+-jmp_buf toplevel;
++extern jmp_buf toplevel;
+ jmp_buf timeoutbuf;
+
+ #ifndef OACK
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-r1-header.patch b/network/linksys-tftp/linksys-tftp-1.2.1-r1-header.patch
new file mode 100644
index 0000000000..9944f3c059
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-r1-header.patch
@@ -0,0 +1,52 @@
+--- linksys-tftp-1.2.1/main.c
++++ linksys-tftp-1.2.1/main.c
+@@ -40,6 +40,10 @@
+ #include <setjmp.h>
+ #include <ctype.h>
+ #include <netdb.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++#include <sys/sendfile.h>
+
+ #define TIMEOUT 5 /* secs between rexmt's */
+
+@@ -110,7 +112,7 @@
+ char *index();
+ char *rindex();
+
+-main(argc, argv)
++int main(argc, argv)
+ char *argv[];
+ {
+ struct sockaddr_in sin;
+--- a/tftp.c
++++ b/tftp.c
+@@ -36,8 +36,8 @@
+ #include <stdio.h>
+ #include <errno.h>
+ #include <setjmp.h>
+-
+-extern int errno;
++#include <string.h>
++#include <unistd.h>
+
+ extern struct sockaddr_in sin; /* filled in by main */
+ extern int f; /* the opened socket */
+@@ -69,16 +69,6 @@ void timer(int sig)
+ longjmp(timeoutbuf, 1);
+ }
+
+-strnlen(s, n)
+- char *s;
+- int n;
+-{
+- int i = 0;
+-
+- while (n-- > 0 && *s++) i++;
+- return(i);
+-}
+-
+ /*
+ * Parse an OACK package and set blocksize accordingly
+ */
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-stdc-main.patch b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-main.patch
new file mode 100644
index 0000000000..ff27a1bfb6
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-main.patch
@@ -0,0 +1,292 @@
+--- linksys-tftp-1.2.1/main.c 2024-04-16 08:27:50.327449884 -0700
++++ linksys-tftp-1.2.1/main.c 2024-04-15 21:36:43.035399534 -0700
+@@ -33,6 +33,7 @@ static char sccsid[] = "@(#)main.c 5.8 (
+ #include <sys/file.h>
+
+ #include <netinet/in.h>
++#include <arpa/inet.h>
+
+ #include <signal.h>
+ #include <stdio.h>
+@@ -43,7 +44,11 @@ static char sccsid[] = "@(#)main.c 5.8 (
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+-#include <sys/sendfile.h>
++/* #include <sys/sendfile.h> */
++
++/* routines from tftp.c */
++extern void sendfile(int fd, char *name, char *mode, char *linkpass);
++extern void recvfile(int fd, char *name, char *mode, char *linkpass);
+
+ #define TIMEOUT 5 /* secs between rexmt's */
+
+@@ -64,9 +69,13 @@ struct servent *sp;
+
+ int segsize = 512;
+
+-int quit(), help(), setverbose(), settrace(), status();
+-int get(), put(), setpeer(), modecmd(), setrexmt(), settimeout();
+-int setbinary(), banner(), setascii(), setblocksize();
++/* local routines */
++int quit(), help(), setverbose(), settrace(), status(), command();
++int get(), getusage(), put(), putusage();
++int setpeer(), modecmd(), setrexmt(), settimeout(), status();
++int setbinary(), setascii();
++void setmode(), makeargv();
++int setblocksize(), banner();
+
+ #define HELPINDENT (sizeof("connect"))
+
+@@ -114,8 +123,7 @@ struct cmd *getcmd();
+ char *index();
+ char *rindex();
+
+-int main(argc, argv)
+- char *argv[];
++int main(int argc, char *argv[])
+ {
+ struct sockaddr_in sin;
+ int top;
+@@ -147,13 +155,12 @@ int main(argc, argv)
+ top = setjmp(toplevel) == 0;
+ for (;;)
+ command(top);
++ return 0;
+ }
+
+ char hostname[100];
+
+-setpeer(argc, argv)
+- int argc;
+- char *argv[];
++int setpeer(int argc, char *argv[])
+ {
+ struct hostent *host;
+
+@@ -187,6 +194,7 @@ setpeer(argc, argv)
+ port = htons(port);
+ }
+ connected = 1;
++ return 0;
+ }
+
+ struct modes {
+@@ -201,8 +209,7 @@ struct modes {
+ { 0, 0 }
+ };
+
+-modecmd(argc, argv)
+- char *argv[];
++int modecmd(int argc, char *argv[])
+ {
+ register struct modes *p;
+ char *sep;
+@@ -234,18 +241,17 @@ modecmd(argc, argv)
+ return 0;
+ }
+
+-setbinary(argc, argv)
+-char *argv[];
+-{ setmode("octet");
++int setbinary(int argc, char *argv[])
++{
++ setmode("octet");
+ }
+
+-setascii(argc, argv)
+-char *argv[];
+-{ setmode("netascii");
+-}
++int setascii(int argc, char *argv[])
++{
++ setmode("netascii");
++ }
+
+-setmode(newmode)
+-char *newmode;
++void setmode(char *newmode)
+ {
+ strcpy(mode, newmode);
+ if (verbose)
+@@ -256,8 +262,7 @@ char *newmode;
+ * Send file(s).
+ */
+
+-put(argc, argv)
+- char *argv[];
++int put(int argc, char *argv[])
+ {
+ int fd;
+ register int n;
+@@ -286,8 +291,7 @@ put(argc, argv)
+ return 0;
+ }
+
+-putusage(s)
+- char *s;
++int putusage(char *s)
+ {
+ printf("usage: %s file [linksys pass] (you must be connected)\n", s);
+ return 0;
+@@ -296,8 +300,7 @@ putusage(s)
+ /*
+ * Receive file(s).
+ */
+-get(argc, argv)
+- char *argv[];
++int get(int argc, char *argv[])
+ {
+ int fd;
+ register int n;
+@@ -327,16 +330,15 @@ get(argc, argv)
+ return 0;
+ }
+
+-getusage(s)
+-char * s;
++int getusage(char *s)
+ {
+ printf("usage: %s file [linksys pass] (you must be connected)\n", s);
++ return 0;
+ }
+
+ int rexmtval = TIMEOUT;
+
+-setrexmt(argc, argv)
+- char *argv[];
++int setrexmt(int argc, char *argv[])
+ {
+ int t;
+
+@@ -357,12 +359,12 @@ setrexmt(argc, argv)
+ printf("%d: bad value\n", t);
+ else
+ rexmtval = t;
++ return 0;
+ }
+
+ int maxtimeout = 5 * TIMEOUT;
+
+-settimeout(argc, argv)
+- char *argv[];
++int settimeout(int argc, char *argv[])
+ {
+ int t;
+
+@@ -383,10 +385,10 @@ settimeout(argc, argv)
+ printf("%d: bad value\n", t);
+ else
+ maxtimeout = t;
++ return 0;
+ }
+
+-status(argc, argv)
+- char *argv[];
++int status(int argc, char *argv[])
+ {
+ if (connected)
+ printf("Connected to %s.\n", hostname);
+@@ -396,6 +398,7 @@ status(argc, argv)
+ verbose ? "on" : "off", trace ? "on" : "off");
+ printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n",
+ rexmtval, maxtimeout);
++ return 0;
+ }
+
+ void intr(int sig)
+@@ -408,8 +411,7 @@ void intr(int sig)
+ /*
+ * Command parser.
+ */
+-command(top)
+- int top;
++int command(int top)
+ {
+ register struct cmd *c;
+
+@@ -438,11 +440,10 @@ command(top)
+ }
+ (*c->handler)(margc, margv);
+ }
++ return 0;
+ }
+
+-struct cmd *
+-getcmd(name)
+- register char *name;
++struct cmd *getcmd(register char *name)
+ {
+ register char *p, *q;
+ register struct cmd *c, *found;
+@@ -473,7 +474,7 @@ getcmd(name)
+ /*
+ * Slice a string up into argc/argv.
+ */
+-makeargv()
++void makeargv()
+ {
+ register char *cp;
+ register char **argp = margv;
+@@ -496,7 +497,7 @@ makeargv()
+ }
+
+ /*VARARGS*/
+-quit()
++int quit()
+ {
+ exit(0);
+ }
+@@ -504,9 +505,7 @@ quit()
+ /*
+ * Help command.
+ */
+-help(argc, argv)
+- int argc;
+- char *argv[];
++int help(int argc, char *argv[])
+ {
+ register struct cmd *c;
+
+@@ -527,24 +526,26 @@ help(argc, argv)
+ else
+ printf("%s\n", c->help);
+ }
++ return 0;
+ }
+
+ /*VARARGS*/
+-settrace()
++int settrace()
+ {
+ trace = !trace;
+ printf("Packet tracing %s.\n", trace ? "on" : "off");
++ return 0;
+ }
+
+ /*VARARGS*/
+-setverbose()
++int setverbose()
+ {
+ verbose = !verbose;
+ printf("Verbose mode %s.\n", verbose ? "on" : "off");
++ return 0;
+ }
+
+-setblocksize(argc, argv)
+- char *argv[];
++int setblocksize(int argc, char *argv[])
+ {
+ int t;
+
+@@ -565,8 +566,9 @@ setblocksize(argc, argv)
+ printf("%d: bad value\n", t);
+ else
+ segsize = t;
++ return 0;
+ }
+-banner() {
++int banner() {
+ printf("TJ Shelton\tredsand [at] redsand.net\n");
+ printf("Mike Lynn\tabaddon [at] 802.11ninja.net\n");
+ printf("Linksys TFTP Client for *BSD/Linux\tThe Firmware gets sexier\n");
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftp.patch b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftp.patch
new file mode 100644
index 0000000000..e9a77ac722
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftp.patch
@@ -0,0 +1,157 @@
+--- linksys-tftp-1.2.1/tftp.c 2024-04-16 08:27:50.328449885 -0700
++++ linksys-tftp-1.2.1/tftp.c 2024-04-15 21:26:36.259371211 -0700
+@@ -47,6 +47,13 @@ extern int rexmtval;
+ extern int maxtimeout;
+ extern int segsize;
+
++/* functions from tftpsubs */
++extern int readit(FILE *file, struct tftphdr **dpp, int convert);
++extern int read_ahead(FILE *file, int convert);
++extern int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert);
++extern int write_behind( FILE *file, int convert);
++extern int synchnet(int f);
++
+ #define PKTSIZE (1432+4) /* SEGSIZE+4 */
+ char ackbuf[PKTSIZE];
+ int timeout;
+@@ -57,6 +64,19 @@ jmp_buf timeoutbuf;
+ #define OACK 6
+ #endif
+
++/* functions declared herein */
++void timer(int sig);
++void parseoack(char *cp, int sz);
++void sendfile(int fd, char *name, char *mode, char *linkpass);
++void recvfile(int fd, char *name, char *mode, char *linkpass);
++int makerequest(int request, char *name, struct tftphdr *tp, char *mode, char *linkpass);
++void nak(int error);
++void topts(char *cp, int sz);
++void tpacket(char *s, struct tftphdr *tp, int n);
++void startclock();
++void stopclock();
++void printstats(char *direction, unsigned long amount);
++
+ void timer(int sig)
+ {
+
+@@ -72,9 +92,7 @@ void timer(int sig)
+ /*
+ * Parse an OACK package and set blocksize accordingly
+ */
+-parseoack(cp, sz)
+- char *cp;
+- int sz;
++void parseoack(char *cp, int sz)
+ {
+ int n;
+
+@@ -106,11 +124,7 @@ parseoack(cp, sz)
+ /*
+ * Send the requested file.
+ */
+-sendfile(fd, name, mode, linkpass)
+- int fd;
+- char *name;
+- char *mode;
+- char *linkpass;
++void sendfile(int fd, char *name, char *mode, char *linkpass)
+ {
+ register struct tftphdr *ap; /* data and ack packets */
+ struct tftphdr *r_init(), *dp;
+@@ -211,7 +225,7 @@ send_data:
+ printf("protocol violation\n");
+ longjmp(toplevel, -1);
+ }
+- parseoack(&ap->th_stuff, n - 2);
++ parseoack(ap->th_stuff, n - 2);
+ break;
+ }
+ }
+@@ -231,11 +245,7 @@ abort:
+ /*
+ * Receive a file.
+ */
+-recvfile(fd, name, mode, linkpass)
+- int fd;
+- char *name;
+- char *mode;
+- char *linkpass;
++void recvfile(int fd, char *name, char *mode, char *linkpass)
+ {
+ register struct tftphdr *ap;
+ struct tftphdr *dp, *w_init();
+@@ -336,7 +346,7 @@ send_ack:
+ longjmp(toplevel, -1);
+ }
+ waitforoack = 0;
+- parseoack(&dp->th_stuff, n - 2);
++ parseoack(dp->th_stuff, n - 2);
+ ap->th_opcode = htons((u_short)ACK);
+ ap->th_block = htons(0);
+ size = 4;
+@@ -362,10 +372,7 @@ abort:
+ printstats("Received", amount);
+ }
+
+-makerequest(request, name, tp, mode, linkpass)
+- int request;
+- char *name, *mode, *linkpass;
+- struct tftphdr *tp;
++int makerequest(int request, char *name, struct tftphdr *tp, char *mode, char *linkpass)
+ {
+ register char *cp;
+
+@@ -404,8 +411,7 @@ struct errmsg {
+ * standard TFTP codes, or a UNIX errno
+ * offset by 100.
+ */
+-nak(error)
+- int error;
++void nak(int error)
+ {
+ register struct tftphdr *tp;
+ int length;
+@@ -431,9 +437,7 @@ nak(error)
+ perror("nak");
+ }
+
+-topts(cp, sz)
+- char *cp;
+- int sz;
++void topts(char *cp, int sz)
+ {
+ int n, i = 0;
+
+@@ -454,10 +458,7 @@ topts(cp, sz)
+ }
+ }
+
+-tpacket(s, tp, n)
+- char *s;
+- struct tftphdr *tp;
+- int n;
++void tpacket(char *s, struct tftphdr *tp, int n)
+ {
+ static char *opcodes[] =
+ { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR", "OACK" };
+@@ -505,17 +506,15 @@ struct timeval tstart;
+ struct timeval tstop;
+ struct timezone zone;
+
+-startclock() {
++void startclock() {
+ gettimeofday(&tstart, &zone);
+ }
+
+-stopclock() {
++void stopclock() {
+ gettimeofday(&tstop, &zone);
+ }
+
+-printstats(direction, amount)
+-char *direction;
+-unsigned long amount;
++void printstats(char *direction, unsigned long amount)
+ {
+ double delta;
+ /* compute delta in 1/10's second units */
diff --git a/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch
new file mode 100644
index 0000000000..96149667a4
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp-1.2.1-stdc-tftpsubs.patch
@@ -0,0 +1,111 @@
+--- linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:27:50.310449884 -0700
++++ linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:53:26.084521570 -0700
+@@ -38,6 +38,7 @@ static char sccsid[] = "@(#)tftpsubs.c 5
+ // modified tftp header to include pass
+ #include <tftp.h>
+ #include <stdio.h>
++#include <unistd.h>
+
+ #define PKTSIZE (1432+4) /* SEGSIZE+4 */ /* should be moved to tftp.h */
+
+@@ -60,14 +61,22 @@ static int current; /* index of buff
+ int newline = 0; /* fillbuf: in middle of newline expansion */
+ int prevchar = -1; /* putbuf: previous char (cr check) */
+
+-struct tftphdr *rw_init();
++/* functions declared in this program */
++struct tftphdr *w_init();
++struct tftphdr *r_init();
++struct tftphdr *rw_init(int x);
++int readit(FILE *file, struct tftphdr **dpp, int convert);
++int read_ahead(FILE *file, int convert);
++int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert);
++int write_behind( FILE *file, int convert);
++int synchnet(int f);
+
+ struct tftphdr *w_init() { return rw_init(0); } /* write-behind */
+ struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */
+
+-struct tftphdr *
+-rw_init(x) /* init for either read-ahead or write-behind */
+-int x; /* zero for write-behind, one for read-head */
++/* init for either read-ahead or write-behind */
++struct tftphdr *rw_init(int x)
++ /* zero for write-behind, one for read-head */
+ {
+ newline = 0; /* init crlf flag */
+ prevchar = -1;
+@@ -82,10 +91,8 @@ int x; /* zero for writ
+ /* Have emptied current buffer by sending to net and getting ack.
+ Free it and return next buffer filled with data.
+ */
+-readit(file, dpp, convert)
+- FILE *file; /* file opened for read */
+- struct tftphdr **dpp;
+- int convert; /* if true, convert to ascii */
++int readit(FILE *file, struct tftphdr **dpp, int convert)
++ /* file opened for read if true, convert to ascii */
+ {
+ struct bf *b;
+
+@@ -104,9 +111,9 @@ readit(file, dpp, convert)
+ * fill the input buffer, doing ascii conversions if requested
+ * conversions are lf -> cr,lf and cr -> cr, nul
+ */
+-read_ahead(file, convert)
+- FILE *file; /* file opened for read */
+- int convert; /* if true, convert to ascii */
++int read_ahead(FILE *file, int convert)
++ /* file opened for read */
++ /* if true, convert to ascii */
+ {
+ register int i;
+ register char *p;
+@@ -154,16 +161,14 @@ read_ahead(file, convert)
+ *p++ = c;
+ }
+ b->counter = (int)(p - dp->th_data);
++ return 0;
+ }
+
+ /* Update count associated with the buffer, get new buffer
+ from the queue. Calls write_behind only if next buffer not
+ available.
+ */
+-writeit(file, dpp, ct, convert)
+- FILE *file;
+- struct tftphdr **dpp;
+- int convert;
++int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert)
+ {
+ bfs[current].counter = ct; /* set size of data to write */
+ current = !current; /* switch to other buffer */
+@@ -180,9 +185,7 @@ writeit(file, dpp, ct, convert)
+ * Note spec is undefined if we get CR as last byte of file or a
+ * CR followed by anything else. In this case we leave it alone.
+ */
+-write_behind(file, convert)
+- FILE *file;
+- int convert;
++int write_behind( FILE *file, int convert)
+ {
+ char *buf;
+ int count;
+@@ -238,9 +241,8 @@ skipit:
+ * when trace is active).
+ */
+
+-int
+-synchnet(f)
+-int f; /* socket to flush */
++int synchnet(int f)
++ /* socket to flush */
+ {
+ int i, j = 0;
+ char rbuf[PKTSIZE];
+@@ -258,4 +260,5 @@ int f; /* socket to flush */
+ return(j);
+ }
+ }
++ return 0; /* should never get here */
+ }
diff --git a/network/linksys-tftp/linksys-tftp.SlackBuild b/network/linksys-tftp/linksys-tftp.SlackBuild
new file mode 100644
index 0000000000..7c2b9b8cf3
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp.SlackBuild
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# Slackware build script for linksys-tftp
+
+# Copyright 2019 Richard Narron, California
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# 20231030 bkw: modified by SlackBuilds.org, BUILD=4:
+# - fix README.Slackware permission.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=linksys-tftp
+VERSION=${VERSION:-1.2.1}
+BUILD=${BUILD:-5}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.*z*
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} + -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} +
+
+# patches thanks to Gentoo
+(echo " " && cat $CWD/linksys-tftp-1.2.1-r1-Makefile.patch) | patch -b -p1
+(echo " " && cat $CWD/linksys-tftp-1.2.1-r1-clang.patch) | patch -b -p1
+(echo " " && cat $CWD/linksys-tftp-1.2.1-r1-fno-common.patch) | patch -b -p1
+(echo " " && cat $CWD/linksys-tftp-1.2.1-r1-header.patch) | patch -b -p1
+
+# patches from aaazen to convert K & R to Standard C
+(echo " " && cat $CWD/linksys-tftp-1.2.1-stdc-tftpsubs.patch) | patch -b -p1
+(echo " " && cat $CWD/linksys-tftp-1.2.1-stdc-tftp.patch) | patch -b -p1
+(echo " " && cat $CWD/linksys-tftp-1.2.1-stdc-main.patch) | patch -b -p1
+
+CFLAGS="$SLKCFLAGS -fcommon" \
+ make
+
+install -D -m755 -t $PKG/usr/bin/ linksys-tftp
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.slackware
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/network/linksys-tftp/linksys-tftp.info b/network/linksys-tftp/linksys-tftp.info
new file mode 100644
index 0000000000..7de9c49369
--- /dev/null
+++ b/network/linksys-tftp/linksys-tftp.info
@@ -0,0 +1,10 @@
+PRGNAM="linksys-tftp"
+VERSION="1.2.1"
+HOMEPAGE="https://www.redsand.net/solutions/linksys_tftp.html"
+DOWNLOAD="https://distfiles.gentoo.org/distfiles/82/linksys-tftp-1.2.1.tar.bz2"
+MD5SUM="e201eab05d2344b32f8fdf96462c27a4"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Richard Narron"
+EMAIL="richard@aaazen.com"
diff --git a/network/linksys-tftp/slack-desc b/network/linksys-tftp/slack-desc
new file mode 100644
index 0000000000..52b24ab204
--- /dev/null
+++ b/network/linksys-tftp/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+linksys-tftp: linksys-tftp (tftp client for Linksys routers requiring a password)
+linksys-tftp:
+linksys-tftp: This is a BSD tftp client for Linksys routers that need a password
+linksys-tftp: for tftp firmware installation such as the BEFW11, WRT54G and WRT54GL
+linksys-tftp:
+linksys-tftp:
+linksys-tftp:
+linksys-tftp:
+linksys-tftp:
+linksys-tftp:
+linksys-tftp: