public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Grant Edwards <grante@visi.com>
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] RedBoot sending incorrect TCP window size
Date: Thu, 08 Feb 2001 08:47:00 -0000	[thread overview]
Message-ID: <20010208105133.A1381@visi.com> (raw)

I'm having problems with some legacy applications because
Redboot (on ARM) advertises a TCP window size of 1458.  The
legacy stuff breaks if a TCP write of 1460 bytes doesn't go in
a single Ethernet frame.

Yes, I know, the legacy code is broken because it trying to use
TCP as a datagram service instead of a byte stream service.
That battle was lost before I stated working here.  :(

The problem is triggered because Redboot uses the expression
"sizeof (eth_header_t)" to decide how many bytes there are in 
an Ethernet header.  With ARM gcc, that expression has a value
of 16.  There are 14 bytes in an Ethernet header.  The reduces
the window size from 1460 (the usual max size of a TCP payload
in an Ethernet frame) to 1458.  Thus making my admittedly-broken
stuff not work.

It appears that there is no easy way to prevent gcc from
padding structs.

I've complained about this for years.  The response has always
been a scolding for using struct definitions for anything that
had to match up with the outside world's expectations.  

According to the gcc folks, you are suppose to memcpy()
everything to/from hard-wired offsets in communications frames
and memory-mapped I/O.  You are not supposed to use structs for
such things.

The sizeof operation on IP and TCP header structs yields the
expected result because they are an exact multiple of 32 bits.
This is just a lucky feature of gcc, and is not guaranteed to
be portable between architectures, versions, or anything else.

All occurrences of "sizeof (eth_header_t)" in net.h, tcp.c, udp.c
need to be replace by a hard coded constant.  I'll send a patch
later today...

-- 
Grant Edwards
grante@visi.com

             reply	other threads:[~2001-02-08  8:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-08  8:47 Grant Edwards [this message]
2001-02-08 11:42 ` Grant Edwards
2001-02-08 12:15 ` Donnat Eric
2001-02-08 12:54   ` Grant Edwards
2001-02-09  5:40     ` Bart Veer
2001-02-09  6:00       ` Jesper Skov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010208105133.A1381@visi.com \
    --to=grante@visi.com \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).