Re: getsockopt() hurd/glibc mismatch
On Sun, May 06, 2001 at 05:14:05PM +0200, Robert Bihlmeyer wrote:
> After further researching some ssh problem, I found out that
> getsockopt(socket, SOL_IP, IP_something, &option)
> will generally return garbage on the Hurd. That's because these
> IP_something constants aren't.
> include/bits/in.h from glibc has:
> #define IP_OPTIONS 1 /* ip_opts; IP per-packet options. */
> But Hurd's pfinet/linux-src/include/linux/in.h has:
> #define IP_OPTIONS 4
> So, a program inquiring about IP_OPTIONS will get the stack's idea of
> the TOS bits instead.
> I'm not sure which file needs to change though. Do we need to maintain
> binary compatibility with some time when pfinet was not based on the
> Linux stack?
This should not happen. Note that there is a glue-include/linux/in.h, which
says right at the top:
So the linux code should be compiled with glibcs idea of these constants
already. Now, if you have identified the problem as such by debugging it,
there might be some error which causes the wrong header file to be used.
With a quick grep I can't find an indication for that.
I do the following: I go to the build directory of pfinet, and force
rebuilding ip_sockglue.o (the only user of IP_OPTIONS in our pfinet).
The command is:
i386-gnu-gcc -O -Wall -g -O2 -I. -I../../pfinet -I.. -I../..
-I../../include -D_GNU_SOURCE -imacros ../../pfinet/config.h
-I../../pfinet/glue-include -I../../pfinet/linux-src/include -c -o
Then I run the command with the -E option appended. In the output, I search
# 1 "/usr/i386-gnu/include/netinet/in.h" 1 3
# 212 "/usr/i386-gnu/include/netinet/in.h" 2 3
# 1 "/usr/i386-gnu/include/bits/in.h" 1 3
# 250 "/usr/i386-gnu/include/netinet/in.h" 2 3
# 270 "/usr/i386-gnu/include/netinet/in.h" 2 3
# 1 "../../pfinet/glue-include/linux/in.h" 1
I also look for switch(optname):
case 1 :
case 1 :
This looks correct to me. The Linux code has IP_OPTIONS where the "1" is
Did you actually verify (in a debugger, for example), that the wrong values
are used? I suggest to step through pfinet for the getsockopt call. You can
debug translators just like other programs (set breakpoints, step through).
`Rhubarb is no Egyptian god.' Debian http://www.debian.org email@example.com
Marcus Brinkmann GNU http://www.gnu.org firstname.lastname@example.org