附录 A. GGP 消息格式
请注意,GGP 协议目前正在经历大幅变更,以引入外部网关协议功能;这是让其他系统中的网关能够与本文档所述网关交换路由信息所需的途径。
每条 GGP 消息由一个互联网头及其后的下列某一种消息组成。GGP 消息所用互联网头中的各值(十进制)如下。
- Version:4。
- IHL:互联网头长度,以 32 位字为单位。
- Type of Service:0。
- Total Length:互联网头与数据的总长度,以八位组为单位。
- ID, Flags, Fragment Offset:0。
- Time to Live:生存时间,以秒为单位。处理该数据报的每台机器至少要将此字段减一。
- Protocol:Gateway Protocol = 3。
- Header Checksum:头部中所有 16 位字之和的反码和(one's complement sum)的 16 位反码。计算校验和时,校验和字段应为零。
- Source Address:发送该消息的网关接口的地址。
- Destination Address:接收该消息的网关的地址。
ROUTING UPDATE(路由更新)
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!Gateway Type ! unused (0) ! ; 2 bytes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Sequence Number ! ; 2 bytes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! need-update ! n-distances ! ; 2 bytes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! distance 1 ! n1-dist ! ; 2 bytes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! net11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; 1, 2 or 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; bytes
! net12 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; 1, 2 or 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; bytes
.
.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! net1n1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; n1 nets at
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; dist 1
. ...
. ; ndist groups
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; of nets
! distance n ! nn-dist ! ; 2 bytes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! netn1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; 1, 2 or 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; bytes
! netn2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; 1, 2 or 3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; bytes
.
.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! netnnn !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ; nn nets at
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; dist n
- Gateway Type:12(十进制)。
- Sequence Number:用于标识路由更新的 16 位序号。
- need-update:8 位字段。如果源网关向目的网关请求路由更新,则此字节置为 1,否则置为 0。
- n-distances:8 位字段。本次更新中所报告的距离组(distance-group)的数量。每个距离组由一个距离值和一个网络数量组成,其后是在该距离上可达的实际网络号。不必报告所有距离。
- distance 1:适用于该距离组的跳数(或其他距离度量)。
- n1-dist:该距离组中所报告的网络数量。
- net11:距离为“distance 1”的第一个网络,占 1、2 或 3 个字节。
- net12:第二个网络。
- ...
- net1n1:依此类推。
ACKNOWLEDGMENT 或 NEGATIVE ACKNOWLEDGMENT(确认或否定确认)
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Gateway Type | Unused | Sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Gateway Type:确认(Acknowledgment)为类型 2。否定确认(Negative acknowledgment)为类型 10。
- Sequence Number:网关所确认或否定确认的 16 位序号。
GGP ECHO 和 ECHO REPLY
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Gateway Type | Unused |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Gateway Type:echo 消息为 8;echo reply 为 0。
- Source Address:在 echo 消息中,这是与其所发送 echo 消息的邻居位于同一网络上的网关的地址。在 echo reply 消息中,源地址和目的地址只需互换,其余部分原样返回。
NETWORK INTERFACE STATUS(网络接口状态)
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Gateway Type ! unused !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Gateway Type:9。
- Source Address / Destination Address:网关网络接口的地址。网关可以向自己发送 Net Interface Status 消息,以确定自己能否在其网络接口上发送和接收流量。