tcpdump(1) of IPv4 TCP connection (loopback)
tcpdump(1) of IPv6 TCP connection (loopback)
IPv4 socket structures
IPv6 socket structures
IPv4 Name Resolution
IPv6 Name Resolution
Go to Top of Page
IPv4 packet headerFrom RFC 791 September 1981:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Go to Top of Page |
IPv6 packet headerFrom RFC 2460 December 1998:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Go to Top of Page |
listening on lo0, link-type NULL (BSD loopback), capture size 96 bytes 11:43:30.141126 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [S], seq 1899213868, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7533732 ecr 0], length 0 11:43:30.141217 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [S.], seq 3809265911, ack 1899213869, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 3742840880 ecr 7533732], length 0 11:43:30.141259 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [.], ack 1, win 8960, options [nop,nop,TS val 7533732 ecr 3742840880], length 0 ... 11:49:41.008987 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [F.], seq 173, ack 107, win 8960, options [nop,nop,TS val 7904657 ecr 3742841014], length 0 11:49:41.009075 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [.], ack 174, win 8960, options [nop,nop,TS val 3743211805 ecr 7904657], length 0 11:49:41.012735 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [F.], seq 107, ack 174, win 8960, options [nop,nop,TS val 3743211808 ecr 7904657], length 0 11:49:41.012896 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [.], ack 108, win 8959, options [nop,nop,TS val 7904661 ecr 3743211808], length 0Go to Top of Page
11:56:47.750525 IP6 ::1.49816 > ::1.23: Flags [S], seq 4281000056, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 8331463 ecr 0], length 0 11:56:47.750636 IP6 ::1.23 > ::1.49816: Flags [S.], seq 3300695537, ack 4281000057, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 220526000 ecr 8331463], length 0 11:56:47.750697 IP6 ::1.49816 > ::1.23: Flags [.], ack 1, win 8960, options [nop,nop,TS val 8331463 ecr 220526000], length 0 ... 11:57:10.519518 IP6 ::1.49816 > ::1.23: Flags [F.], seq 173, ack 107, win 8960, options [nop,nop,TS val 8354236 ecr 220526134], length 0 11:57:10.519632 IP6 ::1.23 > ::1.49816: Flags [.], ack 174, win 8960, options [nop,nop,TS val 220548773 ecr 8354236], length 0 11:57:10.523294 IP6 ::1.23 > ::1.49816: Flags [F.], seq 107, ack 174, win 8960, options [nop,nop,TS val 220548776 ecr 8354236], length 0 11:57:10.523486 IP6 ::1.49816 > ::1.23: Flags [.], ack 108, win 8959, options [nop,nop,TS val 8354240 ecr 220548776], length 0Go to Top of Page
IPv4 packet header
From FreeBSD 8.0:
|
IPv6 packet header
From FreeBSD 8.0:
|
IPv4 socket structures
struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
struct in_addr {
in_addr_t s_addr;
};
typedef uint32_t in_addr_t;
Go to Top of Page
|
IPv6 socket structures
struct sockaddr_in6 {
uint8_t sin6_len; /* length of this struct */
sa_family_t sin6_family; /* AF_INET6 */
in_port_t sin6_port; /* Transport layer port # */
uint32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
uint32_t sin6_scope_id; /* scope zone index */
};
struct in6_addr {
union {
uint8_t __u6_addr8[16];
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
} __u6_addr; /* 128-bit IP6 address */
};
Go to Top of Page
|
IPv4 Name Resolution Structures
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
Go to Top of Page
|
IPv6 Name Resolution Structures
struct sockaddr {
unsigned char sa_len; /* total length */
sa_family_t sa_family; /* address family */
char sa_data[14]; /* actually longer; address value */
};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
Go to Top of Page
|
|
IPv4 Name Resolution Functions#includeGo to Top of Page |
IPv6 Name Resolution Functions#includeGo to Top of Page |