Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 1996 11:52:53 -0400
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        tcg@ime.net
Cc:        FreeBSD-Questions <questions@freebsd.org>
Subject:   Scanning for Interfaces!
Message-ID:  <9607191552.AA13575@halloran-eldar.lcs.mit.edu>
In-Reply-To: <31EFADF9.7E3E@ime.net>
References:  <31EFADF9.7E3E@ime.net>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Fri, 19 Jul 1996 11:47:05 -0400, Gary Chrysler <tcg@ime.net> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9607191552.AA13575>