[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SA_LEN in linux (fwd)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 4 Jun 2001, Mark Sutton wrote:

> > I get this error on linking Lynx2.8.4-pre1:
> >
> > HTFTP.o(.text+0x1924): undefined reference to `SA_LEN'
>
> I've been looking at netinet/in.h there seens to be no sa_len
> or sin6_len in sockaddr_in6, which it looks like the two options.

sa_len is a general sockaddr field which is used to indicate the length of
the entire sockaddr_* struct.  sin6_len indicates the length of the actual
IPv6 address itself, which should always be 16, I suppose.  I'm not sure
I've seen sin6_leen before.

glibc does not use an sa_len field to store the length of sockaddr
structs, and instead provides an SA_LEN(struct sockaddr *) macro that
takes a pointer to a sockaddr field and returns its size based on the
value in the sa_family field.  Generally code that expects sa_len can be
ported by changing code that reads sa_len to instead call SA_LEN() and
simply deleting code that sets sa_len.

If you're getting the error that SA_LEN is undefined, maybe you're using a
different glibc than the rest of us.  Check /usr/include/bits/sockaddr.h
and make sure SA_LEN(x) is defined there.

> I noticed a while back that ftp did not work on the only site
> I used that had an IPv6 address (ftp.linux-ipv6.org), I could
> only get there from an IPv4 client, is this why?

Most likely IPv6 connectivity was broken for either you or them.  :-)  If
there's an incompatibility with the sa_len field, it will be caught at
compile time and you'll never even get an executable.  -Nathan

- -- 
+-------------------+---------------------+------------------------+
| Nathan Lutchansky | lutchann@litech.org |  Lithium Technologies  |
+------------------------------------------------------------------+
|  I dread success.  To have succeeded is to have finished one's   |
|  business on earth...  I like a state of continual becoming,     |
|  with a goal in front and not behind. - George Bernard Shaw      |
+------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/

iD8DBQE7G7buTviDkW8mhycRAuqlAJ0VKqHf0ZoB/M9xOWPGzzO+tLS/eQCghw04
ln+ieFevwtX9AbQGpYhV3FE=
=JCWJ
-----END PGP SIGNATURE-----



Reply to: