[2678] in Kerberos_V5_Development
More Unicos porting hell (struct inaddr)
daemon@ATHENA.MIT.EDU (Ken Hornstein)
Tue Oct 28 13:57:03 1997
To: krbdev@MIT.EDU
Date: Tue, 28 Oct 1997 13:56:20 -0500
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
I _know_ I'm starting to sound like a broken record ... buuutttt ...
Under Unicos, the declaration for struct in_addr is as follows:
struct in_addr {
#ifndef _CRAY
u_long s_addr;
#else /* _CRAY */
struct {
u_long st_addr:32;
} s_da;
#define s_addr s_da.st_addr
#define SIZEOF_in_addr 4
#endif /* _CRAY */
};
Now, V5 is _filled_ with places that do things like:
memcpy((char *)p, (char *)&sender->sin_addr.s_addr, ...)
And since s_addr is a bitfield, and you can't take the address of a
bitfield ... this fails.
Okay, fine ... I understand why this fails. The question I have is ...
what's the correct fix? What I've been doing is to change things like
the above into:
memcpy((char *)p, (char *)&sender->sin_addr, ...)
Is that "correct"? It seems to work fine.
Another problem is that sizeof(struct in_addr) == 8 ... what other programs
do is:
#ifndef SIZEOF_in_addr
#define SIZEOF_in_addr sizeof(struct in_addr)
#endif
Which is heinous ...
--Ken