tcpdump mailing list archives

Re: ipv6 addresses in pcap_addr


From: Chris Morgan <chmorgan () gmail com>
Date: Thu, 22 Jan 2009 22:00:48 -0500

On Thu, Jan 22, 2009 at 7:59 PM, Guy Harris <guy () alum mit edu> wrote:

On Jan 22, 2009, at 4:05 PM, Chris Morgan wrote:

Hello.

I wasn't sure if this question was answered anywhere, I've searched
via google and looked on the mailing lists but haven't seen any
answers.

How does one get a ipv6 address from the sockaddr struct pointed to by
pcap_addr?

Welcome to the wonderful world of C, the programming language that combines
the power of assembly language with the convenience of assembly language....

"struct sockaddr" is a sort of place-holder structure.  There are few, if
any, real "struct sockaddr" structures out there; instead, there are "struct
sockaddr_XXX" structures, for various values of XXX.  "struct sockaddr" is
an abstraction that covers all of them; all "struct sockaddr_XXX" structures
begin with members that are the same as the non-"sa_data" members of "struct
sockaddr", and with the same structure offsets as those members, and have,
following that, the address-type-specific data, starting at the same offset
as the "sa_data" member of "struct sockaddr", but not necessarily having the
same *length* as the "sa_data" member of that structure - it could be longer
(and possibly shorter).


Doh. I know exactly what you mean now. I didn't notice anything on the
pcap man page about that, probably because its something documented
elsewhere. I had no idea that the sockaddr structure was used this
way. Thank you for the tip and sorry for causing you to write such an
extensive post, I appreciate your help.

Chris
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: