跳到主要内容

8.2. FSM 描述

8.2. FSM 描述 (Description of FSM)

8.2.1. FSM 定义 (FSM Definition)

BGP MUST 为每个 configured peer 维护一个单独的 FSM. potential connection 中配对的每个 BGP peer 都会尝试连接对方, 除非被配置为保持在 idle state, 或被配置为保持 passive. 为了本讨论, TCP connection 的 active 或 connecting side (发送第一个 TCP SYN packet 的一侧) 称为 outgoing. passive 或 listening side (第一个 SYN/ACK 的发送方) 称为 incoming connection. (关于下文使用的 active 和 passive 术语, 见 Section 8.2.1.1.)

BGP implementation MUST 连接到 TCP port 179, 并且除了尝试连接 peer 之外, 还 MUST 在 TCP port 179 上 listen 以接收 incoming connection. 对每个 incoming connection, MUST 实例化一个 state machine. 有一段时间内, incoming connection 另一端 peer 的身份已知, 但 BGP Identifier 尚未知. 在此期间, 同一个 configured peering 可以同时存在一条 incoming connection 和一条 outgoing connection. 这称为 connection collision (见 Section 6.8).

BGP implementation 最多会为每个 configured peering 拥有一个 FSM, 另外为每条 peer 尚未识别的 incoming TCP connection 拥有一个 FSM. 每个 FSM 正好对应一条 TCP connection.

如果 connection 被配置为使用不同的 IP address pair, 一对 peer 之间可能存在多条 connection. 这称为到同一 peer 的多个 "configured peering".

8.2.1.1. 术语 "active" 和 "passive" (Terms "active" and "passive")

术语 active 和 passive 在 Internet operator 的词汇中已使用近十年, 并已证明有用. 当应用于 TCP connection 或 peer 时, active 和 passive 这两个词的含义略有不同. 根据上面的定义和下面的 state machine, 对于任意一条 TCP connection, 只有一个 active side 和一个 passive side. 当 BGP speaker 被配置为 active 时, 它最终可能位于所建立 connection 的 active side 或 passive side. 一旦 TCP connection 完成, 哪一端曾是 active, 哪一端曾是 passive 就不再重要. 唯一区别在于 TCP connection 的哪一侧拥有 port number 179.

8.2.1.2. FSM 和碰撞检测 (FSM and Collision Detection)

每条 BGP connection 有一个 FSM. 当 connection collision 在确定某条 connection 关联到哪个 peer 之前发生时, 一个 peer 可能有两条 connection. connection collision 解决后 (见 Section 6.8), SHOULD 处置被关闭 connection 的 FSM.

8.2.1.3. FSM 和 Optional Session Attribute (FSM and Optional Session Attributes)

Optional Session Attribute 指定充当 flag (TRUE 或 FALSE) 的 attribute, 或 optional timer. 对于充当 flag 的 optional attribute, 如果 optional session attribute 可以在系统上设置为 TRUE, 则必须支持对应的 BGP FSM action. 例如, 如果 BGP implementation 中可以设置以下 option: AutoStart 和 PassiveTcpEstablishment, 则必须支持 Event 3, 4 和 5. 如果某个 Optional Session attribute 不能设置为 TRUE, 则不必支持支撑该 option 集合的 event.

每个 optional timer (DelayOpenTimer 和 IdleHoldTimer) 都有一组 attribute:

  • 表示 support 的 flag,
  • Timer 中设置的 Time,
  • Timer.

两个 optional timer 体现这种格式:

  • DelayOpenTimer: DelayOpen, DelayOpenTime, DelayOpenTimer
  • IdleHoldTimer: DampPeerOscillations, IdleHoldTime, IdleHoldTimer

如果表示支持某个 optional timer 的 flag (DelayOpen 或 DampPeerOscillations) 不能设置为 TRUE, 则不必支持支撑该 option 的 timer 和 event.

8.2.1.4. FSM Event Number (FSM Event Numbers)

此 state machine 描述中使用的 Event number (1-28) 有助于规定 BGP state machine 的行为. implementation MAY 使用这些 number 提供 network management information. FSM 或 FSM event 的确切形式由每个 implementation 决定.

8.2.1.5. 依赖实现的 FSM Action (FSM Actions that are Implementation Dependent)

在某些点上, BGP FSM 指定将发生 BGP initialization 或删除 BGP resource. BGP FSM 和关联 resource 的 initialization 取决于 BGP implementation 的 policy 部分. 这些 action 的细节不在 FSM document 范围内.