SPARC/Solaris 8下快速终结TCP有限状态机的TIME_WAIT状态( 三 )


#define tcp_snd_ws_ok tcp_base->tcpb_snd_ws_ok
#define tcp_is_secure tcp_base->tcpb_is_secure
#define tcp_snxt tcp_base->tcpb_snxt
#define tcp_swnd tcp_base->tcpb_swnd
#define tcp_mss tcp_base->tcpb_mss
#define tcp_iss tcp_base->tcpb_iss
#define tcp_rnxt tcp_base->tcpb_rnxt
#define tcp_rwnd tcp_base->tcpb_rwnd
#define tcp_reflock tcp_base->tcpb_reflock
#define tcp_refcnt tcp_base->tcpb_refcnt
#define tcp_remote_v6 tcp_base->tcpb_remote_v6
#define tcp_remote tcp_base->tcpb_remote
#define tcp_bound_source_v6 tcp_base->tcpb_bound_source_v6
#define tcp_bound_source tcp_base->tcpb_bound_source
#define tcp_lport tcp_base->tcpb_tcpu.tcpu_ports1.tcpu_lport
#define tcp_fport tcp_base->tcpb_tcpu.tcpu_ports1.tcpu_fport
#define tcp_ports tcp_base->tcpb_tcpu.tcpu_ports2
#define tcp_ipsec_out tcp_base->tcpb_ipsec_out
#define tcp_ipsec_req_in tcp_base->tcpb_ipsec_req_in
#define tcp_ipversion tcp_base->tcpb_ipversion
#define tcp_bound_if tcp_base->tcpb_bound_if
#define tcp_reuseaddr tcp_base->tcpb_reuseaddr
#define tcp_exclbind tcp_base->tcpb_exclbind
#define tcp_ownerid tcp_base->tcpb_ownerid
} tcpb_t;
#endif /* (defined(_KERNEL) || defined(_KMEMUSER)) */
--------------------------------------------------------------------------

下面这两条命令其实是用分号连在一起执行的,否则前后数据不对应,我是telnet上
去执行命令 。

# ndd /dev/tcp tcp_status | grep ESTABLISHED
TCPB dest snxt suna swnd rnxt rack rwnd rto mss w sw rw t recent [lport,fport] state
30000cc21d0 ::ffff:192.168.5.8 8e0e46dc 8e0e46da 0000064010 3d49e751 3d49e751 0000024820 00583 01460 0 00 00 0 00000000 [23, 4613] TCP_ESTABLISHED
# skd64 0x30000cc21d0 256
byteArray [ 256 bytes ] ---->
0000000000000000 00 00 03 00 00 47 C1 80-00 00 00 00 10 48 18 88 .....G羳.....H.?
0000000000000010 00 00 00 00 00 00 00 00-00 00 03 00 00 3A 60 80 .............:`?
0000000000000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0000000000000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0000000000000040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0000000000000050 00 00 00 00 00 00 02 47-10 00 00 00 8E 0E 46 DC .......G....?F?
0000000000000060 00 00 FA 0A 00 00 05 B4-8E 0B 77 07 3D 49 E7 51 ..?...磶.w.=I鏠
0000000000000070 00 00 60 F4 00 00 00 00-00 00 00 00 00 00 00 00 ..`?...........
0000000000000080 00 01 00 00 3C 00 00 00-3C 00 00 00 00 00 00 00 ....<...<.......
0000000000000090 00 00 00 00 00 00 FF FF-C0 A8 05 08 00 00 00 00 ......??括......
00000000000000A0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00000000000000B0 00 00 00 00 00 00 FF FF-C0 A8 05 82 12 05 00 17 ......??括.?...
00000000000000C0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00000000000000D0 00 00 03 00 00 BB 6F D0-00 04 00 00 00 00 00 00 .....籵?.......
00000000000000E0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00000000000000F0 00 00 03 00 00 08 2B 68-00 00 00 00 00 00 00 00 ...... h........
#

显然0x30000cc21d0对应着一个tcpb_t结构 。

# adb -k /dev/ksyms /dev/mem
physmem 3b68
0x30000cc21d0$
30000cc21d0: tcp_bind_hash tcp_ptpbhn tcp_conn_hash
3000047c180 10481888 0
30000cc21e8: tcp_ptpchn time_wait_next time_wait_prev
300003a6080 0 0
30000cc2200: time_wait_expir last_rcv_lbolt tcp_state
0 0 0
30000cc2214: tcp_rcv_ws tcp_snd_ws tcp_ts_recent
0 0 0
30000cc2220: tcp_rto
24c
snd_ts_ok 0
snd_ws_ok 0
is_secure 0
reuseaddr 1
exclbind 0

30000cc222c: tcp_snxt tcp_swnd tcp_mss
8e176ce4 f8dc 5b4
30000cc2238: tcp_iss tcp_rnxt tcp_rwnd
8e0b7707 3d49ecf0 60f4
30000cc2248: tcpb_reflock
30000cc2248: owner/waiters
0


30000cc2250: tcp_refcnt tcpb_vcf tcpb_hops
1 3c000000 3c
30000cc225c: tcpb_remote_v6

30000cc225c: 0 0 ffff c0a80508

推荐阅读