The following patch to dlls/winsock/socket.c broke compilation on FreeBSD
and probably all other non-Linux targets:

 revision 1.21
 date: 2000/07/23 19:28:24;  author: julliard;  state: Exp;  lines: +285 -0
 Adds an initial WSAIoctl function with support for only the
 SIO_GET_INTERFACE_LIST command.  Adds initial code to WsControl
 function to support the WSCNTL_TCPIP_QUERY_INFO command.

The error message is:

 socket.c: In function `WSAIoctl':
 socket.c:1387: structure has no member named `ifr_netmask'
 gmake[2]: *** [socket.o] Error 1

Here is what the structure looks on FreeBSD 4.0:

  struct  ifreq {
  #define IFNAMSIZ        16
        char    ifr_name[IFNAMSIZ];             /* if name, e.g. "en0" */
        union {
                struct  sockaddr ifru_addr;
                struct  sockaddr ifru_dstaddr;
                struct  sockaddr ifru_broadaddr;
                short   ifru_flags; 
                int     ifru_metric;
                int     ifru_mtu;
                int     ifru_phys;
                int     ifru_media;
                caddr_t ifru_data;
        } ifr_ifru;

Do you think it's possible to write that snippet in a more portable way?


A cursory grep on FreeBSD 4.0 leads to ifaddr which does have a field
called ifa_netmask:

  struct ifaddr {
        struct  sockaddr *ifa_addr;     /* address of interface */
        struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */ 
#define ifa_broadaddr   ifa_dstaddr     /* broadcast address interface */
        struct  sockaddr *ifa_netmask;  /* used to determine subnet */
        struct  ifnet *ifa_ifp;         /* back-pointer to interface */
        TAILQ_ENTRY(ifaddr) ifa_link;   /* queue macro glue */
        void    (*ifa_rtrequest)        /* check or clean routes (+ or -)'d */
                __P((int, struct rtentry *, struct sockaddr *));
        u_short ifa_flags;              /* mostly rt_flags for cloning */
        u_int   ifa_refcnt;             /* references to this structure */  
        int     ifa_metric;             /* cost of going out this interface */
#ifdef notdef  
        struct  rtentry *ifa_rt;        /* XXXX for ROUTETOIF ????? */
#endif  
        int (*ifa_claim_addr)           /* check if an addr goes to this if */
                __P((struct ifaddr *, struct sockaddr *));
};

Gerald
-- 
Gerald "Jerry" [EMAIL PROTECTED] http://www.dbai.tuwien.ac.at/~pfeifer/
Have a look at http://petition.eurolinux.org -- it's not about Linux, btw!


Reply via email to