From owner-freebsd-questions Fri Jul 19 08:53:01 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA04394 for questions-outgoing; Fri, 19 Jul 1996 08:53:01 -0700 (PDT) Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id IAA04389 for ; Fri, 19 Jul 1996 08:52:59 -0700 (PDT) Received: by halloran-eldar.lcs.mit.edu; (5.65/1.1.8.2/19Aug95-0530PM) id AA13575; Fri, 19 Jul 1996 11:52:53 -0400 Date: Fri, 19 Jul 1996 11:52:53 -0400 From: Garrett Wollman Message-Id: <9607191552.AA13575@halloran-eldar.lcs.mit.edu> To: tcg@ime.net Cc: FreeBSD-Questions Subject: Scanning for Interfaces! In-Reply-To: <31EFADF9.7E3E@ime.net> References: <31EFADF9.7E3E@ime.net> Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk < said: > Problem one: > socket(AF_IPX, SOCK_xxxx, PF_IPX) > Fails with: Protocol not supported! (xxxx = DGRAM or others) > So I look elsewhere for uses of 'socket', I of course found many > and noticed that few use the third param. (protocol) > Is there something else thats missing?? > My fix was: (Right or wrong, I don't know) > socket(AF_IPX, SOCK_xxxx, 0) Almost. It should be: socket(PF_IPX, SOCK_whatever, protocol_or_zero); where protocol_or_zero could be either zero (use the default), or a specification of a particular protocol (like IPXPROTO_SPX). Most of the time there is no reason to specify the protocol, but it is necessary if you are using SOCK_RAW sockets. > Scanning for interfaces fails! It seems the index of the interface > structures/tables is off, It lists the first one sorta right, And > the rest keep getting further and further off. > (The first one works except for the address translation, I can fix) > I have compared the structures they match pretty close! I see nothing > that should cause this! the sizes are all determind via sizeof() > anyways. No, this sizes are /not/ determined by the sizeof operator, that is your problem. The sizes are determined by the sa_len element of the sockaddr structure. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, ANA, or NSA| - Susan Aglukark and Chad Irschick