summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-04-16 10:54:03 +0000
committerMartin Jansa <Martin.Jansa@gmail.com>2013-04-19 02:45:27 +0200
commit02023c1543d08bc2d51b739cf846eb49516e1269 (patch)
tree336be8d1b08784ac32f5b7bac8c34158fc564825 /meta-oe
parentbd790d44d2b07d660ee8c1d799d38ace22e0c455 (diff)
downloadmeta-openembedded-02023c1543d08bc2d51b739cf846eb49516e1269.tar.gz
atftp: move to meta-networking and tweak
* Add origin and Upstream-Status to patches * Set SUMMARY instead of DESCRIPTION * Add ${PN}d to PACKAGES instead of atftpd to be consistent with the rest of the recipe Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-extended/atftp/atftp/atftpd.service10
-rw-r--r--meta-oe/recipes-extended/atftp/atftp_git.bb55
-rw-r--r--meta-oe/recipes-extended/atftp/files/atftpd-0.7_circumvent_tftp_size_restrictions.patch158
-rw-r--r--meta-oe/recipes-extended/atftp/files/atftpd-0.7_unprotected_assignments_crash.patch145
-rw-r--r--meta-oe/recipes-extended/atftp/files/atftpd.init37
5 files changed, 0 insertions, 405 deletions
diff --git a/meta-oe/recipes-extended/atftp/atftp/atftpd.service b/meta-oe/recipes-extended/atftp/atftp/atftpd.service
deleted file mode 100644
index 480bc702e..000000000
--- a/meta-oe/recipes-extended/atftp/atftp/atftpd.service
+++ /dev/null
@@ -1,10 +0,0 @@
1[Unit]
2Description=Advanced TFTP Server
3After=syslog.target network.target
4
5[Service]
6Type=forking
7ExecStart=/usr/sbin/atftpd --daemon --port 69
8
9[Install]
10WantedBy=multi-user.target
diff --git a/meta-oe/recipes-extended/atftp/atftp_git.bb b/meta-oe/recipes-extended/atftp/atftp_git.bb
deleted file mode 100644
index 3e55881cf..000000000
--- a/meta-oe/recipes-extended/atftp/atftp_git.bb
+++ /dev/null
@@ -1,55 +0,0 @@
1DESCRIPTION = "Advanced TFTP server and client"
2SECTION = "network"
3HOMEPAGE = "http://packages.debian.org/atftp"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=94d55d512a9ba36caa9b7df079bae19f"
6PV = "0.7.1+git${SRCPV}"
7PR = "r3"
8
9SRCREV = "be3291a18c069ae23a124ffdc56d64a5ff0bbec7"
10
11SRC_URI = "git://atftp.git.sourceforge.net/gitroot/atftp/atftp;protocol=git \
12 file://atftpd-0.7_circumvent_tftp_size_restrictions.patch \
13 file://atftpd-0.7_unprotected_assignments_crash.patch \
14 file://atftpd.init \
15 file://atftpd.service \
16"
17S = "${WORKDIR}/git"
18
19inherit autotools update-rc.d useradd systemd
20
21INITSCRIPT_PACKAGES = "${PN}d"
22INITSCRIPT_NAME_${PN}d = "atftpd"
23INITSCRIPT_PARAMS_${PN}d = "defaults 80"
24
25USERADD_PACKAGES = "${PN}d"
26USERADD_PARAM_${PN}d = "--system --no-create-home --shell /bin/false \
27 --user-group nobody"
28
29do_install_append() {
30 install -d ${D}${sysconfdir}/init.d
31 install -m 0755 ${WORKDIR}/atftpd.init ${D}${sysconfdir}/init.d/atftpd
32
33 install -d ${D}/srv/tftp
34
35 rm ${D}${sbindir}/in.tftpd
36
37 install -d ${D}${systemd_unitdir}/system
38 install -m 0644 ${WORKDIR}/atftpd.service ${D}${systemd_unitdir}/system
39}
40
41PACKAGES =+ "atftpd"
42
43FILES_${PN} = "${bindir}/*"
44
45FILES_${PN}d = "${sbindir}/* \
46 ${sysconfdir}/init.d/* \
47 /srv/tftp \
48 ${systemd_unitdir}/system/atftpd.service \
49"
50
51SYSTEMD_PACKAGES = "${PN}d"
52SYSTEMD_SERVICE_${PN}d = "atftpd.service"
53RPROVIDES_${PN}d += "${PN}d-systemd"
54RREPLACES_${PN}d += "${PN}d-systemd"
55RCONFLICTS_${PN}d += "${PN}d-systemd"
diff --git a/meta-oe/recipes-extended/atftp/files/atftpd-0.7_circumvent_tftp_size_restrictions.patch b/meta-oe/recipes-extended/atftp/files/atftpd-0.7_circumvent_tftp_size_restrictions.patch
deleted file mode 100644
index 9aeb3515b..000000000
--- a/meta-oe/recipes-extended/atftp/files/atftpd-0.7_circumvent_tftp_size_restrictions.patch
+++ /dev/null
@@ -1,158 +0,0 @@
1Fate #303031: Circumvent TFTP size restrictions in atftpd
2The size of a single image file that can be transferred with TFTP is limited to
32^(2*8) *BLOCKSIZE (as per RFC 1350 there are only two bytes for the block
4counter). This is problematic for one of our customers who needs to transfer
5100+ MB Windows images using a TFTP client (NT bootloader) which has a
6hardwared BLOCKSIZE setting of 1432).
7
8block rollover
9http://www.compuphase.com/tftp.htm
10
11Index: git/tftp_def.h
12===================================================================
13--- git.orig/tftp_def.h 2012-11-19 16:28:50.221027144 -0800
14+++ git/tftp_def.h 2012-11-20 17:40:54.391206979 -0800
15@@ -32,6 +32,7 @@
16 #define TIMEOUT 5 /* Client timeout */
17 #define S_TIMEOUT 5 /* Server timout. */
18 #define NB_OF_RETRY 5
19+#define MAXBLOCKS 1000000 /* maximum number of blocks in a download */
20
21 /* definition to use tftp_options structure */
22 #define OPT_FILENAME 0
23Index: git/tftp_file.c
24===================================================================
25--- git.orig/tftp_file.c 2012-11-19 16:28:50.221027144 -0800
26+++ git/tftp_file.c 2012-11-19 16:28:51.201027167 -0800
27@@ -622,8 +622,8 @@
28 int state = S_SEND_REQ; /* current state in the state machine */
29 int timeout_state = state; /* what state should we go on when timeout */
30 int result;
31- int block_number = 0;
32- int last_block = -1;
33+ long block_number = 0;
34+ long last_block = -1;
35 int data_size; /* size of data received */
36 int sockfd = data->sockfd; /* just to simplify calls */
37 struct sockaddr_storage sa; /* a copy of data.sa_peer */
38@@ -637,8 +637,8 @@
39 int convert = 0; /* if true, do netascii convertion */
40 char string[MAXLEN];
41
42- int prev_block_number = 0; /* needed to support netascii convertion */
43- int prev_file_pos = 0;
44+ long prev_block_number = 0; /* needed to support netascii convertion */
45+ long prev_file_pos = 0;
46 int temp = 0;
47
48 data->file_size = 0;
49@@ -745,7 +745,7 @@
50 data_size, data->data_buffer);
51 data->file_size += data_size;
52 if (data->trace)
53- fprintf(stderr, "sent DATA <block: %d, size: %d>\n",
54+ fprintf(stderr, "sent DATA <block: %ld, size: %d>\n",
55 block_number + 1, data_size - 4);
56 state = S_WAIT_PACKET;
57 break;
58@@ -785,7 +785,7 @@
59 }
60 block_number = ntohs(tftphdr->th_block);
61 if (data->trace)
62- fprintf(stderr, "received ACK <block: %d>\n",
63+ fprintf(stderr, "received ACK <block: %ld>\n",
64 block_number);
65 if ((last_block != -1) && (block_number > last_block))
66 {
67Index: git/tftp_io.c
68===================================================================
69--- git.orig/tftp_io.c 2012-11-19 16:28:50.221027144 -0800
70+++ git/tftp_io.c 2012-11-19 16:28:51.201027167 -0800
71@@ -350,8 +350,8 @@
72 /*
73 * Read from file and do netascii conversion if needed
74 */
75-int tftp_file_read(FILE *fp, char *data_buffer, int data_buffer_size, int block_number,
76- int convert, int *prev_block_number, int *prev_file_pos, int *temp)
77+int tftp_file_read(FILE *fp, char *data_buffer, int data_buffer_size, long block_number,
78+ int convert, long *prev_block_number, long *prev_file_pos, int *temp)
79 {
80 int i;
81 int c;
82Index: git/tftp_io.h
83===================================================================
84--- git.orig/tftp_io.h 2012-11-19 16:28:50.221027144 -0800
85+++ git/tftp_io.h 2012-11-19 16:28:51.201027167 -0800
86@@ -52,8 +52,8 @@
87 int tftp_get_packet(int sock1, int sock2, int *sock, struct sockaddr_storage *sa,
88 struct sockaddr_storage *from, struct sockaddr_storage *to,
89 int timeout, int *size, char *data);
90-int tftp_file_read(FILE *fp, char *buffer, int buffer_size, int block_number, int convert,
91- int *prev_block_number, int *prev_file_pos, int *temp);
92+int tftp_file_read(FILE *fp, char *buffer, int buffer_size, long block_number, int convert,
93+ long *prev_block_number, long *prev_file_pos, int *temp);
94 int tftp_file_write(FILE *fp, char *data_buffer, int data_buffer_size, int block_number,
95 int data_size, int convert, int *prev_block_number, int *temp);
96 #endif
97Index: git/tftpd_file.c
98===================================================================
99--- git.orig/tftpd_file.c 2012-11-19 16:28:50.225027144 -0800
100+++ git/tftpd_file.c 2012-11-19 16:28:51.201027167 -0800
101@@ -407,8 +407,9 @@
102 int state = S_BEGIN;
103 int timeout_state = state;
104 int result;
105- int block_number = 0;
106- int last_block = -1;
107+ long block_number = 0;
108+ long last_block = -1;
109+ int block_loops = 0;
110 int data_size;
111 struct sockaddr_storage *sa = &data->client_info->client;
112 struct sockaddr_storage from;
113@@ -431,8 +432,8 @@
114 struct client_info *client_old = NULL;
115 struct tftp_opt options[OPT_NUMBER];
116
117- int prev_block_number = 0; /* needed to support netascii convertion */
118- int prev_file_pos = 0;
119+ long prev_block_number = 0; /* needed to support netascii convertion */
120+ long prev_file_pos = 0;
121 int temp = 0;
122
123 /* look for mode option */
124@@ -565,11 +566,12 @@
125 logger(LOG_INFO, "blksize option -> %d", result);
126 }
127
128- /* Verify that the file can be sent in 2^16 block of BLKSIZE octets */
129- if ((file_stat.st_size / (data->data_buffer_size - 4)) > 65535)
130+ /* Verify that the file can be sent in MAXBLOCKS blocks of BLKSIZE octets */
131+ if ((file_stat.st_size / (data->data_buffer_size - 4)) > MAXBLOCKS)
132 {
133 tftp_send_error(sockfd, sa, EUNDEF, data->data_buffer, data->data_buffer_size);
134- logger(LOG_NOTICE, "Requested file to big, increase BLKSIZE");
135+ logger(LOG_NOTICE, "Requested file too big, increase BLKSIZE");
136+ logger(LOG_NOTICE, "Only %d blocks of %d bytes can be served.", MAXBLOCKS, data->data_buffer_size);
137 if (data->trace)
138 logger(LOG_DEBUG, "sent ERROR <code: %d, msg: %s>", EUNDEF,
139 tftp_errmsg[EUNDEF]);
140@@ -880,10 +882,15 @@
141 }
142 /* The ACK is from the current client */
143 number_of_timeout = 0;
144- block_number = ntohs(tftphdr->th_block);
145+ block_number = (block_loops * 65536) + ntohs(tftphdr->th_block);
146 if (data->trace)
147- logger(LOG_DEBUG, "received ACK <block: %d>",
148- block_number);
149+ {
150+ logger(LOG_DEBUG, "received ACK <block: %d>", block_number);
151+ }
152+ if (ntohs(tftphdr->th_block) == 65535)
153+ {
154+ block_loops++;
155+ };
156 if ((last_block != -1) && (block_number > last_block))
157 {
158 state = S_END;
diff --git a/meta-oe/recipes-extended/atftp/files/atftpd-0.7_unprotected_assignments_crash.patch b/meta-oe/recipes-extended/atftp/files/atftpd-0.7_unprotected_assignments_crash.patch
deleted file mode 100644
index 6faf5f9d9..000000000
--- a/meta-oe/recipes-extended/atftp/files/atftpd-0.7_unprotected_assignments_crash.patch
+++ /dev/null
@@ -1,145 +0,0 @@
1Index: git/tftpd_list.c
2===================================================================
3--- git.orig/tftpd_list.c 2012-10-24 21:48:47.000000000 -0700
4+++ git/tftpd_list.c 2012-10-24 21:52:04.266205076 -0700
5@@ -49,11 +49,11 @@
6 */
7 int tftpd_list_add(struct thread_data *new)
8 {
9- struct thread_data *current = thread_data;
10+ struct thread_data *current;
11 int ret;
12
13 pthread_mutex_lock(&thread_list_mutex);
14-
15+ current = thread_data;
16 number_of_thread++;
17
18 ret = number_of_thread;
19@@ -81,11 +81,13 @@
20 */
21 int tftpd_list_remove(struct thread_data *old)
22 {
23- struct thread_data *current = thread_data;
24+ struct thread_data *current;
25 int ret;
26
27 pthread_mutex_lock(&thread_list_mutex);
28
29+ current = thread_data;
30+
31 number_of_thread--;
32 ret = number_of_thread;
33
34@@ -137,23 +139,26 @@
35 struct thread_data *data,
36 struct client_info *client)
37 {
38- struct thread_data *current = thread_data; /* head of the list */
39- struct tftp_opt *tftp_options = data->tftp_options;
40+ struct thread_data *current; /* head of the list */
41+ struct tftp_opt *tftp_options;
42 struct client_info *tmp;
43 char options[MAXLEN];
44 char string[MAXLEN];
45 char *index;
46 int len;
47
48+ /* lock the whole list before walking it */
49+ pthread_mutex_lock(&thread_list_mutex);
50+
51 *thread = NULL;
52
53+ current = thread_data;
54+ tftp_options = data->tftp_options;
55+
56 opt_request_to_string(tftp_options, options, MAXLEN);
57 index = strstr(options, "multicast");
58 len = (int)index - (int)options;
59
60- /* lock the whole list before walking it */
61- pthread_mutex_lock(&thread_list_mutex);
62-
63 while (current)
64 {
65 if (current != data)
66@@ -214,9 +219,10 @@
67 void tftpd_clientlist_remove(struct thread_data *thread,
68 struct client_info *client)
69 {
70- struct client_info *tmp = thread->client_info;
71+ struct client_info *tmp;
72
73 pthread_mutex_lock(&thread->client_mutex);
74+ tmp = thread->client_info;
75 while ((tmp->next != client) && (tmp->next != NULL))
76 tmp = tmp->next;
77 if (tmp->next == NULL)
78@@ -231,9 +237,11 @@
79 void tftpd_clientlist_free(struct thread_data *thread)
80 {
81 struct client_info *tmp;
82- struct client_info *head = thread->client_info;
83+ struct client_info *head;
84
85 pthread_mutex_lock(&thread->client_mutex);
86+ head = thread->client_info;
87+
88 while (head)
89 {
90 tmp = head;
91@@ -250,9 +258,10 @@
92 struct client_info *client,
93 struct sockaddr_storage *sock)
94 {
95- struct client_info *head = thread->client_info;
96+ struct client_info *head;
97
98 pthread_mutex_lock(&thread->client_mutex);
99+ head = thread->client_info;
100
101 if (client)
102 {
103@@ -334,10 +343,10 @@
104
105 void tftpd_list_kill_threads(void)
106 {
107- struct thread_data *current = thread_data; /* head of list */
108+ struct thread_data *current; /* head of list */
109
110 pthread_mutex_lock(&thread_list_mutex);
111-
112+ current = thread_data;
113
114 while (current != NULL)
115 {
116Index: git/tftpd_mcast.c
117===================================================================
118--- git.orig/tftpd_mcast.c 2012-10-24 21:48:47.000000000 -0700
119+++ git/tftpd_mcast.c 2012-10-24 21:49:11.570201582 -0700
120@@ -51,9 +51,11 @@
121 */
122 int tftpd_mcast_get_tid(char **addr, short *port)
123 {
124- struct tid *current = tid_list;
125+ struct tid *current;
126
127 pthread_mutex_lock(&mcast_tid_list);
128+ current = tid_list;
129+
130 /* walk the list for a free tid */
131 while (current != NULL)
132 {
133@@ -74,9 +76,11 @@
134
135 int tftpd_mcast_free_tid(char *addr, short port)
136 {
137- struct tid *current = tid_list;
138+ struct tid *current;
139
140 pthread_mutex_lock(&mcast_tid_list);
141+ current = tid_list;
142+
143 while (current != NULL)
144 {
145 if ((current->used == 1) && (current->port == port) &&
diff --git a/meta-oe/recipes-extended/atftp/files/atftpd.init b/meta-oe/recipes-extended/atftp/files/atftpd.init
deleted file mode 100644
index 161d97aca..000000000
--- a/meta-oe/recipes-extended/atftp/files/atftpd.init
+++ /dev/null
@@ -1,37 +0,0 @@
1#! /bin/sh
2#
3# This is an init script for openembedded
4# Copy it to /etc/init.d/atftpd and type
5# > update-rc.d atftpd defaults 60
6#
7
8
9test -f /usr/sbin/atftpd || exit 0
10
11test -d /srv/tftp || mkdir -p /srv/tftp
12
13case "$1" in
14 start)
15 echo -n "Starting tftp daemon: atftpd"
16 start-stop-daemon --start --quiet --exec /usr/sbin/atftpd -- --daemon --port 69
17 echo "."
18 ;;
19 stop)
20 echo -n "Stopping tftp daemon: atftpd"
21 start-stop-daemon --stop --quiet --exec /usr/sbin/atftpd
22 echo "."
23 ;;
24 reload|force-reload)
25 start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/atftpd
26 ;;
27 restart)
28 $0 stop
29 sleep 1
30 $0 start
31 ;;
32 *)
33 echo "Usage: /etc/init.d/atftpd {start|stop|reload|restart|force-reload}"
34 exit 1
35esac
36
37exit 0