* [PATCH meta-networking] atftp: port a patch from OpenSUSE to fix "Sorcerer's Apprentice Syndrome"(SAS)
@ 2013-08-20 6:57 rongqing.li
2013-09-06 0:16 ` Rongqing Li
0 siblings, 1 reply; 3+ messages in thread
From: rongqing.li @ 2013-08-20 6:57 UTC (permalink / raw)
To: openembedded-devel, joe.macdonald
From: "Roy.Li" <rongqing.li@windriver.com>
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
meta-networking/recipes-daemons/atftp/atftp_git.bb | 1 +
.../files/atftp-0.7-sorcerers_apprentice.patch | 94 ++++++++++++++++++++
2 files changed, 95 insertions(+)
create mode 100644 meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
diff --git a/meta-networking/recipes-daemons/atftp/atftp_git.bb b/meta-networking/recipes-daemons/atftp/atftp_git.bb
index 4b9ff05..8f9b4e3 100644
--- a/meta-networking/recipes-daemons/atftp/atftp_git.bb
+++ b/meta-networking/recipes-daemons/atftp/atftp_git.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://atftp.git.sourceforge.net/gitroot/atftp/atftp;protocol=git \
file://atftpd-0.7_unprotected_assignments_crash.patch \
file://atftpd.init \
file://atftpd.service \
+ file://atftp-0.7-sorcerers_apprentice.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
new file mode 100644
index 0000000..fc64291
--- /dev/null
+++ b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
@@ -0,0 +1,94 @@
+atftp exhibits the well known "Sorcerer's Apprentice Syndrome"(SAS) problem.
+According to RFC 1350, the fix to SAS is quite simple: further copies of the
+acknowledgment for a particular data block would be ignored.
+
+Patch originally from OpenSUSE:
+https://build.opensuse.org/package/view_file?file=atftp-0.7-sorcerers_apprentice.patch&package=atftp.539&project=openSUSE%3A12.1%3AUpdate&rev=84569792975e00573d7df597d2a6e895
+
+Upstream-Status: Pending
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+Index: atftp-0.7/tftp_file.c
+===================================================================
+--- atftp-0.7.orig/tftp_file.c 2011-11-22 15:12:53.792744083 +0100
++++ atftp-0.7/tftp_file.c 2011-11-22 15:13:51.706421893 +0100
+@@ -605,6 +605,7 @@
+ int timeout_state = state; /* what state should we go on when timeout */
+ int result;
+ long block_number = 0;
++ long last_requested_block = -1;
+ long last_block = -1;
+ int data_size; /* size of data received */
+ int sockfd = data->sockfd; /* just to simplify calls */
+@@ -765,6 +766,17 @@
+ connected = 1;
+ }
+ block_number = ntohs(tftphdr->th_block);
++
++ if (last_requested_block >= block_number)
++ {
++ if (data->trace)
++ fprintf(stderr, "received duplicated ACK <block: %ld >= %ld>\n",
++ last_requested_block, block_number);
++ break;
++ }
++ else
++ last_requested_block = block_number;
++
+ if (data->trace)
+ fprintf(stderr, "received ACK <block: %ld>\n",
+ block_number);
+Index: atftp-0.7/tftpd_file.c
+===================================================================
+--- atftp-0.7.orig/tftpd_file.c 2011-11-22 15:12:53.793744112 +0100
++++ atftp-0.7/tftpd_file.c 2011-11-22 15:15:04.617534260 +0100
+@@ -403,6 +403,7 @@
+ int timeout_state = state;
+ int result;
+ long block_number = 0;
++ long last_requested_block = -1;
+ long last_block = -1;
+ int block_loops = 0;
+ int data_size;
+@@ -859,6 +860,32 @@
+ {
+ logger(LOG_DEBUG, "received ACK <block: %d>", block_number);
+ }
++
++ /* check whether the block request isn't already fulfilled */
++
++ /* multicast, block numbers could contain gaps */
++ if (multicast) {
++ if (last_requested_block >= block_number)
++ {
++ if (data->trace)
++ logger(LOG_DEBUG, "received duplicated ACK <block: %d >= %d>", last_requested_block, block_number);
++ break;
++ }
++ else
++ last_requested_block = block_number;
++ /* unicast, blocks should be requested one after another */
++ } else {
++ if (last_requested_block + 1 != block_number && last_requested_block != -1)
++ {
++ if (data->trace)
++ logger(LOG_DEBUG, "received out of order ACK <block: %d != %d>", last_requested_block + 1, block_number);
++ break;
++ }
++ else
++ last_requested_block = block_number;
++ }
++
++
+ if (ntohs(tftphdr->th_block) == 65535)
+ {
+ block_loops++;
+@@ -958,6 +985,8 @@
+ /* nedd to send an oack to that client */
+ state = S_SEND_OACK;
+ fseek(fp, 0, SEEK_SET);
++ /* reset the last block received counter */
++ last_requested_block = -1;
+ }
+ else
+ {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH meta-networking] atftp: port a patch from OpenSUSE to fix "Sorcerer's Apprentice Syndrome"(SAS)
2013-08-20 6:57 [PATCH meta-networking] atftp: port a patch from OpenSUSE to fix "Sorcerer's Apprentice Syndrome"(SAS) rongqing.li
@ 2013-09-06 0:16 ` Rongqing Li
2013-09-06 1:22 ` Joe MacDonald
0 siblings, 1 reply; 3+ messages in thread
From: Rongqing Li @ 2013-09-06 0:16 UTC (permalink / raw)
To: openembedded-devel; +Cc: joe.macdonald
ping...
Thanks
-Roy
On 08/20/2013 02:57 PM, rongqing.li@windriver.com wrote:
> From: "Roy.Li" <rongqing.li@windriver.com>
>
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
> meta-networking/recipes-daemons/atftp/atftp_git.bb | 1 +
> .../files/atftp-0.7-sorcerers_apprentice.patch | 94 ++++++++++++++++++++
> 2 files changed, 95 insertions(+)
> create mode 100644 meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
>
> diff --git a/meta-networking/recipes-daemons/atftp/atftp_git.bb b/meta-networking/recipes-daemons/atftp/atftp_git.bb
> index 4b9ff05..8f9b4e3 100644
> --- a/meta-networking/recipes-daemons/atftp/atftp_git.bb
> +++ b/meta-networking/recipes-daemons/atftp/atftp_git.bb
> @@ -13,6 +13,7 @@ SRC_URI = "git://atftp.git.sourceforge.net/gitroot/atftp/atftp;protocol=git \
> file://atftpd-0.7_unprotected_assignments_crash.patch \
> file://atftpd.init \
> file://atftpd.service \
> + file://atftp-0.7-sorcerers_apprentice.patch \
> "
> S = "${WORKDIR}/git"
>
> diff --git a/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
> new file mode 100644
> index 0000000..fc64291
> --- /dev/null
> +++ b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
> @@ -0,0 +1,94 @@
> +atftp exhibits the well known "Sorcerer's Apprentice Syndrome"(SAS) problem.
> +According to RFC 1350, the fix to SAS is quite simple: further copies of the
> +acknowledgment for a particular data block would be ignored.
> +
> +Patch originally from OpenSUSE:
> +https://build.opensuse.org/package/view_file?file=atftp-0.7-sorcerers_apprentice.patch&package=atftp.539&project=openSUSE%3A12.1%3AUpdate&rev=84569792975e00573d7df597d2a6e895
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> +Index: atftp-0.7/tftp_file.c
> +===================================================================
> +--- atftp-0.7.orig/tftp_file.c 2011-11-22 15:12:53.792744083 +0100
> ++++ atftp-0.7/tftp_file.c 2011-11-22 15:13:51.706421893 +0100
> +@@ -605,6 +605,7 @@
> + int timeout_state = state; /* what state should we go on when timeout */
> + int result;
> + long block_number = 0;
> ++ long last_requested_block = -1;
> + long last_block = -1;
> + int data_size; /* size of data received */
> + int sockfd = data->sockfd; /* just to simplify calls */
> +@@ -765,6 +766,17 @@
> + connected = 1;
> + }
> + block_number = ntohs(tftphdr->th_block);
> ++
> ++ if (last_requested_block >= block_number)
> ++ {
> ++ if (data->trace)
> ++ fprintf(stderr, "received duplicated ACK <block: %ld >= %ld>\n",
> ++ last_requested_block, block_number);
> ++ break;
> ++ }
> ++ else
> ++ last_requested_block = block_number;
> ++
> + if (data->trace)
> + fprintf(stderr, "received ACK <block: %ld>\n",
> + block_number);
> +Index: atftp-0.7/tftpd_file.c
> +===================================================================
> +--- atftp-0.7.orig/tftpd_file.c 2011-11-22 15:12:53.793744112 +0100
> ++++ atftp-0.7/tftpd_file.c 2011-11-22 15:15:04.617534260 +0100
> +@@ -403,6 +403,7 @@
> + int timeout_state = state;
> + int result;
> + long block_number = 0;
> ++ long last_requested_block = -1;
> + long last_block = -1;
> + int block_loops = 0;
> + int data_size;
> +@@ -859,6 +860,32 @@
> + {
> + logger(LOG_DEBUG, "received ACK <block: %d>", block_number);
> + }
> ++
> ++ /* check whether the block request isn't already fulfilled */
> ++
> ++ /* multicast, block numbers could contain gaps */
> ++ if (multicast) {
> ++ if (last_requested_block >= block_number)
> ++ {
> ++ if (data->trace)
> ++ logger(LOG_DEBUG, "received duplicated ACK <block: %d >= %d>", last_requested_block, block_number);
> ++ break;
> ++ }
> ++ else
> ++ last_requested_block = block_number;
> ++ /* unicast, blocks should be requested one after another */
> ++ } else {
> ++ if (last_requested_block + 1 != block_number && last_requested_block != -1)
> ++ {
> ++ if (data->trace)
> ++ logger(LOG_DEBUG, "received out of order ACK <block: %d != %d>", last_requested_block + 1, block_number);
> ++ break;
> ++ }
> ++ else
> ++ last_requested_block = block_number;
> ++ }
> ++
> ++
> + if (ntohs(tftphdr->th_block) == 65535)
> + {
> + block_loops++;
> +@@ -958,6 +985,8 @@
> + /* nedd to send an oack to that client */
> + state = S_SEND_OACK;
> + fseek(fp, 0, SEEK_SET);
> ++ /* reset the last block received counter */
> ++ last_requested_block = -1;
> + }
> + else
> + {
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH meta-networking] atftp: port a patch from OpenSUSE to fix "Sorcerer's Apprentice Syndrome"(SAS)
2013-09-06 0:16 ` Rongqing Li
@ 2013-09-06 1:22 ` Joe MacDonald
0 siblings, 0 replies; 3+ messages in thread
From: Joe MacDonald @ 2013-09-06 1:22 UTC (permalink / raw)
To: openembedded-devel
On Thu, Sep 5, 2013 at 8:16 PM, Rongqing Li <rongqing.li@windriver.com> wrote:
> ping...
http://git.openembedded.org/meta-openembedded/commit/?id=2b5682418cdec33f91e6fc3545e7dfcea57de4c7
I do think that some of my mail wasn't going out earlier today, though
and I don't see anything in the archives showing my 'merged' reply to
you.
It's there, anyway. Thanks Roy.
-J.
>
> Thanks
>
> -Roy
>
>
>
> On 08/20/2013 02:57 PM, rongqing.li@windriver.com wrote:
>>
>> From: "Roy.Li" <rongqing.li@windriver.com>
>>
>> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
>> ---
>> meta-networking/recipes-daemons/atftp/atftp_git.bb | 1 +
>> .../files/atftp-0.7-sorcerers_apprentice.patch | 94
>> ++++++++++++++++++++
>> 2 files changed, 95 insertions(+)
>> create mode 100644
>> meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
>>
>> diff --git a/meta-networking/recipes-daemons/atftp/atftp_git.bb
>> b/meta-networking/recipes-daemons/atftp/atftp_git.bb
>> index 4b9ff05..8f9b4e3 100644
>> --- a/meta-networking/recipes-daemons/atftp/atftp_git.bb
>> +++ b/meta-networking/recipes-daemons/atftp/atftp_git.bb
>> @@ -13,6 +13,7 @@ SRC_URI =
>> "git://atftp.git.sourceforge.net/gitroot/atftp/atftp;protocol=git \
>> file://atftpd-0.7_unprotected_assignments_crash.patch \
>> file://atftpd.init \
>> file://atftpd.service \
>> + file://atftp-0.7-sorcerers_apprentice.patch \
>> "
>> S = "${WORKDIR}/git"
>>
>> diff --git
>> a/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
>> b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
>> new file mode 100644
>> index 0000000..fc64291
>> --- /dev/null
>> +++
>> b/meta-networking/recipes-daemons/atftp/files/atftp-0.7-sorcerers_apprentice.patch
>> @@ -0,0 +1,94 @@
>> +atftp exhibits the well known "Sorcerer's Apprentice Syndrome"(SAS)
>> problem.
>> +According to RFC 1350, the fix to SAS is quite simple: further copies of
>> the
>> +acknowledgment for a particular data block would be ignored.
>> +
>> +Patch originally from OpenSUSE:
>>
>> +https://build.opensuse.org/package/view_file?file=atftp-0.7-sorcerers_apprentice.patch&package=atftp.539&project=openSUSE%3A12.1%3AUpdate&rev=84569792975e00573d7df597d2a6e895
>> +
>> +Upstream-Status: Pending
>> +
>> +Signed-off-by: Roy.Li <rongqing.li@windriver.com>
>> +Index: atftp-0.7/tftp_file.c
>> +===================================================================
>> +--- atftp-0.7.orig/tftp_file.c 2011-11-22 15:12:53.792744083 +0100
>> ++++ atftp-0.7/tftp_file.c 2011-11-22 15:13:51.706421893 +0100
>> +@@ -605,6 +605,7 @@
>> + int timeout_state = state; /* what state should we go on when
>> timeout */
>> + int result;
>> + long block_number = 0;
>> ++ long last_requested_block = -1;
>> + long last_block = -1;
>> + int data_size; /* size of data received */
>> + int sockfd = data->sockfd; /* just to simplify calls */
>> +@@ -765,6 +766,17 @@
>> + connected = 1;
>> + }
>> + block_number = ntohs(tftphdr->th_block);
>> ++
>> ++ if (last_requested_block >= block_number)
>> ++ {
>> ++ if (data->trace)
>> ++ fprintf(stderr, "received duplicated ACK
>> <block: %ld >= %ld>\n",
>> ++ last_requested_block, block_number);
>> ++ break;
>> ++ }
>> ++ else
>> ++ last_requested_block = block_number;
>> ++
>> + if (data->trace)
>> + fprintf(stderr, "received ACK <block: %ld>\n",
>> + block_number);
>> +Index: atftp-0.7/tftpd_file.c
>> +===================================================================
>> +--- atftp-0.7.orig/tftpd_file.c 2011-11-22 15:12:53.793744112
>> +0100
>> ++++ atftp-0.7/tftpd_file.c 2011-11-22 15:15:04.617534260 +0100
>> +@@ -403,6 +403,7 @@
>> + int timeout_state = state;
>> + int result;
>> + long block_number = 0;
>> ++ long last_requested_block = -1;
>> + long last_block = -1;
>> + int block_loops = 0;
>> + int data_size;
>> +@@ -859,6 +860,32 @@
>> + {
>> + logger(LOG_DEBUG, "received ACK <block: %d>",
>> block_number);
>> + }
>> ++
>> ++ /* check whether the block request isn't already
>> fulfilled */
>> ++
>> ++ /* multicast, block numbers could contain gaps */
>> ++ if (multicast) {
>> ++ if (last_requested_block >= block_number)
>> ++ {
>> ++ if (data->trace)
>> ++ logger(LOG_DEBUG, "received duplicated
>> ACK <block: %d >= %d>", last_requested_block, block_number);
>> ++ break;
>> ++ }
>> ++ else
>> ++ last_requested_block = block_number;
>> ++ /* unicast, blocks should be requested one after
>> another */
>> ++ } else {
>> ++ if (last_requested_block + 1 != block_number &&
>> last_requested_block != -1)
>> ++ {
>> ++ if (data->trace)
>> ++ logger(LOG_DEBUG, "received out of order
>> ACK <block: %d != %d>", last_requested_block + 1, block_number);
>> ++ break;
>> ++ }
>> ++ else
>> ++ last_requested_block = block_number;
>> ++ }
>> ++
>> ++
>> + if (ntohs(tftphdr->th_block) == 65535)
>> + {
>> + block_loops++;
>> +@@ -958,6 +985,8 @@
>> + /* nedd to send an oack to that client */
>> + state = S_SEND_OACK;
>> + fseek(fp, 0, SEEK_SET);
>> ++ /* reset the last block received counter */
>> ++ last_requested_block = -1;
>> + }
>> + else
>> + {
>>
>
> --
> Best Reagrds,
> Roy | RongQing Li
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-06 1:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 6:57 [PATCH meta-networking] atftp: port a patch from OpenSUSE to fix "Sorcerer's Apprentice Syndrome"(SAS) rongqing.li
2013-09-06 0:16 ` Rongqing Li
2013-09-06 1:22 ` Joe MacDonald
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.