Linux vlan processing system for virtual group architecture
By using the virtual group architecture and virtual group management of the gcnet system, the problems of high resource consumption and inconsistent models in existing VLAN processing technologies are solved, enabling flexible VLAN processing and a unified device model, supporting complex application scenarios.
Patent Information
- Application Number
- CN202310167214.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-02-27
AI Technical Summary
Existing VLAN processing technologies consume a lot of resources and have high system design complexity when dealing with complex VLAN applications. Furthermore, the bridging and routing forwarding models are inconsistent, which cannot meet the needs of multi-VLAN scenarios.
The Linux VLAN processing system (gcnet system) adopts a virtual group architecture, which manages real devices through gcnet virtual devices and virtual groups, provides a unified device model, supports flexible VLAN processing and mapping, including gcnet virtual groups, resource management within virtual groups, and VLAN preprocessing/editing tables, and realizes unified VLAN conversion and routing forwarding.
It reduces system resource consumption, simplifies management complexity, supports complex VLAN applications such as QinQ, policy VLANs and VLAN conversion, and provides a unified device model for easy portability and management.
Smart Images

Figure CN116208441B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of VLAN processing, and particularly relates to a Linux VLAN processing system based on a virtual group architecture. BACKGROUND
[0002] As one of the most basic functions in a network, VLAN (Virtual Local Area Network) is mainly used to isolate collision domains and broadcast domains, and has a good effect on improving the security and communication efficiency of the network. In a Linux network system, technologies such as VLAN virtual devices and VLAN filters are also provided to meet the needs of VLAN forwarding.
[0003] A VLAN virtual device is configured through a vconfig command, and a corresponding virtual device is created on a real device (usually a physical network card) according to a VLAN. A forwarding system is established through the virtual device for subsequent learning and forwarding.
[0004] As shown in FIG. 1, a typical bridge forwarding model using VLAN virtual devices. The forwarding model is implemented between eth0 and eth1 ports to forward services of VLAN 10 and VLAN 20. The virtual devices ethx.10 and ethx.20 of VLAN 10 and VLAN 20 are respectively created on the two real devices eth0 and eth1 through vconfig. The virtual devices of the same VLAN are added to the same bridge device to realize forwarding between devices of the same VLAN. Different bridge devices are used to realize forwarding isolation between different VLANs. Figure 1
[0005] VLAN virtual devices are more commonly used for routing forwarding, as shown in FIG. 2, a routing forwarding model. Different IPs cannot be configured on a single physical network card to realize routing. Instead, the eth0.10 and eth0.20 devices are virtually created, and IP addresses and routing rules are created on the devices to realize routing intercommunication between VLAN 10 and VLAN 20. Figure 2
[0006] Due to the one-to-one mapping between VLAN virtual devices and VLANs, when the environment needs to support a large number of VLANs, a large number of VLAN virtual devices need to be created, which greatly consumes system resources. In a bridge forwarding system, although VLAN filters can be used to replace VLAN virtual devices to realize VLAN-based bridge forwarding, avoiding the system consumption caused by too many virtual devices, but it cannot meet the routing forwarding model, resulting in inconsistent device models of the bridge and routing forwarding systems, increasing the complexity of system design.
[0007] In addition, whether the VLAN filter or the VLAN virtual device is used to build the VLAN-based forwarding system, only simple VLAN forwarding processing can be met. However, when facing the increasingly complex VLAN application, the VLAN-based forwarding system cannot meet the requirement.
[0008] For example:
[0009] 1) Processing of VLAN based on MAC, IP, protocol and the like; different MAC, IP and protocol are divided into VLAN, and forwarding is performed.
[0010] 2) QinQ use scenario of the operator network; addition and stripping of the Service VLAN Tag need to be implemented at the boundary of the operator network.
[0011] 3) VLAN conversion scenario; conversion between the user VLAN and the operator service VLAN is implemented.
[0012] The existing solution is to stack the private module on the basis of the virtual device to process the above complex VLAN application. The VLAN special processing is embedded in the private module, which undoubtedly increases the coupling degree with the standard kernel. Meanwhile, the coupling degree is further increased due to the model difference between the bridging and the routing caused by the insufficient flexibility of the conventional virtual device, and the portability is poor. In addition, the dispersed virtual device and the VLAN processing management increase the complexity of the system management and reduce the clarity of the system design logic. SUMMARY
[0013] The purpose of the present application is to provide a Linux VLAN processing system based on a virtual group architecture to solve the problems in the background art.
[0014] To achieve the above purpose, the present application provides the following technical solution:
[0015] The Linux VLAN processing system based on the virtual group architecture adopts the VLAN processing system based on the virtual group architecture to provide a unified device model solution for the bridging and routing system of the Linux kernel;
[0016] The VLAN processing system based on the virtual group architecture is referred to as a gcnet system; the virtual device introduced by the gcnet system is referred to as a gcnet virtual device;
[0017] The gcnet system adopts the forwarding architecture of the virtual device to meet the VLAN perception of the kernel protocol stack; the gcnet system processes the conversion between the real device and the gcnet virtual device, and the kernel protocol stack learns and forwards through the gcnet virtual device;
[0018] The gcnet system introduces a gcnet virtual group to manage and maintain the gcnet virtual device related to a real device and a rule configuration table thereof; each real device corresponds to a gcnet virtual group, and the information between the virtual groups is independent of each other;
[0019] The gcnet system acts on the message receiving and sending processing flow;
[0020] The gcnet system provides a Hook function of receiving processing, which is mounted in the receiving processing function of the kernel protocol stack, leads the message into the receiving processing flow of the gcnet system, and completes the VLAN preprocessing and the mapping of the virtual device; after the receiving device of the message is replaced by the gcnet virtual device, the message is sent to the network protocol stack for learning and forwarding;
[0021] If the forwarding device is also a virtual device supporting the gcnet system processing, the sending processing function of the forwarding virtual device will be called; and when the sending processing function of the gcnet virtual device is registered, the sending processing function of the gcnet system is defined, so that the message enters the sending processing flow of the gcnet system; in the gcnet system sending processing flow, the VLAN editing processing is performed, and then the message is converted back to the real device for sending.
[0022] Further, the organization form between the virtual groups includes but is not limited to a sequential table, a hash table and a linked list; the virtual group centrally manages all resources of the same device entity, and can conveniently and quickly find and preview all VLAN processing related information of the entity.
[0023] Further, the information needed to be maintained in the virtual group includes:
[0024] 1) Real device: the virtual group is established on a specific real device; there is only one real device in each virtual group; each real device can only exist in one virtual group;
[0025] 2) Virtual device table: each virtual group creates a gcnet virtual device as needed, and there can be 0 or more; when there are 0, a virtual group can be selected to be created; the virtual device tables between different virtual groups are independent of each other; the gcnet virtual device is a standard Linux network device with gcnet private information, which is registered through the register_netdev() function;
[0026] 3) Mapping rule table: used to configure special gcnet virtual device mapping rules as a supplement to the conventional mapping mode;
[0027] 4) VLAN preprocessing table: a classification rule configuration table for VLAN preprocessing of the packet; preprocessing is performed on the VLAN information of the original packet before virtual device mapping in the receiving processing flow, for pre-editing processing of the VLAN information of the original packet, for pre-stripping of the Service VLAN Tag after receiving the packet from the operator side, or for VLAN division based on the host under the policy VLAN application; it is also commonly used for VLAN conversion processing;
[0028] 5) VLAN editing table: a classification rule configuration table for VLAN editing processing of the packet; VLAN editing is performed on the VLAN information of the packet before the sending function of the real device is called to send the packet, for adding the operator Service VLAN Tag when sending from the operator side of QinQ, or for VLAN conversion in the sending stage.
[0029] Further: the real device can be a physical network device or other virtual device; the real device needs to have the ability to receive and send packets from the real network.
[0030] Further: the specific organization form of the virtual device table, the mapping rule table, the VLAN preprocessing table, and the VLAN editing table is not limited, and can adopt a sequential table, a linked list, or a hash table.
[0031] Further: the receiving processing of the gcnet system enters the receiving processing flow of the gcnet system by calling the gcnet system receiving processing Hook at the packet receiving processing of the kernel protocol stack; the receiving processing is divided into two processing logics:
[0032] 1) VLAN preprocessing:
[0033] The VLAN of the packet is edited according to the configured VLAN preprocessing table, including addition, deletion, and modification of VLAN Tag information, and the VLAN Tag information includes TPID, VLAN ID, and Priority;
[0034] The VLAN preprocessing table is a flow classification configuration table; according to the position of the VLAN preprocessing in the processing flow, the classification criteria can cover the original packet content and the packet descriptor when receiving, and the specific classification criteria is not limited and can be flexibly tailored according to the demand; when used for policy VLAN, the classification criteria of source MAC, source IP, and IP protocol number are supported, and in some QinQ and VLAN conversion applications, VLAN and receiving device are commonly used as classification criteria; the operation of VLAN preprocessing is addition, deletion, and modification of VLAN Tag information;
[0035] 2) Virtual device mapping processing:
[0036] The gcnet virtual device is a standard Linux network device carrying private information; it is registered through the register_netdev() function; its private information mainly includes the following information:
[0037] a) A pointer to the virtual group for quick lookup of the virtual group to which it belongs;
[0038] b) The VLAN to which the virtual device belongs;
[0039] c) Other information for virtual device mapping, including VLAN mode and parameters, for mapping and filtering;
[0040] The receiving device of the packet can only be mapped to one of the virtual devices in the virtual group to which the real device belongs;
[0041] The gcnet system supports custom mapping rules through an additional special mapping rule table to meet flexible and diverse needs; the mapping priority of the special mapping table is higher than that of the VID mapping rule, and when the special mapping table rule is configured, the mapping logic of the special mapping table rule is used as the reference; the special mapping table uses a flow classification table, which can classify the flow according to the content of the packet and the receiving descriptor information, and then perform mapping filtering or specify the virtual device; the special mapping rule table can be optionally supported according to needs.
[0042] Further: the gcnet virtual device is divided into ordinary virtual devices and zero virtual devices;
[0043] The ordinary virtual device is used to carry the processing of a specific VLAN, and is used to create a three-layer interface to configure an independent IP through the virtual device to build a routing and forwarding system, and can also be used for bridge ports to distinguish and forward specific VLANs; the VLAN processing of the ordinary virtual device is relatively simple, as it carries a specific VLAN, it can only receive and process packets of the specific VLAN, and packets sent through the virtual device will be attached with the Tag of the VLAN;
[0044] The zero virtual device is used as the default virtual device and is commonly used to carry the processing of multiple VLANs; as it carries non-unique VLANs, its VLAN information is 0; its mapping processing relies on the VLAN mode and parameters in the private information of the virtual device to filter packets of specific VLANs using the zero virtual device.
[0045] Further: the ordinary virtual device and the zero virtual device can be used together to meet complex application scenarios; in general, the number of ordinary virtual devices in the same virtual group is determined according to needs, and the zero virtual device can have none or only one default virtual device.
[0046] Further: the gcnet system's sending processing:
[0047] When the gcnet system registers a virtual device, the registered sending processing function is the sending processing function of the gcnet system; when forwarding through the virtual device, the network protocol stack is called, so as to enter the sending processing logic of the gcnet system; the sending processing of the gcnet includes two processing logics of VLAN editing and real device conversion;
[0048] 1) VLAN editing processing:
[0049] The VLAN editing is the last VLAN editing processing of a message before forwarding in a sending flow; it is commonly used for adding an outer service VLAN tag when QinQ is sent on the side of an operator;
[0050] 2) Real device conversion processing:
[0051] Since there is only one real device in the virtual group where the virtual device is located, direct conversion can be performed.
[0052] Further, the VLAN editing processing is the same as the VLAN preprocessing, a flow classification configuration table is adopted, the VLAN editing table is preconfigured, the content of a message during forwarding and a sending descriptor are classified and matched; the classification standards supported can be selected according to specific applications;
[0053] The VLAN tag information including a TPID, a VLAN ID and a Priority field can be added, edited and deleted for the message matched successfully.
[0054] Compared with the prior art, the beneficial effects of the present application are as follows:
[0055] 1. The gcnet virtual device based on a standard Linux network device interacts with the Linux kernel through a standard network device registration flow; except that a processing hook of the gcnet system needs to be mounted in a kernel receiving processing function, there is no other coupling on the code, so as to facilitate transplantation.
[0056] 2. The architecture based on a virtual group is clear in resource division; the resources in the group can be centrally and uniformly managed, so as to facilitate searching and previewing; the resources between groups are independent of each other.
[0057] 3. The flexible virtual device type and mapping management mechanism can provide a unified device model scheme for building a bridging and routing system.
[0058] 4. The introduction of a zero virtual device can reduce the use amount of virtual devices and save system resources when only kernel transparent multi-VLAN services are needed.
[0059] 5. The embedded flexible VLAN pre-processing and VLAN editing processing logic, supporting complex VLAN processing in the receiving and transmitting process, meeting the applications such as QinQ, policy VLAN and VLAN conversion. BRIEF DESCRIPTION OF DRAWINGS
[0060] Figure 1 The structure diagram of the existing VLAN virtual device based bridge forwarding model.
[0061] Figure 2 The structure diagram of the existing VLAN virtual device based routing forwarding model.
[0062] Figure 3 The structure diagram of the network device model based on the gcnet system of the present application.
[0063] Figure 4 The structure diagram of the important information of the gcnet virtual group and the linked list organization form thereof in the present application.
[0064] Figure 5 The structure diagram of the gcnet system forwarding logic in the present application.
[0065] Figure 6 The structure diagram of the host based policy VLAN processing in the present application.
[0066] Figure 7 The virtual device table and mapping diagram in the virtual group of the present application.
[0067] Figure 8 The virtual device mapping example diagram in the specific embodiment of the present application.
[0068] Figure 9 The routing forwarding system diagram constructed by using the gcnet system in the specific embodiment of the present application.
[0069] Figure 10 The bridge forwarding system diagram constructed by using the gcnet system in the specific embodiment of the present application.
[0070] Figure 11 The bridge transparent transmission system diagram constructed by using the gcnet system in the specific embodiment of the present application. DETAILED DESCRIPTION
[0071] The technical solution of the present application will be further described in detail in combination with the specific embodiments.
[0072] A Linux VLAN processing system based on a virtual group architecture provides a unified device model solution for building bridging and routing systems in the Linux kernel. With its flexible mapping management and embedded classification VLAN processing, it can meet the needs of complex applications such as policy VLAN, QinQ and VLAN conversion. At the same time, its virtual group-based architecture design facilitates centralized management of all resources of the same device entity.
[0073] The VLAN processing system using a virtual group architecture implemented in this invention is called the gcnet system.
[0074] The gcnet system still uses a virtual device forwarding architecture to satisfy the kernel protocol stack's awareness of VLANs. The virtual devices introduced by the gcnet system are called gcnet virtual devices.
[0075] like Figure 3 As shown, the gcnet system handles the conversion between physical devices and gcnet virtual devices, while the kernel protocol stack learns and forwards data through gcnet virtual devices.
[0076] The GCNET system uses GCNET virtual groups to manage and maintain GCNET virtual devices associated with physical devices, along with their various rule configuration tables. Each physical device corresponds to one GCNET virtual group, and the information between virtual groups is independent of each other. The virtual groups are organized using methods such as linked lists.
[0077] This invention does not limit the specific organizational form of virtual groups; they can also be organized using sequential lists or hash tables, etc. Figure 4 The diagram shows an organization using a doubly linked list.
[0078] The information that needs to be maintained within the virtual group includes:
[0079] 1) Real Devices: Virtual groups are built on specific real devices; each virtual group has one and only one real device; each real device can only exist in one virtual group. Real devices can be physical network devices, such as eth0, eth1, etc., or other virtual devices, such as tun0, tun1, etc. Real devices must have the ability to receive and send packets from the real network.
[0080] 2) Virtual Device Table: Each virtual group creates gcnet virtual devices as needed; zero or more can exist. When zero virtual devices exist, a virtual group can be created (sometimes virtual groups are needed to implement simple VLAN switching, etc.). The virtual device tables of different virtual groups are independent of each other. gcnet virtual devices are standard Linux network devices with gcnet private information, registered using the register_netdev() function.
[0081] 3) Mapping rule table: used for configuring special gcnet virtual device mapping rules as a supplement to the regular mapping mode.
[0082] 4) VLAN preprocessing table: used for configuring classification rule tables for VLAN preprocessing of the message. The preprocessing is performed on the VLAN information of the original message before virtual device mapping in the receiving processing flow, and is used for stripping the Service VLAN Tag in advance after receiving the message from the operator side in QinQ, or dividing VLANs based on the lower hanging host in policy VLAN application, etc. It is also commonly used for VLAN conversion processing, etc.
[0083] 5) VLAN editing table: used for configuring classification rule tables for VLAN editing processing of the message. The VLAN editing is performed on the VLAN information of the message before sending the message by calling the real device sending function, and is commonly used for adding the operator Service VLAN Tag in the processing of sending from the QinQ operator side, or VLAN conversion in the sending stage, etc.
[0084] According to the needs, other important information such as virtual group name, ID, etc. can be added. The virtual group centrally manages all resources of the same device entity, and can conveniently and quickly find and preview all VLAN processing related information of the entity.
[0085] The specific organization form of the virtual device table, the mapping rule table, the VLAN preprocessing table and the VLAN editing table in the application is not limited, and can adopt a sequential table, a linked list or a hash table, etc.
[0086] The gcnet system acts on the message receiving and sending processing flow. As shown in Figure 5 , the gcnet system provides a Hook function of receiving processing, which is mounted in the receiving processing function of the kernel protocol stack, leads the message into the receiving processing flow of the gcnet system, and completes the VLAN preprocessing and the mapping of the virtual device. After the receiving device of the message is replaced by the gcnet virtual device, the message is sent to the network protocol stack for learning and forwarding. If the forwarding device is also a virtual device supporting the gcnet system processing, the sending processing function of the forwarding virtual device will be called. When the sending processing function of the gcnet virtual device is registered, the sending processing function of the gcnet system is defined, so that the message enters the sending processing flow of the gcnet system. In the gcnet system sending processing flow, the VLAN editing processing is performed, and then the message is converted back to the real device for sending.
[0087] gcnet system receiving processing
[0088] The receiving process is divided into two processing logics by calling the gcnet system receiving process Hook into the receiving process flow of the gcnet system at the receiving processing of the kernel protocol stack.
[0089] 1) VLAN preprocessing:
[0090] The VLAN of the packet is edited according to the configured VLAN preprocessing table, including adding, deleting and modifying VLAN Tag (virtual local area network tag) information, and the VLAN Tag information includes TPID, VLAN ID and Priority.
[0091] The VLAN preprocessing table is a flow classification configuration table. According to the position of the VLAN preprocessing in the processing flow, the classification criteria can cover the original packet content and the packet descriptor (such as the receiving device, the receiving timestamp, the VLAN Tag feature, etc.) when receiving. The specific classification criteria is not limited in the design and can be flexibly tailored according to the requirements. Usually used for policy VLAN, supporting source MAC, source IP and IP protocol number classification criteria, and in some QinQ and VLAN conversion applications, VLAN and receiving device are often used as classification criteria. The operation of VLAN preprocessing is adding, deleting and modifying VLAN Tag information.
[0092] As shown in Figure 6 , the example of pre-classification processing is a typical policy VLAN based on host IP, which allocates different VLANs for the hosts connected thereto. For the packet from the host IP 192.168.1.20, after processing, the Tag of VLAN 20 will be added, and the packet will be forwarded in VLAN 20.
[0093] 2) Virtual device mapping processing:
[0094] The gcnet virtual device of the design is a standard Linux network device carrying private information. It is registered by the register_netdev() function. The private information mainly includes the following information:
[0095] a) A pointer to a virtual group for quick lookup of the belonging gcnet virtual group;
[0096] b) The VLAN to which the virtual device belongs;
[0097] c) Other information for virtual device mapping, such as VLAN mode and parameters, for mapping and filtering.
[0098] The gcnet virtual device is divided into ordinary virtual device and zero virtual device.
[0099] Common virtual device, used to carry the processing of a specific VLAN, is often used to create a three-layer interface, and an independent IP is configured through the virtual device to build a routing and forwarding system. It can also be used for bridge ports to distinguish and forward specific VLANs. The VLAN processing of the common virtual device is relatively simple. Since it carries a specific VLAN, it can only receive and process packets of a specific VLAN, and packets sent through this virtual device will be attached with the Tag of this VLAN.
[0100] Zero virtual device, used as a default virtual device, is often used to carry the processing of multiple VLANs. Since the VLAN it carries is not unique, its VLAN information is 0. Its mapping processing depends on the VLAN mode and parameter information in the virtual device private information to filter packets of a specific VLAN using the zero virtual device. The introduction of the zero virtual device can reduce the number of virtual devices created when the kernel transmits multiple VLAN services, thereby reducing the consumption of system resources. However, when using the zero virtual device to serve multiple VLANs, the kernel cannot distinguish between different VLAN services, and is only suitable for kernel transmission processing occasions.
[0101] Common virtual devices and zero virtual devices can be used together to meet complex application scenarios. In general, the number of common virtual devices in the same virtual group is determined according to the needs, and there can be no or only one zero virtual device for the default virtual device.
[0102] The receiving device of the packet can only be mapped to one of the virtual devices in the virtual group to which the real device belongs. As shown in Figure 7 , the VLAN ID of the packet is first used to find the common virtual device with the same VLAN ID attribute in the virtual group. If not found, the VLAN mode and parameters of the zero virtual device are used to determine whether the zero virtual device can be used for mapping and filtering. The specific filtering algorithm using VLAN mode and parameters is not limited in the design of the present application and can be defined according to the needs.
[0103] The gcnet system supports custom mapping rules through an additional special mapping rule table to meet flexible and variable needs. The mapping priority of the special mapping table is higher than that of the VID mapping rule. When the special mapping table rule is configured, the mapping logic of the special mapping table rule is used as the standard. The special mapping table uses a flow classification table, which can classify flows according to the content of the packet and the receiving descriptor information, and then perform mapping filtering or specify a virtual device. The special mapping rule table can be optionally supported according to the needs.
[0104] As shown in Figure 8As shown, the use of zero virtual device is configured by a special mapping table. VLAN 1-4 are mapped to virtual devices eth0.1-eth0.4 respectively according to the VID, and VLAN 5-6 are mapped to zero virtual device eth0.0 according to the configuration of the special rule table. And for the rest of the VLANs, according to the configuration of the special mapping table, the mapping filtering is realized by discarding processing.
[0105] gcnet system sending processing
[0106] When the gcnet system registers a virtual device, the registered sending processing function is the sending processing function of the gcnet system. When forwarding through the virtual device, the network protocol stack is called, so as to enter the sending processing logic of the gcnet system. The sending processing of the gcnet includes two processing logics of VLAN editing and real device conversion.
[0107] 1) VLAN editing processing:
[0108] VLAN editing is the last VLAN editing processing of a message before forwarding in the sending process. It is commonly used for adding an outer Service VLAN Tag when QinQ is sent on the operator side.
[0109] The VLAN editing processing is the same as the VLAN preprocessing, and adopts a flow classification configuration table. The preconfigured VLAN editing table is used to classify and match the content of the message during forwarding and the sending descriptor (sending device, sending timestamp, VLAN Tag feature, etc.). The supported classification standards can be selected according to specific applications.
[0110] For the message that is classified and matched successfully, the addition, editing and deletion of VLAN Tag information are supported. The VLAN Tag information includes TPID, VLAN ID and Priority fields.
[0111] 2) Real device conversion processing:
[0112] Since the virtual group in which the virtual device is located has and only has one real device, direct conversion is available.
[0113] A forwarding system model embodiment designed and constructed by the application
[0114] Taking the application of a home gateway as an example, the device model of the routing forwarding system constructed by the gcnet system is as follows: Figure 9As shown, the WAN side creates corresponding normal virtual devices according to the VLANs to which the WAN belongs, for receiving downlink packets with specific VLANs, and the packets forwarded through the virtual devices are assigned with the VLAN Tags of the VLANs to which the WAN belongs. The LAN side uses two normal virtual devices, lan0.10 and lan0.20, to respectively receive and send packets with VLAN 10 and VLAN 20, and lan0.0 is used as a zero virtual device for receiving and sending untagged packets.
[0115] The same model can also be applied to a bridging forwarding system, such as Figure 10 As shown, the difference is that the virtual devices on the LAN and WAN sides are added to the corresponding bridges for forwarding. Since different virtual devices are used to serve different VLANs, the kernel protocol stack can easily implement VLAN isolation and filtering according to the virtual devices.
[0116] For the bridge transparent processing, the system can be directly constructed through the zero virtual device. As shown, Figure 11 As shown, the zero virtual devices lan0.0 and wan0.0 on the LAN and WAN sides can be used to carry packets with all VLANs and untagged VLANs, without creating corresponding virtual devices for each VLAN, thereby reducing the consumption of device resources. For the VLANs that need filtering processing, special mapping rule tables can be used to filter the packets of specific VLANs.
[0117] The present application realizes the virtual group architecture, centrally manages the resources within the entity, and independently manages the resources between entities; realizes the zero virtual device, carries multiple VLAN applications in the transparent processing; realizes the special mapping configuration table, flexibly implements various mapping and filtering requirements; integrates the VLAN preprocessing and editing processing, supports complex applications such as QinQ and policy VLAN; designs the gcnet virtual device based on the standard Linux network device, interacts with the kernel through registration, and reduces the coupling degree with the kernel code.
[0118] The above describes the preferred embodiments of the present application in detail, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the spirit of the present application.
Claims
1. A Linux VLAN processing system with a virtual group architecture, characterized in that, The VLAN processing system using a virtual group architecture provides a unified device model solution for building bridging and routing systems for the Linux kernel; A VLAN processing system that uses a virtual group architecture is called a gcnet system; virtual devices introduced by the gcnet system are called gcnet virtual devices. The gcnet system uses a virtual device forwarding architecture to satisfy the kernel protocol stack's awareness of VLANs; the gcnet system handles the conversion between physical devices and gcnet virtual devices, while the kernel protocol stack learns and forwards through gcnet virtual devices; The GCNET system introduces GCNET virtual groups to manage and maintain GCNET virtual devices related to physical devices, as well as their rule configuration tables; each physical device corresponds to one GCNET virtual group, and the information between virtual groups is independent of each other; The gcnet system operates within the message receiving and sending processing flow; The gcnet system provides a Hook function for receiving and processing packets, which is mounted in the receiving and processing function of the kernel protocol stack. This function imports packets into the receiving and processing flow of the gcnet system, completing VLAN preprocessing and mapping of virtual devices. After the receiving device of the packet is replaced with the gcnet virtual device, it is sent to the network protocol stack for learning and forwarding. If the forwarding device is also a virtual device that supports GCNET system processing, the forwarding virtual device's sending processing function will be called; and this sending processing function is the GCNET system's sending processing function defined when the GCNET virtual device is registered, thus allowing the packet to enter the GCNET system's sending processing flow. In the gcnet system's transmission process, after VLAN editing, the data is switched back to the physical device for transmission. The information that needs to be maintained within the virtual group includes: 1) Real device: A virtual group is built on a specific real device; there is one and only one real device in each virtual group; each real device can only exist in one virtual group; 2) Virtual Device Table: Each virtual group creates gcnet virtual devices as needed, with 0 or more existing devices; when 0 devices exist, a virtual group can be created; the virtual device tables of different virtual groups are independent of each other; gcnet virtual devices are standard Linux network devices with gcnet private information, and are registered using the register_netdev() function; 3) Mapping rule table: Used to configure special GCNET virtual device mapping rules, as a supplement to the regular mapping mode; 4) VLAN Preprocessing Table: This table is used to configure classification rules for VLAN preprocessing of packets. Preprocessing is done in the receiving process before virtual device mapping. It pre-edits the VLAN information of the original packets. This is used by QinQ to remove the Service VLAN Tag in advance after receiving packets from the operator, or to divide VLANs based on the downstream host in policy VLAN applications. It is also used for VLAN conversion processing. 5) VLAN Editing Table: A classification rule configuration table for packet VLAN editing processing; VLAN editing enables the final editing and modification of the VLAN information of the packet before calling the actual device's send function to send the packet. It is used to add the operator's Service VLAN Tag when sending on the QinQ operator side, or to perform VLAN conversion during the sending phase.
2. The Linux VLAN processing system with virtual group architecture according to claim 1, characterized in that, The organization of the virtual groups includes one or more of sequential lists, hash tables, and linked lists; the virtual groups centrally manage all resources of the same device entity and can search and preview all VLAN processing related information of the entity.
3. The Linux VLAN processing system with virtual group architecture according to claim 1, characterized in that, The physical device is a physical network device or other virtual device; the physical device must have the ability to receive and send messages from the real network.
4. The Linux VLAN processing system with virtual group architecture according to claim 1, characterized in that, The specific organization of the virtual device table, mapping rule table, VLAN preprocessing table, and VLAN editing table can be one or more of the following: sequential table, linked list, or hash table.
5. The Linux VLAN processing system with virtual group architecture according to claim 1, characterized in that, The gcnet system's receiving and processing logic is accessed by calling the gcnet system's receiving and processing hook at the kernel protocol stack's receiving and processing point. The receiving and processing logic consists of two parts: 1) VLAN preprocessing: Edit the VLANs of the packets according to the configured VLAN preprocessing table, including adding, deleting and modifying VLAN tag information. VLAN tag information includes TPID, VLAN ID and Priority. The VLAN preprocessing table is a flow classification configuration table; Based on the position of VLAN preprocessing in the processing flow, its classification criteria cover both the original message content and the message descriptor at the time of reception. When used for policy VLANs, the classification criteria include source MAC, source IP, and IP protocol number. However, in QinQ and VLAN conversion applications, VLAN and receiving device are used as the classification criteria. VLAN preprocessing operations involve adding, deleting, and modifying VLAN tag information. 2) Virtual device mapping processing: gcnet virtual devices are standard Linux network devices that carry private information; they are registered using the register_netdev() function. Its private information mainly includes the following: a) A pointer to a virtual group, which facilitates quick location of the gcnet virtual group to which the virtual group belongs; b) The VLAN to which the virtual device belongs; c) Other information used for virtual device mapping, for mapping and filtering, including VLAN modes and parameters; The receiving device of a message can only be mapped to one of the virtual devices within the virtual group to which the physical device belongs; The gcnet system supports custom mapping rules through an additional special mapping rule table. The mapping priority of the special mapping table is higher than that of the VID mapping rule. When a special mapping table rule is configured, the mapping logic of the special mapping table rule shall prevail. The special mapping table adopts a flow classification table, which classifies the flow first according to the content of the packet and the receive descriptor information, and then performs mapping filtering or specifies the virtual device. Special mapping rule tables can be optionally supported as needed.
6. The Linux VLAN processing system with virtual group architecture according to claim 5, characterized in that, The GCNET virtual devices are divided into two types: ordinary virtual devices and zero virtual devices. A regular virtual device is used to handle the processing of a specific VLAN. After creating a Layer 3 interface, an independent IP address can be configured through this virtual device to build a routing and forwarding system, or it can be used to bridge ports for differentiated forwarding of specific VLANs. A regular virtual device is used to receive and process packets of a specific VLAN, and packets sent through this virtual device will be tagged with this VLAN. Zero virtual device, used as the default virtual device, is used to handle the processing of multiple VLANs; Because the VLAN it carries is not unique, its VLAN information is 0; Its mapping process relies on the VLAN mode and parameter information in the virtual device's private information to filter packets of a specific VLAN using zero virtual devices.
7. The Linux VLAN processing system with virtual group architecture according to claim 6, characterized in that, The ordinary virtual devices and zero virtual devices are used together to meet complex application scenarios; the number of ordinary virtual devices in the same virtual group depends on the requirements, while there may be no zero virtual devices or only one for use as the default virtual device.
8. The Linux VLAN processing system with virtual group architecture according to claim 1, characterized in that, The sending process of the gcnet system: When registering a virtual device, the GCNET system registers the GCNET system's sending processing function. When forwarding through the virtual device, it is called by the network protocol stack, thus entering the GCNET system's sending processing logic. GCNET's sending processing is divided into two processing logics: VLAN editing and real device conversion. 1) VLAN editing and processing: VLAN editing is the final VLAN editing process performed on packets before forwarding during the transmission process; it is used by QinQ to add an outer Service VLAN tag when sending to the carrier side. 2) Equipment conversion processing: Since the virtual group containing the virtual device has only one physical device, it can be directly converted.
9. The Linux VLAN processing system with virtual group architecture according to claim 8, characterized in that, The VLAN editing process is similar to VLAN preprocessing, using a flow classification configuration table. The pre-configured VLAN editing table is used to classify and match the packet content and sending descriptor during forwarding. The supported classification criteria can be selected according to the specific application. For packets that are successfully classified and matched, it is possible to add, edit, and delete VLAN tag information; VLAN tag information includes TPID, VLAN ID, and Priority fields.
Citation Information
Patent Citations
Method and device for realizing flexible bridging service on home gateway
CN111683308A