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

getsockopt() hurd/glibc mismatch

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.  */
#define IP_HDRINCL      2       /* int; Header is included with data.  */
#define IP_TOS          3       /* int; IP type of service and precedence.  */
#define IP_TTL          4       /* int; IP time to live.  */
#define IP_RECVOPTS     5       /* bool; Receive all IP options w/datagram.  */
#define IP_RECVRETOPTS  6       /* bool; Receive IP options for response.  */
#define IP_RECVDSTADDR  7       /* bool; Receive IP dst addr w/datagram.  */
#define IP_RETOPTS      8       /* ip_opts; Set/get IP per-packet options.  */
#define IP_MULTICAST_IF 9       /* in_addr; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10     /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11    /* i_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12    /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13   /* ip_mreq; drop an IP group membership */

But Hurd's pfinet/linux-src/include/linux/in.h has:

#define IP_TOS          1
#define IP_TTL          2
#define IP_HDRINCL      3
#define IP_OPTIONS      4
#define IP_RECVOPTS     6
#define IP_RETOPTS      7
#define IP_PKTINFO      8
#define IP_PKTOPTIONS   9
#define IP_MTU_DISCOVER 10
#define IP_RECVERR      11
#define IP_RECVTTL      12
#define IP_RECVTOS      13
#define IP_MTU          14

(Both files are from an up to date Debian system.)

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?


Attachment: signature.ng
Description: PGP signature

Reply to: