CN110932970B - Processing method and device of Transmission Control Protocol (TCP) session - Google Patents

Processing method and device of Transmission Control Protocol (TCP) session Download PDF

Info

Publication number
CN110932970B
CN110932970B CN201911229289.3A CN201911229289A CN110932970B CN 110932970 B CN110932970 B CN 110932970B CN 201911229289 A CN201911229289 A CN 201911229289A CN 110932970 B CN110932970 B CN 110932970B
Authority
CN
China
Prior art keywords
session
tcp session
capability
tcp
routing device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911229289.3A
Other languages
Chinese (zh)
Other versions
CN110932970A (en
Inventor
戴志滨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ruijie Networks Co Ltd
Original Assignee
Ruijie Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ruijie Networks Co Ltd filed Critical Ruijie Networks Co Ltd
Priority to CN201911229289.3A priority Critical patent/CN110932970B/en
Publication of CN110932970A publication Critical patent/CN110932970A/en
Application granted granted Critical
Publication of CN110932970B publication Critical patent/CN110932970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/021Ensuring consistency of routing table updates, e.g. by using epoch numbers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/24Multipath
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/163In-band adaptation of TCP data exchange; In-band control procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a processing method and device of a Transmission Control Protocol (TCP) session. The method establishes a first TCP session and a second TCP session with neighbor routing equipment and determines corresponding master-backup session capabilities; receiving an update message sent by neighbor routing equipment through a first TCP session with main session capability, and marking an address family corresponding to an address prefix to be updated as a failure address family after determining that the update message comprises error information; switching the master-backup session capability of the first TCP session and the second TCP session; sending a first capability message carrying the removal information of the fault address family and the main session capability identifier to the neighbor routing equipment through a second TCP session; after receiving the first capability response message through the second TCP session, the first TCP session sends a first notification message to the neighbor routing equipment, and the first TCP session is disconnected.

Description

Processing method and device of Transmission Control Protocol (TCP) session
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for processing a TCP session.
Background
Border Gateway Protocol (BGP) is an external Gateway Protocol used to implement learning and computation of routing information between different autonomous domains (or "autonomous systems"). The routing devices need to establish BGP neighbors first, configure each other as a neighbor routing device, and configure the neighbor routing device generally by specifying an Internet Protocol (IP) address of the other, and then, the two interacting parties can establish a Transmission Control Protocol (TCP) session using an IP address pair formed by their own IP address and the IP address of the other, and the routing devices send BGP messages to each other after establishing a TCP session with the neighbor routing devices, where the BGP messages mainly include:
an Open (Open) message is a first message sent after a TCP session is established, and is used for interacting BGP neighbor capability information between a routing device and a neighbor routing device, such as an autonomous system number, a BGP version number, a retention time, a device identifier of the routing device, routing information of an available address family of the routing device, and the like;
keep alive (Keepalive) message, is used for detecting the message of TCP conversation validity;
an Update (Update) message for exchanging route Update information between the routing device and the neighboring routing device, wherein the Update message includes a withdrawn route, a reachable route and corresponding route attributes;
a Capability (Capability) message, which is used for dynamically changing the routing Capability after the BGP neighbor is successfully established;
and the Notification (Notification) message is used for notifying the neighbor routing equipment of the detected errors, such as connection interruption, negotiation errors and message errors.
When error information that a session needs to be disconnected according to protocol specification exists in an Update message received by the routing equipment, if the error lacks the attribute of the next hop, a Notification message is sent to the neighboring routing equipment, and the current TCP session is disconnected, so that corresponding services of other available address families are interrupted, and the stability of communication among the routing equipment is reduced.
Disclosure of Invention
The embodiment of the application provides a method and a device for processing a Transmission Control Protocol (TCP) session, solves the problem that communication services of other normal address families are interrupted due to the fact that the TCP session is cut off in the prior art, and improves the stability of communication between routing devices.
In a first aspect, a method for processing a TCP session is provided, where the method is applied in a routing device, and the routing device establishes a BGP neighbor with a neighbor routing device, where the method may include:
after a first TCP session and a second TCP session are established with the neighbor routing equipment, determining the master-standby session capability of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, receiving an update message which is sent by the neighbor routing equipment and carries setting information and an address prefix to be updated through the first TCP session, marking an address family corresponding to the address prefix to be updated as a failure address family after the setting information is determined to be error information, and adding the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session;
switching the master-backup session capability of the first TCP session and the second TCP session;
sending a first capability message carrying removal information of the fault address family and a main session capability identifier to the neighbor routing equipment through the second TCP session, so that the neighbor routing equipment removes the fault address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after switching the main and standby session capabilities of the first TCP session and the second TCP session;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
In an optional implementation, after establishing the first TCP session and the second TCP session with the neighbor routing device and before determining the active-standby session capability of the first TCP session and the second TCP session, the method further includes:
respectively sending a first opening message and a second opening message to the neighbor routing device through the first TCP session and the second TCP session, so that the neighbor routing device determines the master-standby session capability of the first TCP session and the second TCP session, wherein the first opening message comprises a first session capability identifier representing the master-standby session capability, a device identifier of the routing device and available address family information of the routing device, and the second opening message comprises a second session capability identifier representing the master-standby session capability, a device identifier of the routing device and available address family information of the routing device;
receiving a third open packet and a fourth open packet sent by the neighbor routing device through the first TCP session and the second TCP session, respectively, where the third open packet and the fourth open packet are sent by the neighbor routing device after establishing the first TCP session and the second TCP session with the routing device, the third open packet includes a third session capability identifier indicating the master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device, and the fourth open packet includes a fourth session capability identifier indicating the master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device.
In an optional implementation, determining the active-standby session capability of the first TCP session and the second TCP session includes:
if the first session capability identifier and the third session capability identifier are main session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, determining the main/standby session capabilities of the first TCP session and the second TCP session according to the main/standby session capabilities set by the routing equipment or initially configured by the neighbor routing equipment;
if the first session capability identifier is different from the third session capability identifier, and the second session capability identifier is different from the fourth session capability identifier, determining a target routing device corresponding to a device identifier meeting a preset rule, and determining the master-slave session capability of the first TCP session and the second TCP session according to the master-slave session capability initially configured by the target routing device.
In an optional implementation, the method further comprises:
if the device identifier of the routing device and the device identifier of the neighbor routing device do not meet the preset rule, respectively sending a second notification message and a third notification message to the neighbor routing device through the first TCP session and the second TCP session, and disconnecting the first TCP session and the second TCP session, so that the neighbor routing device respectively disconnects the first TCP session and the second TCP session according to the second notification message and the third notification message.
In an optional implementation, determining the active-standby session capability of the first TCP session and the second TCP session includes:
acquiring the establishment time of the first TCP session and the establishment time of the second TCP session;
and determining the master-backup session capability of the first TCP session and the second TCP session according to the sequence of the establishment time.
In an optional implementation, the method further comprises:
establishing a third TCP session with the neighbor routing device;
sending a fifth open message to the neighbor routing device through the third TCP session, so that the neighbor routing device determines the master-standby session capability of the third TCP session, where the fifth open message includes a device identifier of the routing device and a failure address family of the routing device;
receiving a sixth open message sent by the neighbor routing device through the third TCP session, where the sixth open message is sent by the neighbor routing device after the third TCP session is established with the routing device, and the sixth open message includes a device identifier of the neighbor routing device and a failure address family of the neighbor routing device;
determining an address family to be tested of the third TCP session according to the fifth opening message and the sixth opening message, wherein the address family to be tested comprises a failure address family determined by the routing equipment and a failure address family determined by the neighbor routing equipment;
and determining whether the address family to be tested is available according to the communication state of the routing equipment and the neighbor routing equipment within a preset time length.
In an optional implementation, determining whether the address family to be tested is available according to the communication state between the routing device and the neighbor routing device within a preset time period includes:
if the address family to be tested is in a normal communication state with the neighbor routing equipment within the preset time length, determining that the address family to be tested is available, deleting the address family to be tested from the fault address family set of the second TCP session, and adding the address family to be tested into the available address family set of the second TCP session;
sending a second capability message carrying the added information of the address family to be tested and the main session capability identifier to the neighbor routing equipment through the second TCP session, so that the neighbor routing equipment sends a second capability response message after adding the address family to be tested in the available address family set of the second TCP session according to the added information;
and after receiving the second capability response message through the second TCP session, sending a fourth notification message to the neighbor routing equipment through the third TCP session, and disconnecting the third TCP session, so that the neighbor routing equipment disconnects the third TCP session according to the fourth notification message.
In an optional implementation, the method further comprises:
if the routing equipment and the neighbor routing equipment are in an abnormal communication state within the preset time length, determining that the address family to be tested is unavailable;
and sending a fifth notification message to the neighbor routing equipment through a third TCP session, and disconnecting the third TCP session so that the neighbor routing equipment disconnects the third TCP session according to the fifth notification message.
In a second aspect, a method for processing a TCP session is provided, where the method is applied in a neighbor routing device, and the neighbor routing device establishes a BGP neighbor with a routing device, where the method may include:
after a first TCP session and a second TCP session are established with the routing equipment, determining the master-standby session capacity of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, sending an update message carrying setting information and an address prefix to be updated to the routing equipment through the first TCP session, so that the routing equipment marks an address family corresponding to the address prefix to be updated as a failure address family after determining that the setting information is error information, adds the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session, switches the main and standby session capabilities of the first TCP session and the second TCP session, and sends a first capability message carrying removal information of the failure address family and a main session capability identifier through the second TCP session;
receiving the first capability packet through the second TCP session;
removing the fault address family from the available address family set of the second TCP session according to the removal information, and switching the master-backup session capability of the first TCP session and the second TCP session after adding the fault address family into the fault address family set of the second TCP session;
sending a first capability response message to the routing equipment so that the routing equipment sends a first notification message to the neighbor routing equipment through the first TCP session and disconnects the first TCP session;
and disconnecting the first TCP session after receiving the first notification message.
In an optional implementation, after establishing the first TCP session and the second TCP session with the routing device and before determining the active-standby session capability of the first TCP session and the second TCP session, the method further includes:
receiving, by the routing device, a first open packet and a second open packet sent by the routing device through the first TCP session and the second TCP session, where the first open packet and the second open packet are sent by the routing device after the routing device establishes the first TCP session and the second TCP session with the neighboring routing device, the first open packet includes a first session capability identifier indicating a master/slave session capability, a device identifier of the routing device, and available address family information of the routing device, and the second open packet includes a second session capability identifier indicating the master/slave session capability, a device identifier of the routing device, and available address family information of the routing device;
and sending a third open message and a fourth open message to the routing device through the first TCP session and the second TCP session, respectively, so that the routing device determines the master-standby session capabilities of the first TCP session and the second TCP session, where the third open message includes a third session capability identifier indicating the master-standby session capabilities, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device, and the fourth open message includes a fourth session capability identifier indicating the master-standby session capabilities, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device.
In an optional implementation, determining the active-standby session capability of the first TCP session and the second TCP session includes:
if the first session capability identifier and the third session capability identifier are main session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, determining the main/standby session capabilities of the first TCP session and the second TCP session according to the main/standby session capabilities set by the routing equipment or initially configured by the neighbor routing equipment;
if the first session capability identifier is different from the third session capability identifier, and the second session capability identifier is different from the fourth session capability identifier, obtaining a target routing device corresponding to the device identifier which is determined to meet a preset rule, and determining the master-slave session capability of the first TCP session and the second TCP session according to the master-slave session capability initially configured by the target routing device.
In an optional implementation, the method further comprises:
if the device identifier of the routing device and the device identifier of the neighbor routing device do not meet the preset rule, sending a second notification message and a third notification message to the routing device through the first TCP session and the second TCP session, respectively, and disconnecting the first TCP session and the second TCP session, so that the routing device disconnects the first TCP session and the second TCP session according to the second notification message and the third notification message, respectively.
In an optional implementation, determining the active-standby session capability of the first TCP session and the second TCP session includes:
acquiring the establishment time of the first TCP session and the establishment time of the second TCP session;
and determining the master-backup session capability of the first TCP session and the second TCP session according to the sequence of the establishment time.
In an optional implementation, the method further comprises:
establishing a third TCP session with the routing device;
receiving a fifth open message sent by the routing device through the third TCP session, where the fifth open message is sent by the routing device after the routing device establishes the third TCP session with the neighboring routing device, and the fifth open message includes a device identifier of the routing device and a failure address family of the routing device;
and sending a sixth opening message to the routing equipment through the third TCP session, so that the routing equipment determines the master-standby session capability of the third TCP session, determines an address family to be tested of the third TCP session according to the fifth opening message and the sixth opening message, wherein the address family to be tested comprises a failure address family which is determined by the routing equipment and a failure address family which is determined by the neighbor routing equipment, and determines whether the address family to be tested is available according to the communication state of the routing equipment and the neighbor routing equipment within a preset time length, and the sixth opening message comprises an equipment identifier of the neighbor routing equipment and the failure address family of the neighbor routing equipment.
In an optional implementation, the method further comprises:
receiving, by the routing device, a second capability message that carries addition information of the address family to be tested and a master session capability identifier, which is sent by the routing device, through the second TCP session, where the second capability message is sent by the routing device after determining that the address family to be tested is available according to a normal communication state with the neighbor routing device within the preset time period, deleting the address family to be tested from a set of failed address families of the second TCP session, and adding the address family to be tested to the set of available address families of the second TCP session;
deleting the address family to be tested from the fault address family set of the second TCP session according to the increasing information, and adding the address family to be tested into the available address family set of the second TCP session;
sending a second capability response message to the routing equipment through the second TCP session, so that the routing equipment sends a fourth notification message to the neighbor routing equipment through the third TCP session according to the second capability response message;
and disconnecting the third TCP session after receiving the fourth notification message through the third TCP session.
In an optional implementation, the method further comprises:
receiving a fifth notification message sent by the neighbor routing equipment through a third TCP session, wherein the fifth notification message is sent by the routing equipment after determining that the address family to be detected is unavailable according to the abnormal communication state of the routing equipment and the neighbor routing equipment in the preset time;
disconnecting the third TCP session according to the fifth notification message.
In a third aspect, a device for processing a TCP session is provided, where the device is applied in a routing device, and the routing device establishes a BGP neighbor with a neighbor routing device, and the device may include: a determining unit, a receiving unit, a switching unit or a transmitting unit;
the determining unit is configured to determine, after establishing a first TCP session and a second TCP session with the neighbor router, master-standby session capabilities of the first TCP session and the second TCP session;
the receiving unit is configured to receive, if it is determined that the first TCP session has a master session capability, an update packet which is sent by the neighbor routing device and carries setting information and an address prefix to be updated through the first TCP session, mark an address family corresponding to the address prefix to be updated as a failed address family after it is determined that the setting information is error information, and add the address family corresponding to the address prefix to be updated to a failed address family set of the second TCP session;
the switching unit is configured to switch the master-standby session capability of the first TCP session and the second TCP session;
the sending unit is configured to send a first capability message carrying removal information of the failed address family and a master session capability identifier to the neighbor routing device through the second TCP session, so that the neighbor routing device removes the failed address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after master and slave session capabilities of the first TCP session and the second TCP session are switched;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session, so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
In an optional implementation, the sending unit is further configured to send a first open packet and a second open packet to the neighbor routing device through the first TCP session and the second TCP session, respectively, so that the neighbor routing device determines active/standby session capabilities of the first TCP session and the second TCP session, where the first open packet includes a first session capability identifier indicating the active/standby session capabilities, a device identifier of the routing device, and available address family information of the routing device, and the second open packet includes a second session capability identifier indicating the active/standby session capabilities, a device identifier of the routing device, and available address family information of the routing device;
the receiving unit is further configured to receive a third open packet and a fourth open packet sent by the neighbor routing device through the first TCP session and the second TCP session, where the third open packet and the fourth open packet are sent by the neighbor routing device after the first TCP session and the second TCP session are established with the routing device, the third open packet includes a third session capability identifier indicating a master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device, and the fourth open packet includes a fourth session capability identifier indicating the master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device.
In an optional implementation, the determining unit is specifically configured to determine, if the first session capability identifier and the third session capability identifier are primary session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, the primary and standby session capabilities of the first TCP session and the second TCP session according to the primary and standby session capabilities set by the routing device or initially configured by the neighbor routing device;
if the first session capability identifier is different from the third session capability identifier, and the second session capability identifier is different from the fourth session capability identifier, determining a target routing device corresponding to a device identifier meeting a preset rule, and determining the master-slave session capability of the first TCP session and the second TCP session according to the master-slave session capability initially configured by the target routing device.
In an alternative implementation, the apparatus further comprises a disconnection unit;
the sending unit is further configured to send a second notification message and a third notification message to the neighbor routing device through the first TCP session and the second TCP session, respectively, if the device identifier of the routing device and the device identifier of the neighbor routing device do not satisfy the preset rule, so that the neighbor routing device disconnects the first TCP session and the second TCP session according to the second notification message and the third notification message, respectively;
the disconnection unit is configured to disconnect the first TCP session and the second TCP session.
In an optional implementation, the determining unit is further specifically configured to obtain an establishment time of the first TCP session and an establishment time of the second TCP session, and determine, according to a sequence of the establishment times, a master-standby session capability of the first TCP session and the second TCP session.
In an alternative implementation, the apparatus further comprises a setup unit;
the establishing unit is used for establishing a third TCP session with the neighbor routing equipment;
the sending unit is further configured to send a fifth open packet to the neighbor routing device through the third TCP session, so that the neighbor routing device determines the active/standby session capability of the third TCP session, where the fifth open packet includes a device identifier of the routing device and a failure address family of the routing device;
the receiving unit is further configured to receive, through the third TCP session, a sixth open packet sent by the neighbor routing device, where the sixth open packet is sent by the neighbor routing device after the third TCP session is established with the routing device, and the sixth open packet includes a device identifier of the neighbor routing device and a failure address family of the neighbor routing device;
the determining unit is further configured to determine, according to the fifth open packet and the sixth open packet, an address family to be tested of the third TCP session, where the address family to be tested includes a failed address family determined by the routing device and a failed address family determined by the neighboring routing device;
and determining whether the address family to be tested is available according to the communication state of the routing equipment and the neighbor routing equipment within a preset time length.
In an optional implementation, the determining unit is specifically configured to determine that the address family to be tested is available if the neighboring routing device is in a normal communication state within the preset time duration, delete the address family to be tested from the failed address family set of the second TCP session, and add the address family to be tested to the available address family set of the second TCP session;
the sending unit is further configured to send a second capability message carrying the added information of the address family to be tested and the master session capability identifier to the neighbor routing device through the second TCP session, so that the neighbor routing device sends a second capability response message after adding the address family to be tested in the available address family set of the second TCP session according to the added information;
the receiving unit is further configured to send a fourth notification packet to the neighbor routing device through the third TCP session after receiving the second capability response packet through the second TCP session, and disconnect the third TCP session, so that the neighbor routing device disconnects the third TCP session according to the fourth notification packet.
In an optional implementation, the method further comprises:
the determining unit is further configured to determine that the address family to be tested is unavailable if the routing device and the neighboring routing device are in an abnormal communication state within the preset time length;
the sending unit is further configured to send a fifth notification packet to the neighbor routing device through a third TCP session, and disconnect the third TCP session, so that the neighbor routing device disconnects the third TCP session according to the fifth notification packet.
In a fourth aspect, a device for processing a TCP session is provided, where the device is applied in a neighbor router, and the neighbor router establishes a BGP neighbor with a router, and the device may include: the device comprises a determining unit, a sending unit, a receiving unit, an adding unit and a switching unit;
the determining unit is configured to determine, after a first TCP session and a second TCP session are established with the routing device, master-standby session capabilities of the first TCP session and the second TCP session;
the sending unit is configured to send, if it is determined that the first TCP session has a master session capability, an update message carrying setting information and an address prefix to be updated to the routing device through the first TCP session, so that the routing device marks, after determining that the setting information is error information, an address family corresponding to the address prefix to be updated as a failed address family, adds the address family corresponding to the address prefix to be updated to a failed address family set of the second TCP session, switches master and slave session capabilities of the first TCP session and the second TCP session, and sends, through the second TCP session, a first capability message carrying removal information of the failed address family and a master session capability identifier;
the receiving unit is configured to receive the first capability packet through the second TCP session;
the adding unit is used for removing the failure address family from the available address family set of the second TCP session according to the removing information and adding the failure address family into the failure address family set of the second TCP session;
the switching unit is configured to switch the master-standby session capability of the first TCP session and the second TCP session;
the sending unit is further configured to send a first capability response packet to the routing device, so that the routing device sends a first notification packet to the neighboring routing device through the first TCP session, and disconnects the first TCP session;
the receiving unit is further configured to disconnect the first TCP session after receiving the first notification packet.
In an optional implementation, the receiving unit is further configured to receive, through the first TCP session and the second TCP session, a first open packet and a second open packet sent by the routing device after the routing device establishes the first TCP session and the second TCP session with the neighboring routing device, where the first open packet and the second open packet are sent by the routing device, the first open packet includes a first session capability identifier indicating a master/slave session capability, a device identifier of the routing device, and available address family information of the routing device, and the second open packet includes a second session capability identifier indicating a master/slave session capability, a device identifier of the routing device, and available address family information of the routing device;
the sending unit is further configured to send a third open packet and a fourth open packet to the routing device through the first TCP session and the second TCP session, respectively, so that the routing device determines the active/standby session capabilities of the first TCP session and the second TCP session, where the third open packet includes a third session capability identifier indicating the active/standby session capabilities, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device, and the fourth open packet includes a fourth session capability identifier indicating the active/standby session capabilities, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device.
In an optional implementation, the determining unit is specifically configured to determine, if the first session capability identifier and the third session capability identifier are primary session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, the primary and standby session capabilities of the first TCP session and the second TCP session according to the primary and standby session capabilities set by the routing device or initially configured by the neighbor routing device;
if the first session capability identifier is different from the third session capability identifier, and the second session capability identifier is different from the fourth session capability identifier, obtaining a target routing device corresponding to the device identifier which is determined to meet a preset rule, and determining the master-slave session capability of the first TCP session and the second TCP session according to the master-slave session capability initially configured by the target routing device.
In an optional implementation, the sending unit is further configured to send a second notification packet and a third notification packet to the routing device through the first TCP session and the second TCP session, respectively, and disconnect the first TCP session and the second TCP session, so that the routing device disconnects the first TCP session and the second TCP session according to the second notification packet and the third notification packet, respectively, if the device identifier of the routing device and the device identifier of the neighbor routing device do not satisfy the preset rule.
In an optional implementation, the determining unit is further specifically configured to obtain an establishment time of the first TCP session and an establishment time of the second TCP session, and determine, according to a sequence of the establishment times, a master-standby session capability of the first TCP session and the second TCP session.
In an alternative implementation, the apparatus further comprises a setup unit;
the establishing unit is used for establishing a third TCP session with the routing equipment;
the receiving unit is further configured to receive, through the third TCP session, a fifth open packet sent by the routing device, where the fifth open packet is sent by the routing device after the routing device establishes the third TCP session with the neighboring routing device, and the fifth open packet includes a device identifier of the routing device and a failure address family of the routing device;
the sending unit is further configured to send a sixth open packet to the routing device through the third TCP session, so that the routing device determines a master-standby session capability of the third TCP session, and determines, according to the fifth open packet and the sixth open packet, an address family to be tested of the third TCP session, where the address family to be tested includes a failed address family that was determined by the routing device and a failed address family that was determined by the neighbor routing device, and determines, according to a communication state between the routing device and the neighbor routing device within a preset time period, whether the address family to be tested is available, where the sixth open packet includes a device identifier of the neighbor routing device and the failed address family of the neighbor routing device.
In an alternative implementation, the apparatus further comprises a disconnection unit;
the receiving unit is further configured to receive, through the second TCP session, a second capability message that is sent by the routing device and carries addition information of the address family to be detected and a master session capability identifier, where the second capability message is sent by the routing device after the routing device determines that the address family to be detected is available according to a normal communication state with the neighboring routing device within the preset time period, deletes the address family to be detected from the set of failed address families of the second TCP session, and adds the address family to be detected to the set of available address families of the second TCP session;
the adding unit is further configured to delete the address family to be tested from the failure address family set of the second TCP session according to the addition information, and add the address family to be tested to the available address family set of the second TCP session;
the sending unit is further configured to send a second capability response packet to the routing device through the second TCP session, so that the routing device sends a fourth notification packet to the neighboring routing device through the third TCP session according to the second capability response packet;
and the disconnection unit is configured to disconnect the third TCP session after receiving the fourth notification packet through the third TCP session.
In an optional implementation, the sending unit is further configured to receive, through a third TCP session, a fifth notification packet sent by the neighbor routing device, where the fifth notification packet is sent by the routing device after determining that the address family to be detected is unavailable according to an abnormal communication state of the routing device and the neighbor routing device within the preset time;
the disconnection unit is further configured to disconnect the third TCP session according to the fifth notification packet.
In a fifth aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other via the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of the above first aspects or the method steps of any one of the above second aspects when executing a program stored in a memory.
A sixth aspect provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, performs the method steps of any one of the above first aspects or performs the method steps of any one of the above second aspects.
After a first TCP session and a second TCP session are established with a neighbor router device, the method for processing a transmission control protocol TCP session determines the master-standby session capability of the first TCP session and the second TCP session; if the first TCP session is determined to have the main session capability, receiving an updating message which is sent by the neighbor routing equipment and carries the setting information and the address prefix to be updated through the first TCP session, marking the address family corresponding to the address prefix to be updated as a failure address family after the setting information is determined to be error information, and adding the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session; switching the master-backup session capability of the first TCP session and the second TCP session; sending a first capability message carrying removal information of a failure address family and a main session capability identifier to neighbor routing equipment through a second TCP session, so that the neighbor routing equipment removes the failure address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after switching the main and standby session capabilities of the first TCP session and the second TCP session; if the first capability response message is received through the second TCP session, the first notification message is sent to the neighbor routing equipment through the first TCP session, and the first TCP session is disconnected, so that the neighbor routing equipment disconnects the first TCP session according to the first notification message, namely, the communication services of other normal address families can still be normally carried out through the second TCP session with the main session capability.
Drawings
Fig. 1 is a schematic system architecture diagram of a processing method for applying a transmission control protocol TCP session according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for processing a TCP session according to an embodiment of the present invention;
fig. 3A is a schematic structural diagram of a message body of an Open message according to an embodiment of the present invention;
FIG. 3B is a diagram illustrating a structure of a message body of a Notification message in the prior art;
fig. 3C is a schematic structural diagram of a message body of a Capability message according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating another TCP session processing method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a processing apparatus for a TCP session according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a processing apparatus for a TCP session according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without any creative effort belong to the protection scope of the present application.
Knowledge about the existing BGP protocol:
(1) the BGP protocol is a dynamic routing protocol between different Autonomous systems, which achieves reachability between Autonomous Systems (AS) by maintaining an IP routing table or IP address "prefix" table, using a path-based, network policy, or rule set to determine routing.
The autonomous system AS is a collection of routing devices managed by the same management organization and using a uniform routing strategy. Each autonomous system is assigned a unique autonomous system number, i.e., AS number, by an internet-authorized authority. By using routing protocols and autonomous system numbering, different routing devices can determine the path between each other and the exchange method of routing information.
(2) The BGP message consists of a BGP message header and a message body, wherein the BGP message header comprises: a Marker (Marker) field, a Length (Length) field, and a Type (Type) field.
Marker field: (16 bytes) authentication information, marking the boundary of the message.
Length field: and (2 bytes) marking the message length of the BGP message including the message header.
Type field: (1 byte) defines the message type of the BGP message, for example, 1 represents an Open message, 2 represents an Update message, 3 represents Notification, 4 represents a Keepalive message, 5 represents a Router-refresh message, and 6 represents a Capability message.
The method for communicating a BGP message according to the embodiment of the present invention may be applied to the system architecture shown in fig. 1, where the system may include: a routing device a and a neighbor routing device B.
The routing device A and the neighbor routing device B establish a first TCP session and a second TCP session according to respective IP addresses.
The routing device A and the neighbor routing device B respectively send Open messages comprising active and standby session capability identifications to opposite sides through a first TCP session and a second TCP session to negotiate the session capability of the two TCP sessions and the available address family set of each TCP session. Under normal conditions, the routing device a and the neighboring routing device B interact normal BGP messages, such as Update messages and Keepalive messages, through a TCP session with a master session capability. The session capability includes a master session capability and a standby session capability, and the available address family set of each TCP session includes available address family information of the routing device a and available address family information of the neighbor routing device B.
Taking the example that the routing device a receives the Update message sent by the neighbor routing device B through the first TCP session with the master session capability, the routing device a analyzes that there is error information in the Update message, and the error information is information that the BGP protocol specifies that the current first TCP session needs to be disconnected, and marks an address prefix to be updated in the Update message, such as a target address family corresponding to the IP address prefix, as a failed address family, where the target address family is an address family in an available address family set of the first TCP session. For example, the set of available address families may include the IPv4 unicast address family, the IPv6 unicast address family, the VPNv4 address family, and the VPNv6 address family.
The routing device A switches the session capability of the first TCP session from the main session capability to the standby session capability, and switches the session capability of the second TCP session from the standby session capability to the main session capability, namely, the session capability of the first TCP session and the session capability of the second TCP session are switched between the main session capability and the standby session capability. And then the routing equipment A sends a Capability message including the target address family removal information to the neighbor routing equipment B through a second TCP session, and then sends a Notification message to the routing equipment B through the first TCP session, so that the neighbor routing equipment B disconnects the first TCP session and simultaneously disconnects the first TCP session of the neighbor routing equipment B.
It can be seen that, in the above system provided in the embodiment of the present invention, after establishing a TCP session with a main session capability and a standby session capability, an Update packet carrying routing information is interacted with the TCP session with the main session capability under a normal condition, and when detecting that the received Update packet carrying error information indicates that a session must be disconnected according to the BGP protocol specification, triggering corresponding routing devices to mark a failure address family with a target address family corresponding to an address prefix in the Update packet, and add the failure address family into a failure address family set of the TCP session with the main session capability and a failure address family set of the TCP session with the standby session capability, so that neither the TCP session with the main session capability nor the TCP session with the standby session capability transmits a failure address family route (or "address prefix of failure address family"), and the TCP session with the standby session capability is switched to the TCP session with the main session capability, where the TCP session with the new main session capability transmits a normal address family route (or "address family ground of normal address family") Address prefix). And the TCP session with the original main session capability is disconnected according to the specification of the BGP protocol, so that the communication services of other normal address families are continuously carried out through the TCP session with the new main session capability, and the communication stability of the BGP message is improved.
It should be noted that, for the case of normally disconnecting the TCP session, such as the case of manually configuring to close the TCP session by the user, the embodiment of the present invention is not applicable.
The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are merely for illustrating and explaining the present invention and are not intended to limit the present invention, and that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
Fig. 2 is a flowchart illustrating a method for processing a TCP session according to an embodiment of the present invention. As shown in fig. 2, the method may include:
step 210, routing device a establishes a first TCP session and a second TCP session with neighbor routing device B.
The routing device A and the neighbor routing device B respectively establish a first TCP session with a first TCP session identifier and a second TCP session with a second TCP session identifier according to a TCP protocol and the IP address of the routing device A and the IP address of the neighbor routing device B, and the first TCP session identifier is different from the second TCP session identifier.
Step 220, routing device a determines the master-standby session capabilities of the first TCP session and the second TCP session.
Routing device a may determine the session capabilities of the first TCP session and the second TCP session in two ways:
in a first manner, the routing device a and the neighbor routing device B respectively send respective Open messages through a first TCP session and a second TCP session to interact BGP neighbor capability information of each other, such as available address family information, a device identifier of the routing device, a determined master-slave session capability, and the like, and determine the master-slave session capability according to a session capability identifier indicating the master-slave session capability in the sent Open message and the received Open message and a device identifier of the routing device.
As shown in fig. 3A, the message body of the Open message may include:
version field: (1 byte) version number of BGP protocol;
my Autonomous System field: (2 bytes) local AS number;
hold Time field: (2 bytes) keep-alive time, and if no keep alive or Update message is received within the specified time, the peer fails;
BGP Identifier field: (4 bytes) a device identifier of a routing device of the transmitting end;
opt Parm Len field: (1 byte) the length of the optional parameter, if 0, there is no optional parameter;
optional Parameters field: (variable bytes) optional parameters to extend BGP support for multiprotocol;
session capability type value field: (1 byte) a type value indicating the master-slave session capability, by which the session capability can be known;
session capability length field: (1 byte) represents the length of the master-slave session capability;
b field: (1 bit) session capability indicating the master-slave session capability of the TCP session, for example, 0 indicates the master session capability, and 1 indicates the slave session capability, where 0 is the master session capability identifier; 1 is the standby session capability identification.
A reserved field: (4 bits);
session ID field: (1 byte) TCP Session identification, e.g., Session ID of the first TCP Session is 1 and Session ID of the second TCP Session is 2.
It can be understood that, on the basis of the message structure of the original Open message, the master-slave Session capability field, the reserved field, and the Session ID field may also be added, which is not limited herein in the embodiment of the present invention.
Specifically, the routing device a sends a first Open message and a second Open message to the neighbor routing device B through a first TCP session and a second TCP session, respectively;
the first Open message may include a first session capability identifier indicating active/standby session capabilities, a device identifier of the routing device a, available address family information of the routing device a, and a first TCP session identifier, and the second Open message may include a second session capability identifier indicating active/standby session capabilities, a device identifier of the routing device a, available address family information of the routing device a, and a second TCP session identifier; the first TCP session identification is a session identification of the first TCP session and the second TCP session identification is a session identification of the second TCP session.
The routing device A receives a third Open message and a fourth Open message sent by the neighbor routing device B through a first TCP session and a second TCP session respectively;
the third Open message may include a third session capability identifier indicating the active/standby session capability, a device identifier of the routing device B, available address family information of the routing device B, and a first TCP session identifier, and the fourth Open message may include a fourth session capability identifier indicating the active/standby session capability, a device identifier of the routing device B, available address family information of the routing device B, and a second TCP session identifier.
If the first session capability identifier and the third session capability identifier are main session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, the routing device A determines the main and standby session capabilities of the first TCP session and the second TCP session according to the main and standby session capabilities set by the routing device A or initially configured by the neighboring routing device B;
for example, if the session capability set by the routing device a or the session capability set by the neighbor routing device B is the standby session capability set by the session capability of the first TCP session, and the session capability of the second TCP session is the master session capability, the routing device a determines the session capability of the first TCP session as the master session capability, and determines the session capability of the second TCP session as the standby session capability.
If the first session capability identifier is different from the third session capability identifier, for example, the first session capability identifier is a master session capability identifier, the third session capability identifier is a slave session capability identifier, the second session capability identifier is different from the fourth session capability identifier, for example, the second session capability identifier is a slave session capability identifier, and the fourth session capability identifier is a master session capability identifier, the routing device a determines a target routing device corresponding to the device identifier satisfying the preset rule, and determines master and slave session capabilities of the first TCP session and the second TCP session according to the master and slave session capabilities initially configured by the target routing device.
For example, taking the device identifier with the minimum device identifier of the preset rule as an example, if the target routing device corresponding to the smaller device identifier is the routing device a, that is, the device identifier of the routing device a is smaller than the device identifier of the neighboring routing device B, the routing device a determines, according to the session capability initially configured by itself, the session capability of the first TCP session as the primary session capability, and determines the session capability of the second TCP session as the standby session capability.
It can be understood that, since the routing device B receives the first Open message and the second Open message sent by the routing device a, the step of determining the active/standby session capabilities of the first TCP session and the second TCP session may be executed, and the active/standby session capabilities of the first TCP session and the second TCP session determined by the routing device B are the same as the determination result of the routing device a, that is, the specific determination process is the same as the determination result, and only the main bodies are executed differently, so that details of the embodiment of the present invention are not described here.
Further, if the device identifier of the routing device a and the device identifier of the neighbor routing device B are the same in size, the second Notification message and the third Notification message are sent to the neighbor routing device B through the first TCP session and the second TCP session, respectively.
As shown in fig. 3B, the message body of the Notification message may include:
error code field: (1 byte) error code, defining error type, non-specific error type is represented by zero;
errsubcode field: the (1 byte) error subcode refers to the detailed information of the error type, and the non-specific error detail number is represented by zero.
Data field: (variable byte) error data to assist in finding the cause of the error, the content of which depends on the specific error code and error subcode, may include the following:
Figure BDA0002303098720000231
as can be seen from the above list, the second Notification message includes information that the third Open message is incorrect, that is, the error code is 2, and the content of the error subcode is a BGP identifier error and a first TCP Session identifier, that is, the Session ID is 1; the third Notification message includes information that the fourth Open message is incorrect, that is, the error code is 2, the content of the error subcode is a BGP identifier error and the second TCP Session identifier, that is, the Session ID is 2.
And the neighbor routing equipment B disconnects the corresponding first TCP session and the second TCP session according to the received second Notification message and the third Notification message respectively.
It can be understood that, the routing device a also receives a Notification message that the neighbor routing device B sends the first Open message and the second Open message to the routing device a through the first TCP session and the second TCP session, respectively, so that the routing device a disconnects the first TCP session and the second TCP session, the specific process of which is the same as the process of executing the above-mentioned process, and only the main body of which is different, which is not described herein again in this embodiment of the present invention.
Acquiring the establishment time of the first TCP session and the establishment time of the second TCP session between the routing equipment A and the neighbor routing equipment B;
and determining the master-backup session capability of the first TCP session and the second TCP session according to the sequence of the establishment time.
Optionally, the session capability of the target TCP session with an earlier establishment time is determined as the master session capability, and the session capabilities of the TCP sessions other than the target TCP session are determined as the standby session capabilities.
For example, if the setup time of the first TCP session is earlier than the setup time of the second TCP session, routing device a determines the session capability of the first TCP session as the primary session capability and determines the session capability of the second TCP session as the standby session capability.
If the establishment time of the second TCP session is earlier than the establishment time of the first TCP session, the routing device A determines the session capability of the second TCP session as the main session capability and determines the session capability of the first TCP session as the standby session capability.
Then, the routing device a and the neighbor routing device B send respective Open messages through the first TCP session and the second TCP session, respectively, to interact BGP neighbor capability information of each other, such as available address family information, a device identifier of the routing device, a determined active/standby session capability, and the like, as in the first Open message, the second Open message, the third Open message, and the fourth Open message, which is not described herein again in the embodiments of the present invention.
It is understood that the step of the route device a performing an Open message interaction with the neighbor route device B during the BGP message communication may be performed before step 220, or after step 220, as shown by the dotted line in fig. 2.
It should be noted that the determination of the master-slave session capability of the first TCP session and the second TCP session includes, but is not limited to, the two setting manners described above, and the session capability of the first TCP session and the second TCP session that are established may also be set in a self-defined manner according to actual needs, that is, as long as the master-slave session capability of the first TCP session and the second TCP session can be determined, the embodiment of the present invention is not limited herein.
Step 230, the neighbor routing device B sends an Update message to the routing device a through the first TCP session.
After the session capabilities of the first TCP session and the second TCP session are set, for example, the session capability of the first TCP session is set as a master session capability, and the session capability of the second TCP session is set as a slave session capability.
Neighbor routing device B may send an Update message to routing device a via the first TCP session of the master session capability.
The Update message may include information such as an address prefix to be updated, a routing attribute, and the like. The address prefix to be updated may be an address prefix to be added or an address prefix to be revoked corresponding to a target address family in the available address family set of the first TCP session, where the target address family is any address family in the available address family set.
Step 240, after determining that the Update message has the setting error information, the routing device a marks the destination address family corresponding to the address prefix to be updated as a failure address family, and switches the master-backup session capability of the two TCP sessions.
The setting error information may be information that the BGP protocol specifies that the current TCP session needs to be disconnected, such as a lack of a next-hop routing attribute, an abnormal message structure, and the like.
The routing equipment A analyzes the setting information in the Update message according to a BGP protocol;
if the setting information in the Update message is not the setting error information, the routing device a processes the address prefix to be updated in the Update message. The setting information is any information carried by the Update message.
If the address prefix to be updated is the address prefix to be added, associating the address prefix to be added to a target address family in the available address family set of the first TCP session; and if the address prefix to be updated is the address prefix to be deleted, deleting the address prefix to be deleted from the address prefixes associated with the available address family set of the first TCP session.
If the setting information in the Update message is analyzed to be setting error information, the routing device a marks a target address family corresponding to the address prefix to be updated in the Update message as a failure address family, and adds the marked failure address family into a failure address family set of the first TCP session and a failure address family set of the second TCP session.
And then, switching the session capability of the first TCP session from the main session capability to the standby session capability, namely, BGP messages transmitted through the first TCP session carry standby session capability identifiers, switching the session capability of the second TCP session from the standby session capability to the main session capability, namely, BGP messages transmitted through the second TCP session carry standby main session capability identifiers, and simultaneously associating the address prefix of the available address family set associated with the first TCP session with the second TCP session and disassociating the address prefix from the first TCP session.
It will be appreciated that, to maintain consistency, the address prefixes associated with the set of available address families in the first TCP session include the same address prefixes and different address prefixes as the address prefixes associated with the set of available address families in the second TCP session. For the same address prefix, re-association can be carried out, and the association can also be ignored; this association is done for different address prefixes.
Step 250, the routing device a sends the first Capability message to the neighbor routing device B through the second TCP session.
The first Capability message may include removal information for removing the failed address family, a primary session Capability identifier, and a second TCP session identifier. The removal information may include a family of failed addresses to be removed and a removal indication.
As shown in fig. 3C, the message body of the Capability message may include:
Init/Ack field: (1 byte) indicates whether a function update is in progress, such as 0 indicating an update is in progress, 1 indicating an update is being acknowledged;
ack Request field: (1 byte) request acknowledge, 1 means request response, 0 means no response, to initiate a function update;
reserved field: (5 bytes) reserved bits, which the sender sets to 0 and which the receiver ignores;
an Action field: (1 byte) an action indication bit, 0 for an increment indication, 1 for a remove indication;
sequence Number field: (4 bytes) sequence number, used by the sender to match the sender's previously initiated acknowledgement of the modification of the function;
capability Code field: (1 byte) a supported capability number, the supported capability being a supported address family;
capability Length field: (2 bytes) represents the length of the Capability Value;
b field: (1 bit) session capability indicating the master-backup session capability of the TCP session, for example, 0 indicates the master session capability, and 1 indicates the backup session capability, where 0 is the master session identifier; 1 is the standby session identification.
A reserved field: (4 bits);
session ID field: (1 byte) Session identification, e.g., the Session ID of the first TCP Session is 1, and the Session ID of the second TCP Session is 2.
Step 260, the neighbor routing device B removes the failure address family from the available address family set of the second TCP session according to the received first Capability message, and switches the master-standby session Capability of the first TCP session and the second TCP session.
The neighbor routing device B analyzes the first Capability message to obtain removal information, removes the fault address family from the available address family set according to the removal information, associates the address prefix of the available address family set associated with the first TCP session with the second TCP session, and disassociates the address prefix of the available address family set from the first TCP session.
And the master-backup session capability of the two TCP sessions is switched.
Step 270, the neighbor router B sends the first Capability response packet to the router a through the second TCP session.
Optionally, while performing step 250, the routing device a may further send a third Capability message to the neighbor routing device B through the first TCP session, where the third Capability message may include removal information, a standby session Capability identifier, and the first TCP session identifier, so as to repeatedly instruct the neighbor routing device B to remove the failed address family. And after receiving the first Capability response packet corresponding to the first Capability packet and the third Capability response packet corresponding to the third Capability packet, the routing device a executes step 280.
Step 280, the routing device a sends the first Notification packet to the neighboring routing device B through the first TCP session, and disconnects the first TCP session.
The first Notification message includes information for resolving an error of the first Update message.
After sending the first Notification message to the neighbor routing device B, the routing device a disconnects the first TCP session.
Step 290, the neighbor routing device B disconnects the first TCP session according to the first Notification packet.
Then, the routing device a and the neighbor routing device B can transmit BGP messages of other normal address families through the second TCP session, which improves the stability of communication.
Further, in order to detect the current availability of the failed address family that was determined, after the preset time period of fig. 2 is finished, as shown in fig. 4, the following steps may be performed:
step 401, the routing device A and the neighbor routing device B establish a third TCP session;
the third TCP session identification of the third TCP session is different from both the first TCP session identification and the second TCP session identification.
Step 402, the routing device a and the neighbor routing device B interact with an Open message through a third TCP session.
To exchange BGP neighbor capability information between routing device a and neighbor routing device B with each other.
The interactive BGP neighbor capability information is the failed address family that was determined by routing device a or neighbor routing device B.
Specifically, the routing device a sends a fifth Open message to the neighboring routing device B, where the fifth Open message may include a device identifier of the routing device a and a failure address family that the routing device a has determined.
The neighbor routing device B sends a sixth Open message to the routing device a, where the sixth Open message may include a device identifier of the neighbor routing device B and a failure address family that the neighbor routing device B has determined.
Further, the routing device a determines, according to the Open message interacted with the neighbor routing device B, an address family to be tested of the third TCP session, where the address family to be tested may include a failure address family determined by the routing device a and a failure address family determined by the neighbor routing device B.
Step 403, the routing device a determines whether the address family to be tested is available according to the communication state between the routing device a and the neighboring routing device B within the preset time length.
Within a preset time, the routing device a and the neighboring routing device B may mutually interact and maintain a BGP message of a communication connection, such as a Keepalive message, an Update message, an Open message, and the like, where the BGP message may include a target address prefix, and the target address prefix is any address prefix associated with an address family to be detected.
If the routing device a and the neighbor routing device B are in a normal communication state within the preset duration, executing step 404;
if the routing device a and the neighbor routing device B are not in the normal communication state within the preset duration, executing step 410;
step 404, the routing device a determines that the address family to be tested is available, and marks the address family to be tested as an available address family of the second TCP session;
and the routing equipment A determines the availability of the address family to be tested, deletes the address family to be tested from the failure address family set of the second TCP session and adds the address family to be tested into the available address family set of the second TCP session.
Step 405, the routing device a sends a second Capability message to the neighbor routing device B through the second TCP session.
The second Capability message may include the addition information of the address family to be tested and the master session Capability identifier. The augmentation information of the address family to be tested may include the address family to be tested and an augmentation indication.
Alternatively, the second Capability message may only include the added information of the address family to be tested.
And step 406, the neighbor routing device B adds the address family to be tested to the available address family set of the second TCP session according to the received second Capability message.
Specifically, the neighbor routing device B analyzes the second Capability message to obtain the added information of the address family to be detected;
and deleting the address family to be tested from the fault address family set of the second TCP session according to the increasing information of the address family to be tested, and adding the address family to be tested into the available address family set of the second TCP session.
Step 407, the neighboring routing device B sends a second Capability response message to the routing device a according to the second Capability message.
Step 408, the routing device a sends a fourth Notification message to the neighboring routing device B through the third TCP session, and disconnects the third TCP session.
The fourth Notification message includes stop information, i.e., a stop error code.
Step 409, the neighbor routing device B disconnects the third TCP session according to the fourth Notification packet.
Step 410, the routing device a sends a fifth Notification message to the neighboring routing device B through the third TCP session, and disconnects the third TCP session, and continues to execute step 411.
And when the routing equipment A and the neighbor routing equipment B are not in a normal communication state within the preset time length, the routing equipment A determines that the address family to be detected is unavailable, and sends a fifth Notification message to the neighbor routing equipment B through a third TCP session.
The fifth Notification message includes information for analyzing the error of the second Update message, i.e., Update message error information with an error code of 3.
Step 411, the neighbor routing device B disconnects the third TCP session according to the fifth Notification packet.
It should be noted that, because the routing device a and the neighboring routing device B are peer devices, the routing device a may also perform the above steps performed by the routing device a, and the neighboring routing device B may also perform the corresponding steps performed by the neighboring routing device B. That is to say, after the execution bodies in the above method steps are interchanged, the stability of the BGP message communication in the present application may also be implemented, which is not described herein in detail in the embodiments of the present invention.
After a first TCP session and a second TCP session are established with a neighbor router device, the method for processing a transmission control protocol TCP session determines the master-standby session capability of the first TCP session and the second TCP session; if the first TCP session is determined to have the main session capability, receiving an updating message which is sent by the neighbor routing equipment and carries the setting information and the address prefix to be updated through the first TCP session, marking the address family corresponding to the address prefix to be updated as a failure address family after the setting information is determined to be error information, and adding the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session; switching the master-backup session capability of the first TCP session and the second TCP session; sending a first capability message carrying removal information of a failure address family and a main session capability identifier to neighbor routing equipment through a second TCP session, so that the neighbor routing equipment removes the failure address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after switching the main and standby session capabilities of the first TCP session and the second TCP session; if the first capability response message is received through the second TCP session, the first notification message is sent to the neighbor routing equipment through the first TCP session, and the first TCP session is disconnected, so that the neighbor routing equipment disconnects the first TCP session according to the first notification message, namely, the communication services of other normal address families can still be normally carried out through the second TCP session with the main session capability.
Corresponding to the foregoing method, an embodiment of the present invention further provides a processing apparatus for TCP session, which is applied to a routing device, where the routing device establishes a BGP neighbor with a neighbor routing device, and as shown in fig. 5, the apparatus includes: a determining unit 510, a receiving unit 520, a switching unit 530, or a transmitting unit 540;
a determining unit 510, configured to determine, after a first TCP session and a second TCP session are established with the neighbor router, master-standby session capabilities of the first TCP session and the second TCP session;
a receiving unit 520, configured to receive, if it is determined that the first TCP session has a master session capability, an update packet which is sent by the neighbor routing device and carries setting information and an address prefix to be updated through the first TCP session, and after it is determined that the setting information is error information, mark an address family corresponding to the address prefix to be updated as a failed address family, and add the address family corresponding to the address prefix to be updated into a failed address family set of the second TCP session;
a switching unit 530, configured to switch active/standby session capabilities of the first TCP session and the second TCP session;
a sending unit 540, configured to send a first capability packet carrying removal information of the failed address family and a master session capability identifier to the neighbor routing device through the second TCP session, so that the neighbor routing device removes the failed address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response packet after switching master and slave session capabilities of the first TCP session and the second TCP session;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session, so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
The functions of the functional units of the communication apparatus provided in the above embodiments of the present invention may be implemented by the above method steps, and therefore, detailed working processes and beneficial effects of the units in the communication apparatus provided in the embodiments of the present invention are not described herein again.
Corresponding to the foregoing method, an embodiment of the present invention further provides a processing apparatus for TCP session, which is applied to a neighbor routing device, where the neighbor routing device and a routing device establish a BGP neighbor, and as shown in fig. 6, the apparatus includes: a determination unit 610, a transmission unit 620, a reception unit 630, an addition unit 640, and a switching unit 650;
a determining unit 610, configured to determine, after a first TCP session and a second TCP session are established with the routing device, master-standby session capabilities of the first TCP session and the second TCP session;
a sending unit 620, configured to send, if it is determined that the first TCP session has a master session capability, an update packet carrying setting information and an address prefix to be updated to the routing device through the first TCP session, so that the routing device marks, after determining that the setting information is error information, an address family corresponding to the address prefix to be updated as a failed address family, adds the address family corresponding to the address prefix to be updated to a failed address family set of the second TCP session, switches master and slave session capabilities of the first TCP session and the second TCP session, and sends, through the second TCP session, a first capability packet carrying removal information of the failed address family and a master session capability identifier;
a receiving unit 630, configured to receive the first capability packet through the second TCP session;
an adding unit 640, configured to remove the failure address family from the available address family set of the second TCP session according to the removal information, and add the failure address family to the failure address family set of the second TCP session;
a switching unit 650, configured to switch active/standby session capabilities of the first TCP session and the second TCP session;
a sending unit 620, further configured to send a first capability response packet to the routing device, so that the routing device sends a first notification packet to the neighboring routing device through the first TCP session, and disconnects the first TCP session;
the receiving unit 630 is further configured to disconnect the first TCP session after receiving the first notification packet.
The functions of the functional units of the communication apparatus provided in the above embodiments of the present invention may be implemented by the above method steps, and therefore, detailed working processes and beneficial effects of the units in the communication apparatus provided in the embodiments of the present invention are not described herein again.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 710, a communication interface 720, a memory 730, and a communication bus 740, where the processor 710, the communication interface 720, and the memory 730 complete mutual communication through the communication bus 740.
A memory 730 for storing a computer program;
the processor 710, when executing the program stored in the memory 730, implements the following steps:
after a first TCP session and a second TCP session are established with the neighbor routing equipment, determining the master-standby session capability of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, receiving an update message which is sent by the neighbor routing equipment and carries setting information and an address prefix to be updated through the first TCP session, marking an address family corresponding to the address prefix to be updated as a failure address family after the setting information is determined to be error information, and adding the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session;
switching the master-backup session capability of the first TCP session and the second TCP session;
sending a first capability message carrying removal information of the fault address family and a main session capability identifier to the neighbor routing equipment through the second TCP session, so that the neighbor routing equipment removes the fault address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after switching the main and standby session capabilities of the first TCP session and the second TCP session;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
Or, the following steps are implemented:
after a first TCP session and a second TCP session are established with the routing equipment, determining the master-standby session capacity of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, sending an update message carrying setting information and an address prefix to be updated to the routing equipment through the first TCP session, so that the routing equipment marks an address family corresponding to the address prefix to be updated as a failure address family after determining that the setting information is error information, adds the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session, switches the main and standby session capabilities of the first TCP session and the second TCP session, and sends a first capability message carrying removal information of the failure address family and a main session capability identifier through the second TCP session;
receiving the first capability packet through the second TCP session;
removing the fault address family from the available address family set of the second TCP session according to the removal information, and switching the master-backup session capability of the first TCP session and the second TCP session after adding the fault address family into the fault address family set of the second TCP session;
sending a first capability response message to the routing equipment so that the routing equipment sends a first notification message to the neighbor routing equipment through the first TCP session and disconnects the first TCP session;
and disconnecting the first TCP session after receiving the first notification message.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Since the implementation manner and the beneficial effects of the problem solving of each device of the electronic device in the foregoing embodiment can be implemented by referring to each step in the embodiment shown in fig. 2, detailed working processes and beneficial effects of the electronic device provided by the embodiment of the present invention are not described herein again.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to execute the processing method of the TCP session in any one of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for processing a TCP session as described in any of the above embodiments.
As will be appreciated by one of skill in the art, the embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true scope of the embodiments of the present application.
It is apparent that those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the embodiments of the present application and their equivalents, the embodiments of the present application are also intended to include such modifications and variations.

Claims (16)

1. A processing method of Transmission Control Protocol (TCP) session is applied to a routing device, the routing device and a neighbor routing device establish a Border Gateway Protocol (BGP) neighbor, and the method is characterized by comprising the following steps:
after a first TCP session and a second TCP session are established with the neighbor routing equipment, determining the master-standby session capability of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, receiving an update message which is sent by the neighbor routing equipment and carries setting information and an address prefix to be updated through the first TCP session, marking an address family corresponding to the address prefix to be updated as a failure address family after the setting information is determined to be error information, and adding the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session;
switching the master-backup session capability of the first TCP session and the second TCP session;
sending a first capability message carrying removal information of the fault address family and a main session capability identifier to the neighbor routing equipment through the second TCP session, so that the neighbor routing equipment removes the fault address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after switching the main and standby session capabilities of the first TCP session and the second TCP session;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
2. The method of claim 1, wherein after establishing a first TCP session and a second TCP session with the neighbor routing device, and prior to determining master-standby session capabilities for the first TCP session and the second TCP session, the method further comprises:
respectively sending a first opening message and a second opening message to the neighbor routing device through the first TCP session and the second TCP session, so that the neighbor routing device determines the master-standby session capability of the first TCP session and the second TCP session, wherein the first opening message comprises a first session capability identifier representing the master-standby session capability, a device identifier of the routing device and available address family information of the routing device, and the second opening message comprises a second session capability identifier representing the master-standby session capability, a device identifier of the routing device and available address family information of the routing device;
receiving a third open packet and a fourth open packet sent by the neighbor routing device through the first TCP session and the second TCP session, respectively, where the third open packet and the fourth open packet are sent by the neighbor routing device after establishing the first TCP session and the second TCP session with the routing device, the third open packet includes a third session capability identifier indicating the master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device, and the fourth open packet includes a fourth session capability identifier indicating the master/standby session capability, a device identifier of the neighbor routing device, and available address family information of the neighbor routing device.
3. The method of claim 2, wherein determining master-standby session capabilities of the first TCP session and the second TCP session comprises:
if the first session capability identifier and the third session capability identifier are main session capability identifiers, and the second session capability identifier and the fourth session capability identifier are standby session capability identifiers, determining the main/standby session capabilities of the first TCP session and the second TCP session according to the main/standby session capabilities set by the routing equipment or initially configured by the neighbor routing equipment;
if the first session capability identifier is different from the third session capability identifier, and the second session capability identifier is different from the fourth session capability identifier, determining a target routing device corresponding to a device identifier meeting a preset rule, and determining the master-slave session capability of the first TCP session and the second TCP session according to the master-slave session capability initially configured by the target routing device.
4. The method of claim 3, wherein the method further comprises:
if the device identifier of the routing device and the device identifier of the neighbor routing device do not meet the preset rule, respectively sending a second notification message and a third notification message to the neighbor routing device through the first TCP session and the second TCP session, and disconnecting the first TCP session and the second TCP session, so that the neighbor routing device respectively disconnects the first TCP session and the second TCP session according to the second notification message and the third notification message.
5. The method of claim 1, wherein determining master-standby session capabilities of the first TCP session and the second TCP session comprises:
acquiring the establishment time of the first TCP session and the establishment time of the second TCP session;
and determining the master-backup session capability of the first TCP session and the second TCP session according to the sequence of the establishment time.
6. The method of any of claims 1-5, wherein the method further comprises:
establishing a third TCP session with the neighbor routing device;
sending a fifth open message to the neighbor routing device through the third TCP session, so that the neighbor routing device determines the master-standby session capability of the third TCP session, where the fifth open message includes a device identifier of the routing device and a failure address family of the routing device;
receiving a sixth open message sent by the neighbor routing device through the third TCP session, where the sixth open message is sent by the neighbor routing device after the third TCP session is established with the routing device, and the sixth open message includes a device identifier of the neighbor routing device and a failure address family of the neighbor routing device;
determining an address family to be tested of the third TCP session according to the fifth opening message and the sixth opening message, wherein the address family to be tested comprises a failure address family determined by the routing equipment and a failure address family determined by the neighbor routing equipment;
and determining whether the address family to be tested is available according to the communication state of the routing equipment and the neighbor routing equipment within a preset time length.
7. The method of claim 6, wherein determining whether the address family to be tested is available according to the communication status of the routing device and the neighboring routing device within a preset time period comprises:
if the address family to be tested is in a normal communication state with the neighbor routing equipment within the preset time length, determining that the address family to be tested is available, deleting the address family to be tested from the fault address family set of the second TCP session, and adding the address family to be tested into the available address family set of the second TCP session;
sending a second capability message carrying the added information of the address family to be tested and the main session capability identifier to the neighbor routing equipment through the second TCP session, so that the neighbor routing equipment sends a second capability response message after adding the address family to be tested in the available address family set of the second TCP session according to the added information;
and after receiving the second capability response message through the second TCP session, sending a fourth notification message to the neighbor routing equipment through the third TCP session, and disconnecting the third TCP session, so that the neighbor routing equipment disconnects the third TCP session according to the fourth notification message.
8. The method of claim 7, wherein the method further comprises:
if the routing equipment and the neighbor routing equipment are in an abnormal communication state within the preset time length, determining that the address family to be tested is unavailable;
and sending a fifth notification message to the neighbor routing equipment through a third TCP session, and disconnecting the third TCP session so that the neighbor routing equipment disconnects the third TCP session according to the fifth notification message.
9. A processing method of TCP session is applied to a neighbor router, the neighbor router and the router establish a Border Gateway Protocol (BGP) neighbor, and the method is characterized in that the method comprises the following steps:
after a first TCP session and a second TCP session are established with the routing equipment, determining the master-standby session capacity of the first TCP session and the second TCP session;
if the first TCP session is determined to have the main session capability, sending an update message carrying setting information and an address prefix to be updated to the routing equipment through the first TCP session, so that the routing equipment marks an address family corresponding to the address prefix to be updated as a failure address family after determining that the setting information is error information, adds the address family corresponding to the address prefix to be updated into a failure address family set of the second TCP session, switches the main and standby session capabilities of the first TCP session and the second TCP session, and sends a first capability message carrying removal information of the failure address family and a main session capability identifier through the second TCP session;
receiving the first capability packet through the second TCP session;
removing the fault address family from the available address family set of the second TCP session according to the removal information, and switching the master-backup session capability of the first TCP session and the second TCP session after adding the fault address family into the fault address family set of the second TCP session;
sending a first capability response message to the routing equipment so that the routing equipment sends a first notification message to the neighbor routing equipment through the first TCP session and disconnects the first TCP session;
and disconnecting the first TCP session after receiving the first notification message.
10. The method of claim 9, wherein the method further comprises:
establishing a third TCP session with the routing device;
receiving a fifth open message sent by the routing device through the third TCP session, where the fifth open message is sent by the routing device after the routing device establishes the third TCP session with the neighboring routing device, and the fifth open message includes a device identifier of the routing device and a failure address family of the routing device;
and sending a sixth opening message to the routing equipment through the third TCP session, so that the routing equipment determines the master-standby session capability of the third TCP session, determines an address family to be tested of the third TCP session according to the fifth opening message and the sixth opening message, wherein the address family to be tested comprises a failure address family which is determined by the routing equipment and a failure address family which is determined by the neighbor routing equipment, and determines whether the address family to be tested is available according to the communication state of the routing equipment and the neighbor routing equipment within a preset time length, and the sixth opening message comprises an equipment identifier of the neighbor routing equipment and the failure address family of the neighbor routing equipment.
11. The method of claim 10, wherein the method further comprises:
receiving, by the routing device, a second capability message that carries addition information of the address family to be tested and a master session capability identifier, which is sent by the routing device, through the second TCP session, where the second capability message is sent by the routing device after determining that the address family to be tested is available according to a normal communication state with the neighbor routing device within the preset time period, deleting the address family to be tested from a set of failed address families of the second TCP session, and adding the address family to be tested to the set of available address families of the second TCP session;
deleting the address family to be tested from the fault address family set of the second TCP session according to the increasing information, and adding the address family to be tested into the available address family set of the second TCP session;
sending a second capability response message to the routing equipment through the second TCP session, so that the routing equipment sends a fourth notification message to the neighbor routing equipment through the third TCP session according to the second capability response message;
and disconnecting the third TCP session after receiving the fourth notification message through the third TCP session.
12. The method of claim 11, wherein the method further comprises:
receiving a fifth notification message sent by the neighbor routing equipment through a third TCP session, wherein the fifth notification message is sent by the routing equipment after determining that the address family to be detected is unavailable according to the abnormal communication state of the routing equipment and the neighbor routing equipment in the preset time;
disconnecting the third TCP session according to the fifth notification message.
13. A processing device of a Transmission Control Protocol (TCP) session, applied in a routing device, the routing device and a neighbor routing device establish a Border Gateway Protocol (BGP) neighbor, the device comprising: a determining unit, a receiving unit, a switching unit or a transmitting unit;
the determining unit is configured to determine, after establishing a first TCP session and a second TCP session with the neighbor router, master-standby session capabilities of the first TCP session and the second TCP session;
the receiving unit is configured to receive, if it is determined that the first TCP session has a master session capability, an update packet which is sent by the neighbor routing device and carries setting information and an address prefix to be updated through the first TCP session, mark an address family corresponding to the address prefix to be updated as a failed address family after it is determined that the setting information is error information, and add the address family corresponding to the address prefix to be updated to a failed address family set of the second TCP session;
the switching unit is configured to switch the master-standby session capability of the first TCP session and the second TCP session;
the sending unit is configured to send a first capability message carrying removal information of the failed address family and a master session capability identifier to the neighbor routing device through the second TCP session, so that the neighbor routing device removes the failed address family from an available address family set of the second TCP session according to the removal information, and sends a first capability response message after master and slave session capabilities of the first TCP session and the second TCP session are switched;
and if the first capability response message is received through the second TCP session, sending a first notification message to the neighbor routing equipment through the first TCP session, and disconnecting the first TCP session, so that the neighbor routing equipment disconnects the first TCP session according to the first notification message.
14. A processing device of a Transmission Control Protocol (TCP) session is applied to a neighbor routing device, the neighbor routing device and the routing device establish a Border Gateway Protocol (BGP) neighbor, and the device is characterized by comprising: the device comprises a determining unit, a sending unit, a receiving unit, an adding unit and a switching unit;
the determining unit is configured to determine, after a first TCP session and a second TCP session are established with the routing device, master-standby session capabilities of the first TCP session and the second TCP session;
the sending unit is configured to send, if it is determined that the first TCP session has a master session capability, an update message carrying setting information and an address prefix to be updated to the routing device through the first TCP session, so that the routing device marks, after determining that the setting information is error information, an address family corresponding to the address prefix to be updated as a failed address family, adds the address family corresponding to the address prefix to be updated to a failed address family set of the second TCP session, switches master and slave session capabilities of the first TCP session and the second TCP session, and sends, through the second TCP session, a first capability message carrying removal information of the failed address family and a master session capability identifier;
the receiving unit is configured to receive the first capability packet through the second TCP session;
the adding unit is used for removing the failure address family from the available address family set of the second TCP session according to the removing information and adding the failure address family into the failure address family set of the second TCP session;
the switching unit is configured to switch the master-standby session capability of the first TCP session and the second TCP session;
the sending unit is further configured to send a first capability response packet to the routing device, so that the routing device sends a first notification packet to the neighboring routing device through the first TCP session, and disconnects the first TCP session;
the receiving unit is further configured to disconnect the first TCP session after receiving the first notification packet.
15. An electronic device, characterized in that the electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1 to 8 or the method steps of any one of claims 9 to 12 when executing a program stored on a memory.
16. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any of the claims 1-8 or carries out the method steps of any of the claims 9-12.
CN201911229289.3A 2019-12-04 2019-12-04 Processing method and device of Transmission Control Protocol (TCP) session Active CN110932970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911229289.3A CN110932970B (en) 2019-12-04 2019-12-04 Processing method and device of Transmission Control Protocol (TCP) session

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911229289.3A CN110932970B (en) 2019-12-04 2019-12-04 Processing method and device of Transmission Control Protocol (TCP) session

Publications (2)

Publication Number Publication Date
CN110932970A CN110932970A (en) 2020-03-27
CN110932970B true CN110932970B (en) 2022-03-18

Family

ID=69856734

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911229289.3A Active CN110932970B (en) 2019-12-04 2019-12-04 Processing method and device of Transmission Control Protocol (TCP) session

Country Status (1)

Country Link
CN (1) CN110932970B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113839859B (en) * 2020-06-23 2023-05-23 华为技术有限公司 Message notification method and related device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005142843A (en) * 2003-11-06 2005-06-02 Nippon Telegr & Teleph Corp <Ntt> Method and system for master/slave communication
CN101471940A (en) * 2007-12-28 2009-07-01 华为技术有限公司 Method, system and device for synchronizing BGP route
US7801135B2 (en) * 2005-05-19 2010-09-21 Cisco Technology, Inc. Transport protocol connection synchronization
CN102202004A (en) * 2011-07-08 2011-09-28 福建星网锐捷网络有限公司 Routing error processing method and device and routing equipment
CN104539530A (en) * 2015-01-13 2015-04-22 重庆金美通信有限责任公司 Host/standby switching uninterrupted forwarding method
US9264301B1 (en) * 2012-09-20 2016-02-16 Wiretap Ventures, LLC High availability for software defined networks
CN105790965A (en) * 2014-12-17 2016-07-20 中兴通讯股份有限公司 Method and device for link switching and line card
CN107395424A (en) * 2017-07-31 2017-11-24 江西山水光电科技股份有限公司 A kind of method for realizing TCP connections backup
CN109951388A (en) * 2019-03-29 2019-06-28 新华三技术有限公司 Route non-interrupted method and master control borad

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005142843A (en) * 2003-11-06 2005-06-02 Nippon Telegr & Teleph Corp <Ntt> Method and system for master/slave communication
US7801135B2 (en) * 2005-05-19 2010-09-21 Cisco Technology, Inc. Transport protocol connection synchronization
CN101471940A (en) * 2007-12-28 2009-07-01 华为技术有限公司 Method, system and device for synchronizing BGP route
CN102202004A (en) * 2011-07-08 2011-09-28 福建星网锐捷网络有限公司 Routing error processing method and device and routing equipment
US9264301B1 (en) * 2012-09-20 2016-02-16 Wiretap Ventures, LLC High availability for software defined networks
CN105790965A (en) * 2014-12-17 2016-07-20 中兴通讯股份有限公司 Method and device for link switching and line card
CN104539530A (en) * 2015-01-13 2015-04-22 重庆金美通信有限责任公司 Host/standby switching uninterrupted forwarding method
CN107395424A (en) * 2017-07-31 2017-11-24 江西山水光电科技股份有限公司 A kind of method for realizing TCP connections backup
CN109951388A (en) * 2019-03-29 2019-06-28 新华三技术有限公司 Route non-interrupted method and master control borad

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Design and Implementation of Master-slave Network Communication Based on TCP and UDP";Changyuan Liu等;《IEEE》;20190808;全文 *
"基于TCP连接修复的高可靠性主备倒换研究";钱枫等;《信息技术》;20180604;全文 *

Also Published As

Publication number Publication date
CN110932970A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
EP3070890B1 (en) Multicast flow overlay using registration over a reliable transport
TWI583151B (en) System and method for implementing and managing virtual networks
US8121136B2 (en) Dynamic discovery mechanisms via inter-domain routing protocol
TWI461030B (en) Rsvp-te graceful restart under fast re-route conditions
CA2536457C (en) Ttl exploration technique for determining capabilities and configuration of a peer router
US10404544B2 (en) Network topology determining method and apparatus, and centralized network status information storage device
CN102624745B (en) Method and device for establishing PCEP session
WO2022022366A1 (en) Tunnel bfd session establishment method and device
US20230010837A1 (en) Fault diagnosis method and apparatus thereof
EP4191966A1 (en) Method and device for processing data message, storage medium, and electronic device
CN102202004A (en) Routing error processing method and device and routing equipment
CN110932970B (en) Processing method and device of Transmission Control Protocol (TCP) session
WO2015096707A1 (en) Method, device and system for acquiring information about configuration server
US20160380864A1 (en) Network wide source group tag binding propagation
CN111464440A (en) Communication method and device
CN107231249B (en) Method for acquiring physical topology information of forwarding node, controller and forwarding node
WO2014019157A1 (en) Communication path processing method and apparatus
Crabbe et al. Path computation element communication protocol (pcep) extensions for stateful pce
CN111327530B (en) Data sending method and device, network system and switch
CN111464441A (en) Communication method and device
CN104270307A (en) Establishing method and device for BGP neighborhood
CN110601982B (en) Route transmission method and device and router
CN115022240A (en) Path establishing method and device, storage medium and electronic device
CN111585796A (en) Interface switching method, message transmission method and gateway equipment
CN108259292B (en) Method and device for establishing tunnel

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant