From 6733fb97c56cefb94767a6b38c59bc77d967c921 Mon Sep 17 00:00:00 2001 From: Richard Narron Date: Fri, 1 Apr 2022 11:28:35 +0700 Subject: network/linksys-tftp: Add more patches. Signed-off-by: Willy Sudiarto Raharjo --- network/linksys-tftp/README | 4 +- .../linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch | 196 +++++++++++++++++++++ .../linksys-tftp-1.2.1-r1-fno-common.patch | 11 ++ network/linksys-tftp/linksys-tftp.SlackBuild | 10 +- network/linksys-tftp/linksys-tftp.info | 4 +- 5 files changed, 217 insertions(+), 8 deletions(-) create mode 100644 network/linksys-tftp/linksys-tftp-1.2.1-r1-clang.patch create mode 100644 network/linksys-tftp/linksys-tftp-1.2.1-r1-fno-common.patch (limited to 'network/linksys-tftp') diff --git a/network/linksys-tftp/README b/network/linksys-tftp/README index d2132b7f0168..3a11f6545946 100644 --- a/network/linksys-tftp/README +++ b/network/linksys-tftp/README @@ -8,12 +8,12 @@ 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-wrt 192.168.1.1 +#linksys-tftp 192.168.1.1 linksys-tftp>verbose linksys-tftp>binary linksys-tftp>blocksize 512 linksys-tftp>rexmt 1 -linksys-tftp>timeout 30 +linksys-tftp>timeout 120 linksys-tftp>trace linksys-tftp>put WRT54G_WRT54GL.bin admin linksys-tftp>quit 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 000000000000..94ccee0c9eef --- /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 000000000000..a63977619845 --- /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.SlackBuild b/network/linksys-tftp/linksys-tftp.SlackBuild index b6a51cdd7463..7af5722f6f11 100644 --- a/network/linksys-tftp/linksys-tftp.SlackBuild +++ b/network/linksys-tftp/linksys-tftp.SlackBuild @@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=linksys-tftp VERSION=${VERSION:-1.2.1} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -56,7 +56,7 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +tar xvf $CWD/$PRGNAM-$VERSION.tar.*z* cd $PRGNAM-$VERSION chown -R root:root . find -L . \ @@ -66,8 +66,10 @@ find -L . \ -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-header.patch) | patch -b -p1 +(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 CFLAGS="$SLKCFLAGS -fcommon" \ make diff --git a/network/linksys-tftp/linksys-tftp.info b/network/linksys-tftp/linksys-tftp.info index 1e2c9be8ff9c..59caa9a0de60 100644 --- a/network/linksys-tftp/linksys-tftp.info +++ b/network/linksys-tftp/linksys-tftp.info @@ -1,8 +1,8 @@ PRGNAM="linksys-tftp" VERSION="1.2.1" HOMEPAGE="https://www.redsand.net/solutions/linksys_tftp.html" -DOWNLOAD="https://www.redsand.net/solutions/linksys-tftp-1.2.1.tar.gz" -MD5SUM="f536f778dcbcb4a65838042ca0a2a454" +DOWNLOAD="https://distfiles.gentoo.org/distfiles/linksys-tftp-1.2.1.tar.bz2" +MD5SUM="e201eab05d2344b32f8fdf96462c27a4" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -- cgit v1.2.3