diff options
author | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
---|---|---|
committer | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
commit | 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 (patch) | |
tree | b9c0f3c43aebba2fcfef777592d0add39f2072f4 /package/atftp |
Initial import
Diffstat (limited to 'package/atftp')
-rw-r--r-- | package/atftp/Config.in | 25 | ||||
-rw-r--r-- | package/atftp/Makefile | 32 | ||||
-rw-r--r-- | package/atftp/ipkg/atftp.control | 5 | ||||
-rw-r--r-- | package/atftp/ipkg/atftpd.control | 5 | ||||
-rwxr-xr-x | package/atftp/ipkg/files/postinst | 8 | ||||
-rw-r--r-- | package/atftp/patches/patch-stats_c | 14 | ||||
-rw-r--r-- | package/atftp/patches/patch-test_Makefile | 152 | ||||
-rw-r--r-- | package/atftp/patches/patch-tftp_c | 83 | ||||
-rw-r--r-- | package/atftp/patches/patch-tftp_def_c | 11 | ||||
-rw-r--r-- | package/atftp/patches/patch-tftp_def_h | 13 | ||||
-rw-r--r-- | package/atftp/patches/patch-tftp_file_c | 64 | ||||
-rw-r--r-- | package/atftp/patches/patch-tftpd_c | 20 |
12 files changed, 432 insertions, 0 deletions
diff --git a/package/atftp/Config.in b/package/atftp/Config.in new file mode 100644 index 000000000..11e1c02b2 --- /dev/null +++ b/package/atftp/Config.in @@ -0,0 +1,25 @@ +#menu "atftp............................. TFTP implementation" + +config ADK_COMPILE_ATFTP + tristate + default n + depends ADK_PACKAGE_ATFTP || ADK_PACKAGE_ATFTPD + select ADK_PACKAGE_LIBREADLINE + +config ADK_PACKAGE_ATFTP + prompt "atftp............................. TFTP client" + tristate + default n + select ADK_COMPILE_ATFTP + help + TFTP client + +config ADK_PACKAGE_ATFTPD + prompt "atftpd............................ TFTP server" + tristate + default n + select ADK_COMPILE_ATFTP + help + TFTP server + +#endmenu diff --git a/package/atftp/Makefile b/package/atftp/Makefile new file mode 100644 index 000000000..ac49f0794 --- /dev/null +++ b/package/atftp/Makefile @@ -0,0 +1,32 @@ +# $Id$ +#- +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= atftp +PKG_VERSION:= 0.7 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 3b27365772d918050b2251d98a9c7c82 +MASTER_SITES:= ftp://ftp.mamalinux.com/pub/atftp/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,ATFTP,atftp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) +$(eval $(call PKG_template,ATFTPD,atftpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +MAKE_FLAGS+= CFLAGS="${TCFLAGS} -Wall -D_REENTRANT -fno-inline" +CONFIGURE_STYLE= gnu +BUILD_STYLE= auto +INSTALL_STYLE= auto + +post-install: + # atftp client + $(INSTALL_DIR) $(IDIR_ATFTP)/usr/bin + $(INSTALL_BIN) $(WRKBUILD)/atftp $(IDIR_ATFTP)/usr/bin + # atftp server + $(INSTALL_DIR) $(IDIR_ATFTPD)/usr/sbin + $(INSTALL_BIN) $(WRKBUILD)/atftpd $(IDIR_ATFTPD)/usr/sbin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/atftp/ipkg/atftp.control b/package/atftp/ipkg/atftp.control new file mode 100644 index 000000000..83b1858c4 --- /dev/null +++ b/package/atftp/ipkg/atftp.control @@ -0,0 +1,5 @@ +Package: atftp +Priority: optional +Section: net +Description: tftp client +Depends: libreadline, libncurses diff --git a/package/atftp/ipkg/atftpd.control b/package/atftp/ipkg/atftpd.control new file mode 100644 index 000000000..94f49f3f7 --- /dev/null +++ b/package/atftp/ipkg/atftpd.control @@ -0,0 +1,5 @@ +Package: atftpd +Priority: optional +Section: net +Description: tftp server +Depends: libreadline, libpcre diff --git a/package/atftp/ipkg/files/postinst b/package/atftp/ipkg/files/postinst new file mode 100755 index 000000000..35a2c3b36 --- /dev/null +++ b/package/atftp/ipkg/files/postinst @@ -0,0 +1,8 @@ +#!/usr/bin/env mksh +grep -q '^tftp[[:space:]]*69/tcp' ${IPKG_INSTROOT}/etc/services 2>/dev/null +if [ $? -ne 0 ]; then + echo "tftp 69/tcp" >>${IPKG_INSTROOT}/etc/services + echo "tftp 69/udp" >>${IPKG_INSTROOT}/etc/services + echo "tftp-mcast 1758/tcp" >>${IPKG_INSTROOT}/etc/services + echo "tftp-mcast 1758/udp" >>${IPKG_INSTROOT}/etc/services +fi diff --git a/package/atftp/patches/patch-stats_c b/package/atftp/patches/patch-stats_c new file mode 100644 index 000000000..290b53292 --- /dev/null +++ b/package/atftp/patches/patch-stats_c @@ -0,0 +1,14 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/stats.c 2002-03-27 04:02:12.000000000 +0100 ++++ atftp-0.7/stats.c 2008-10-09 12:08:47.000000000 +0200 +@@ -157,8 +157,8 @@ void stats_print(void) + + logger(LOG_INFO, " Load measurements:"); + logger(LOG_INFO, " User: %8.3fs Sys:%8.3fs", +- (double)(s_stats.tms.tms_utime) / CLK_TCK, +- (double)(s_stats.tms.tms_stime) / CLK_TCK); ++ (double)(s_stats.tms.tms_utime) / CLOCKS_PER_SEC, ++ (double)(s_stats.tms.tms_stime) / CLOCKS_PER_SEC); + logger(LOG_INFO, " Total:%8.3fs CPU:%8.3f%%", + (double)(tmp.tv_sec + tmp.tv_usec * 1e-6), + (double)(s_stats.tms.tms_utime + s_stats.tms.tms_stime) / diff --git a/package/atftp/patches/patch-test_Makefile b/package/atftp/patches/patch-test_Makefile new file mode 100644 index 000000000..097b3a5e3 --- /dev/null +++ b/package/atftp/patches/patch-test_Makefile @@ -0,0 +1,152 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/test/Makefile 2004-03-16 02:53:37.000000000 +0100 ++++ atftp-0.7/test/Makefile 2008-10-09 11:58:55.000000000 +0200 +@@ -13,9 +13,9 @@ + # PARTICULAR PURPOSE. + + +-srcdir = . +-top_srcdir = .. +- ++srcdir = /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/test ++top_srcdir = /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7 ++VPATH = /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/test + pkgdatadir = $(datadir)/atftp + pkglibdir = $(libdir)/atftp + pkgincludedir = $(includedir)/atftp +@@ -33,7 +33,7 @@ POST_INSTALL = : + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : +-host_triplet = i686-pc-linux-gnu ++host_triplet = i586-pc-linux-gnu + subdir = test + DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +@@ -46,24 +46,24 @@ CONFIG_CLEAN_FILES = + SOURCES = + DIST_SOURCES = + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +-ACLOCAL = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run aclocal-1.8 +-AMDEP_FALSE = # +-AMDEP_TRUE = +-AMTAR = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run tar +-AUTOCONF = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run autoconf +-AUTOHEADER = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run autoheader +-AUTOMAKE = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run automake-1.8 ++ACLOCAL = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run aclocal-1.8 ++AMDEP_FALSE = ++AMDEP_TRUE = # ++AMTAR = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run tar ++AUTOCONF = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run autoconf ++AUTOHEADER = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run autoheader ++AUTOMAKE = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run automake-1.8 + AWK = gawk +-CC = gcc +-CCDEPMODE = depmode=gcc3 ++CC = /home/wbrodkorb/adk-glibc/cross_x86/host/bin/i586-linux-gnu-gcc ++CCDEPMODE = depmode=none + CFLAGS = -g -Wall -D_REENTRANT -O2 +-CPP = gcc -E +-CPPFLAGS = ++CPP = /home/wbrodkorb/adk-glibc/cross_x86/host/bin/i586-linux-gnu-gcc -E ++CPPFLAGS = -isystem /home/wbrodkorb/adk-glibc/cross_x86/target/include -isystem /home/wbrodkorb/adk-glibc/cross_x86/target/usr/include -DNDEBUG + CYGPATH_W = echo + DEFS = -DHAVE_CONFIG_H + DEPDIR = .deps +-ECHO_C = +-ECHO_N = -n ++ECHO_C = \c ++ECHO_N = + ECHO_T = + EGREP = grep -E + EXEEXT = +@@ -71,17 +71,17 @@ INSTALL_DATA = ${INSTALL} -m 644 + INSTALL_PROGRAM = ${INSTALL} + INSTALL_SCRIPT = ${INSTALL} + INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +-ISODATE = 2004-03-15 +-LDFLAGS = ++ISODATE = 2008-10-09 ++LDFLAGS = -Wl,-O2 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbrodkorb/adk-glibc/cross_x86/target/usr/lib -L/home/wbrodkorb/adk-glibc/cross_x86/target/lib -L/home/wbrodkorb/adk-glibc/cross_x86/target/usr/lib + LIBOBJS = +-LIBPCRE = -lpcre ++LIBPCRE = + LIBPTHREAD = -lpthread + LIBREADLINE = -lreadline + LIBS = +-LIBTERMCAP = +-LIBWRAP = -lnsl -lwrap ++LIBTERMCAP = -lncurses ++LIBWRAP = + LTLIBOBJS = +-MAKEINFO = ${SHELL} /home/jp/projets/sources/atftp/atftp-0.7/atftp/missing --run makeinfo ++MAKEINFO = ${SHELL} /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/missing --run makeinfo + OBJEXT = o + PACKAGE = atftp + PACKAGE_BUGREPORT = +@@ -90,46 +90,46 @@ PACKAGE_STRING = + PACKAGE_TARNAME = + PACKAGE_VERSION = + PATH_SEPARATOR = : +-PLATFORM = pc-i686-linux-gnu ++PLATFORM = pc-i586-linux-gnu + SET_MAKE = + SHELL = /bin/sh +-STRIP = ++STRIP = i586-linux-strip + VERSION = 0.7 +-ac_ct_CC = gcc ++ac_ct_CC = + ac_ct_STRIP = +-am__fastdepCC_FALSE = # +-am__fastdepCC_TRUE = ++am__fastdepCC_FALSE = ++am__fastdepCC_TRUE = # + am__include = include + am__leading_dot = . + am__quote = + bindir = ${exec_prefix}/bin + build = i686-pc-linux-gnu +-build_alias = ++build_alias = i686-linux-gnu + build_cpu = i686 + build_os = linux-gnu + build_vendor = pc +-datadir = ${prefix}/share ++datadir = /usr/share + exec_prefix = ${prefix} +-host = i686-pc-linux-gnu +-host_alias = +-host_cpu = i686 ++host = i586-pc-linux-gnu ++host_alias = i586-linux ++host_cpu = i586 + host_os = linux-gnu + host_vendor = pc + includedir = ${prefix}/include + infodir = ${prefix}/info +-install_sh = /home/jp/projets/sources/atftp/atftp-0.7/atftp/install-sh ++install_sh = /home/wbrodkorb/adk-glibc/build_x86/w-atftp-0.7-2/atftp-0.7/install-sh + libdir = ${exec_prefix}/lib +-libexecdir = ${exec_prefix}/libexec +-localstatedir = ${prefix}/var +-mandir = ${prefix}/man ++libexecdir = /usr/lib ++localstatedir = /var ++mandir = /usr/share/man + mkdir_p = mkdir -p -- . + oldincludedir = /usr/include +-prefix = /usr/local +-program_transform_name = s,x,x, ++prefix = /usr ++program_transform_name = s,$$,,;s,^,, + sbindir = ${exec_prefix}/sbin + sharedstatedir = ${prefix}/com +-sysconfdir = ${prefix}/etc +-target_alias = ++sysconfdir = /etc ++target_alias = i586-linux + TESTS = test.sh + CLEANFILES = *~ + all: all-am diff --git a/package/atftp/patches/patch-tftp_c b/package/atftp/patches/patch-tftp_c new file mode 100644 index 000000000..392302bd7 --- /dev/null +++ b/package/atftp/patches/patch-tftp_c @@ -0,0 +1,83 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/tftp.c 2004-03-16 00:55:56.000000000 +0100 ++++ atftp-0.7/tftp.c 2008-10-09 11:58:48.000000000 +0200 +@@ -409,7 +409,7 @@ int process_cmd(int argc, char **argv) + int set_peer(int argc, char **argv) + { + struct hostent *host; /* for host name lookup */ +- struct servent *sp; /* server entry for tftp service */ ++ int port = htons(69); + + /* sanity check */ + if ((argc < 2) || (argc > 3)) +@@ -418,13 +418,6 @@ int set_peer(int argc, char **argv) + return ERR; + } + +- /* get the server entry */ +- sp = getservbyname("tftp", "udp"); +- if (sp == 0) { +- fprintf(stderr, "tftp: udp/tftp, unknown service.\n"); +- return ERR; +- } +- + /* look up the host */ + host = gethostbyname(argv[1]); + /* if valid, update s_inn structure */ +@@ -437,7 +430,7 @@ int set_peer(int argc, char **argv) + Strncpy(data.hostname, host->h_name, + sizeof(data.hostname)); + data.hostname[sizeof(data.hostname)-1] = 0; +- data.sa_peer.sin_port = sp->s_port; ++ data.sa_peer.sin_port = port; + } + else + { +@@ -448,17 +441,17 @@ int set_peer(int argc, char **argv) + /* get the server port */ + if (argc == 3) + { +- sp->s_port = htons(atoi(argv[2])); +- if (sp->s_port < 0) ++ port = htons(atoi(argv[2])); ++ if (port < 0) + { + fprintf(stderr, "%s: bad port number.\n", argv[2]); + data.connected = 0; + return ERR; + } +- data.sa_peer.sin_port = sp->s_port; ++ data.sa_peer.sin_port = port; + } + /* copy port number to data structure */ +- data.port = ntohs(sp->s_port); ++ data.port = ntohs(port); + + data.connected = 1; + return OK; +@@ -974,6 +967,7 @@ int tftp_cmd_line_options(int argc, char + { "tftp-timeout", 1, NULL, 'T'}, + { "mode", 1, NULL, 'M'}, + { "option", 1, NULL, 'O'}, ++ { "retry", 1, NULL, 'R'}, + #if 1 + { "timeout", 1, NULL, 't'}, + { "blksize", 1, NULL, 'b'}, +@@ -993,11 +987,16 @@ int tftp_cmd_line_options(int argc, char + }; + + /* Support old argument until 0.8 */ +- while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm", ++ while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:", + options, &option_index)) != EOF) + { + switch (c) + { ++ case 'R': ++ snprintf(string, sizeof(string), "option retry %s", optarg); ++ make_arg(string, &ac, &av); ++ process_cmd(ac, av); ++ break; + case 'g': + interactive = 0; + if ((action == PUT) || (action == MGET)) diff --git a/package/atftp/patches/patch-tftp_def_c b/package/atftp/patches/patch-tftp_def_c new file mode 100644 index 000000000..dc94e8c10 --- /dev/null +++ b/package/atftp/patches/patch-tftp_def_c @@ -0,0 +1,11 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/tftp_def.c 2004-02-13 04:16:09.000000000 +0100 ++++ atftp-0.7/tftp_def.c 2008-10-09 11:58:48.000000000 +0200 +@@ -37,6 +37,7 @@ struct tftp_opt tftp_default_options[OPT + { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */ + { "blksize", "512", 0, 1 }, /* This is the default option */ + { "multicast", "", 0, 1 }, /* structure */ ++ { "retry", "5", 0, 1 }, + { "", "", 0, 0} + }; + diff --git a/package/atftp/patches/patch-tftp_def_h b/package/atftp/patches/patch-tftp_def_h new file mode 100644 index 000000000..cd602d978 --- /dev/null +++ b/package/atftp/patches/patch-tftp_def_h @@ -0,0 +1,13 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/tftp_def.h 2004-02-13 04:16:09.000000000 +0100 ++++ atftp-0.7/tftp_def.h 2008-10-09 11:58:48.000000000 +0200 +@@ -40,7 +40,8 @@ + #define OPT_TIMEOUT 3 + #define OPT_BLKSIZE 4 + #define OPT_MULTICAST 5 +-#define OPT_NUMBER 7 ++#define OPT_RETRY 6 ++#define OPT_NUMBER 8 + + #define OPT_SIZE 12 + #define VAL_SIZE MAXLEN diff --git a/package/atftp/patches/patch-tftp_file_c b/package/atftp/patches/patch-tftp_file_c new file mode 100644 index 000000000..b071b1cf7 --- /dev/null +++ b/package/atftp/patches/patch-tftp_file_c @@ -0,0 +1,64 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/tftp_file.c 2004-02-13 04:16:09.000000000 +0100 ++++ atftp-0.7/tftp_file.c 2008-10-09 11:58:48.000000000 +0200 +@@ -123,6 +123,7 @@ int tftp_receive_file(struct client_data + struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer; + FILE *fp = NULL; /* the local file pointer */ + int number_of_timeout = 0; ++ int num_retry = atoi(data->tftp_options[OPT_RETRY].value); + int convert = 0; /* if true, do netascii convertion */ + + int oacks = 0; /* count OACK for improved error checking */ +@@ -141,7 +142,7 @@ int tftp_receive_file(struct client_data + + int prev_block_number = 0; /* needed to support netascii convertion */ + int temp = 0; +- ++ + data->file_size = 0; + tftp_cancel = 0; + from.sin_addr.s_addr = 0; +@@ -288,7 +289,7 @@ int tftp_receive_file(struct client_data + case GET_TIMEOUT: + number_of_timeout++; + fprintf(stderr, "timeout: retrying...\n"); +- if (number_of_timeout > NB_OF_RETRY) ++ if ((num_retry > 0) && (number_of_timeout > num_retry)) + state = S_ABORT; + else + state = timeout_state; +@@ -325,7 +326,7 @@ int tftp_receive_file(struct client_data + number_of_timeout++; + fprintf(stderr, "tftp: packet discard <%s:%d>.\n", + inet_ntoa(from.sin_addr), ntohs(from.sin_port)); +- if (number_of_timeout > NB_OF_RETRY) ++ if ((num_retry > 0) && (number_of_timeout > num_retry)) + state = S_ABORT; + break; + case ERR: +@@ -614,6 +615,7 @@ int tftp_send_file(struct client_data *d + struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer; + FILE *fp; /* the local file pointer */ + int number_of_timeout = 0; ++ int num_retry = atoi(data->tftp_options[OPT_RETRY].value); + struct stat file_stat; + int convert = 0; /* if true, do netascii convertion */ + char string[MAXLEN]; +@@ -751,7 +753,7 @@ int tftp_send_file(struct client_data *d + case GET_TIMEOUT: + number_of_timeout++; + fprintf(stderr, "timeout: retrying...\n"); +- if (number_of_timeout > NB_OF_RETRY) ++ if ((num_retry > 0) && (number_of_timeout > num_retry)) + state = S_ABORT; + else + state = timeout_state; +@@ -797,7 +799,7 @@ int tftp_send_file(struct client_data *d + number_of_timeout++; + fprintf(stderr, "tftp: packet discard <%s:%d>.\n", + inet_ntoa(from.sin_addr), ntohs(from.sin_port)); +- if (number_of_timeout > NB_OF_RETRY) ++ if ((num_retry > 0) && (number_of_timeout > num_retry)) + state = S_ABORT; + break; + case ERR: diff --git a/package/atftp/patches/patch-tftpd_c b/package/atftp/patches/patch-tftpd_c new file mode 100644 index 000000000..93568d91a --- /dev/null +++ b/package/atftp/patches/patch-tftpd_c @@ -0,0 +1,20 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- atftp-0.7.orig/tftpd.c 2004-02-27 03:05:26.000000000 +0100 ++++ atftp-0.7/tftpd.c 2008-10-09 11:58:48.000000000 +0200 +@@ -230,14 +230,8 @@ int main(int argc, char **argv) + + /* find the port */ + if (tftpd_port == 0) +- { +- if ((serv = getservbyname("tftp", "udp")) == NULL) +- { +- logger(LOG_ERR, "atftpd: udp/tftp, unknown service"); +- exit(1); +- } +- tftpd_port = ntohs(serv->s_port); +- } ++ tftpd_port = htons(69); ++ + /* initialise sockaddr_in structure */ + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; |