CN113490162A - Optimization method for multicast data stream forwarding - Google Patents
Optimization method for multicast data stream forwarding Download PDFInfo
- Publication number
- CN113490162A CN113490162A CN202110754049.6A CN202110754049A CN113490162A CN 113490162 A CN113490162 A CN 113490162A CN 202110754049 A CN202110754049 A CN 202110754049A CN 113490162 A CN113490162 A CN 113490162A
- Authority
- CN
- China
- Prior art keywords
- multicast
- data stream
- interface
- linux kernel
- function
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/06—Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
- H04W4/08—User group management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W40/00—Communication routing or communication path finding
- H04W40/02—Communication route or path selection, e.g. power-based or shortest path routing
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses an optimization method for forwarding multicast data stream under linux, which comprises the following steps: registering a function handle _ multicast _ frame _ hook for processing the multicast data stream in a handling function __, a broadcast _ receive _ skb _ core, for receiving the data packet by the linux kernel; when the igmp proxy adds a multicast routing forwarding item to the linux kernel, the igmp proxy sends a corresponding binding relationship between a multicast group and an outgoing interface to the linux kernel through a proc file, a handle _ multicast _ frame _ hook function searches the outgoing interface of the corresponding multicast group according to a received multicast data stream, and then directly calls a sending function ndo _ start _ xmit of the outgoing interface to send the multicast data stream out of the outgoing interface.
Description
Technical Field
The invention relates to the technical field of multicast data stream, in particular to an optimization method for forwarding multicast data stream.
Background
Currently, the operation of the igmp proxy under Linux depends on an mroute module in Linux kernel, and the flow of the igmp proxy is as follows:
the igmp proxy user process firstly creates an igmp raw socket (igmp original socket) for receiving an igmp packet, and simultaneously activates an mroute function in a Linux kernel through MRT _ INIT.
And 2, the igmp proxy user process creates a VIF virtual network device in the linux kernel through MRT _ ADD _ VIF, and then continuously monitors the igmp raw socket.
3. When receiving a join group message sent by a host on a downlink interface from an igmp raw socket, if the host is the first host in the network, the igmp proxy creates a new multicast routing table to record the multicast group, and simultaneously starts an uplink interface to send the join group message upwards.
4. When the upstream interface receives the data stream of the group, the igmp proxy adds the multicast routing forwarding item of the group, and the Linux kernel forwards the multicast data stream according to the multicast routing forwarding item.
5. When receiving a leave group message sent by a host on a downlink interface from an igmp raw socket, if the host is the last host in the network, the igmp proxy deletes the multicast routing table, deletes a multicast routing forwarding item in a linux kernel, and starts an uplink interface to send the leave group message upwards.
6. When receiving general group query and specific group query messages sent by an uplink interface from an igmp raw socket, the igmp proxy searches a multicast routing table to see whether a multicast group exists, and responds to the multicast query of a server if the multicast group exists.
Forwarding of the multicast data stream of the igmp proxy under the normal linux is to determine an interface from which the multicast data stream should be sent by searching a corresponding multicast route forwarding item at the ip layer. Therefore, forwarding must be processed by filtering of each hook function of the netfilter, routing of the ip layer and the like, and forwarding efficiency is affected.
The method of the invention uses a processing function handle _ multicast _ frame _ hook for registering the multicast data stream in a processing function __ nertif _ receive _ skb _ core for receiving the data packet by linux kernel, and finds the outgoing interface of the multicast data stream according to the corresponding binding relationship between the multicast group and the outgoing interface in the function, thereby directly forwarding the multicast data stream from the corresponding outgoing interface at the inlet. Therefore, the processing flow of the multicast data stream can be simplified, and the forwarding efficiency of the multicast data stream is improved.
Disclosure of Invention
The invention aims to provide an optimization method for multicast data stream forwarding, which can reduce the processing of multicast data streams in linux kernel when a large number of multicast data streams needing to be forwarded exist in linux kernel, thereby improving the forwarding efficiency of the multicast data streams under linux kernel and solving the problems provided in the background art.
In order to achieve the purpose, the invention provides the following technical scheme:
an optimization method for multicast data stream forwarding specifically comprises the following steps:
(1) firstly, creating and registering a linux kernel module gcmulticast, wherein the module is used for maintaining the corresponding binding relationship between a multicast group and an outgoing interface and providing a processing function handle _ multicast _ frame _ hook for a registered multicast data stream.
The module provides a corresponding interface for reading and writing the binding relation corresponding to the multicast group and the output interface, and the interface is opened to a user space through a proc file system and is provided for a user space process igmp proxy to use.
(2) Under linux, when a multicast data stream arrives, linux kernel sends a message to igmp proxy, and igmp proxy ADDs a multicast routing forwarding item to linux kernel through MRT _ ADD _ MFC when receiving the multicast data stream arrival message.
And adding the multicast routing forwarding item, and adding the binding relationship between the multicast group and the corresponding output interface into the kernel through a proc interface provided by the kernel module gcmulticast.
When the igmp proxy receives a leave group message sent by a host on a downlink interface, if the host is the last host in the networking, the igmp proxy deletes the multicast routing table, and meanwhile, deletes a multicast routing forwarding item in the linux kernel through the MRT _ DEL _ MFC. And deleting the binding relation between the multicast group and the corresponding output interface from the kernel through a proc interface provided by the kernel module gcmulticast while deleting the multicast routing forwarding item.
(3) The function handle _ multicast _ frame _ hook for processing the multicast data stream is registered in the processing function __, new _ receive _ skb _ core, which receives the packet in the linux kernel. The handle _ multicast _ frame _ hook is implemented in a linux kernel module gcmulticast, the function filters the multicast data packet according to the destination address of the data packet, and if the multicast data packet is not the multicast data packet, the function returns directly.
Then, searching a binding relation between the multicast group and a corresponding output interface according to the destination address of the multicast data packet, and if the corresponding output interface is found, directly sending the data packet out from the output interface without executing the subsequent receiving process; if the outgoing interface is not found, the function directly returns to continue executing the subsequent receiving process.
Compared with the prior art, the invention has the advantages that:
1. the method provided by the invention can improve the forwarding efficiency of the multicast data stream in the linux kernel.
2. Under the condition that no special hardware is used for realizing hardware forwarding of the multicast data stream, the forwarding of the multicast data stream is optimized on a software level, and the processing flow of the multicast data stream in linux kernel is simplified.
Drawings
FIG. 1 is a flowchart of maintaining a binding relationship between a multicast group and an egress interface in a kernel module gcmulticast according to the present invention.
Fig. 2 is a flowchart illustrating a process of processing a function handle _ multicast _ frame _ hook for processing a multicast data stream according to the present invention.
Detailed Description
The technical solution of the present patent will be described in further detail with reference to the following embodiments.
Currently, multicast forwarding realized through the igmp proxy under linux is to maintain a multicast routing table in the igmp proxy, and when a multicast data stream arrives, a multicast routing forwarding table entry is added to linux kernel through the igmp proxy, so that the multicast data stream is forwarded through a multicast routing forwarding item in linux kernel.
An optimization method for multicast data stream forwarding specifically comprises the following steps:
step 1: as shown in FIG. 1, a kernel module gcmulticast is created first; gcmulticast is used for maintaining the binding relationship between the multicast group and the output interface under linux kernel, and the data structure for binding is as follows:
#define MAX_OUT_IF 4
#define IFNAMSIZ 16
typedef struct gcGroupBindInterface_s
{
unsigned int group;
char if_name[MAX_OUT_IF][IFNAMSIZ];
struct list_head list;
}gcGroupBindInterface_t;
group: representing a multicast group; IF _ name represents an egress interface, and the maximum number of egress interfaces that the same group can support is defined by the macro MAX _ OUT _ IF.
Step 2: the gcmulticast kernel module firstly initializes a multicast group and output interface binding relation list g _ group, and then initializes a corresponding proc interface for reading and writing the multicast group and output interface binding relation. When a multicast data stream arrives, the igmp proxy calls a corresponding proc interface to add a binding relationship between a multicast group and an output interface to gcmulticast while adding a multicast route forwarding item. And dynamically allocating a gcGroupBindInterface _ t structure in the gcmulticast to store the binding relationship, and simultaneously inserting the dynamically allocated gcGroupBindInterface _ t structure into a g _ group list.
And step 3: when the igmp proxy receives a leave group message sent by a host on a downlink interface, if the host is the last host in the networking, the igmp proxy calls a corresponding proc interface to delete the binding relationship between the multicast group and the exit interface in gcmulticast while deleting the multicast routing forwarding item in linux kernel. And searching a corresponding gcGroupBindInterface _ t structure according to the corresponding multicast group in the gcmulticast, deleting the structure from the g _ group list, and releasing a corresponding memory.
And 4, step 4: the gcmulticast kernel module provides a function handle _ multicast _ frame _ hook for processing multicast data streams, which is registered in __ nertif _ receive _ skb _ core. The flow of processing for multicast data streams is shown in fig. 2. The function firstly judges whether the destination address of the received data packet is a multicast address, and if not, the function directly returns to 0; if the multicast address is the reserved multicast address, then judging whether the multicast address is the reserved multicast address, and if so, directly returning to 0; and if not, inquiring a corresponding outgoing interface from the g _ group list according to the destination address of the data packet, if the corresponding outgoing interface is found, sending the data packet out from the corresponding outgoing interface and returning the function to 1, and if the corresponding outgoing interface cannot be found, directly returning to 0. __ the return value of handle _ multicast _ frame _ hook is determined to determine whether the packet continues to be received.
And 5: when the gcmulticast kernel module is logout, the corresponding proc interface is deleted firstly, then the g _ group list is traversed, the binding relationship between all multicast groups and the output interface is deleted, and the corresponding memory is released at the same time.
Although the preferred embodiments of the present patent have been described in detail, the present patent is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present patent within the knowledge of those skilled in the art.
Claims (3)
1. An optimization method for forwarding multicast data streams is characterized by comprising the following steps:
(1) firstly, registering a function handle _ multicast _ frame _ hook for processing a multicast data stream in a processing function __ (recent _ receive _ skb _ core) for receiving a data packet by a linux kernel;
(2) when a multicast data stream is received for the first time, the igmp proxy adds a multicast routing forwarding item to the Linux kernel, and simultaneously the igmp proxy sends the corresponding binding relationship between a multicast group and an output interface to the Linux kernel through a proc interface;
(3) firstly, detecting whether a destination address of a data packet is a multicast address or not in handle _ multicast _ frame _ hook, and excluding a reserved multicast address; then, according to the destination ip address of the data packet, searching the corresponding binding relationship between the multicast group issued by the igmp proxy and the output interface; if the corresponding output interface can not be found, the function returns to 0, and the data packet continues to go down according to the receiving path; if the corresponding outgoing interface is found, the data packet is directly sent out from the outgoing interface according to the found outgoing interface, and meanwhile, the function returns to 1, __, the function returns to _ receive _ skb _ core directly.
2. The method of claim 1, wherein the function handle _ multicast _ frame _ hook is used to parse and process the multicast data stream.
3. The method of claim 1, wherein the handle _ multicast _ frame _ hook is implemented in linux kernel module gcmulticast.
The method of claim 3, wherein the gcmulticast module is configured to maintain a corresponding binding relationship between a multicast group and an egress interface.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110754049.6A CN113490162B (en) | 2021-07-04 | 2021-07-04 | Optimization method for multicast data stream forwarding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110754049.6A CN113490162B (en) | 2021-07-04 | 2021-07-04 | Optimization method for multicast data stream forwarding |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113490162A true CN113490162A (en) | 2021-10-08 |
CN113490162B CN113490162B (en) | 2022-05-17 |
Family
ID=77939847
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110754049.6A Active CN113490162B (en) | 2021-07-04 | 2021-07-04 | Optimization method for multicast data stream forwarding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113490162B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1474563A (en) * | 2002-08-06 | 2004-02-11 | ��Ϊ��������˾ | Repeating method for multi-broadcast message in network communication |
CN101702672A (en) * | 2009-11-04 | 2010-05-05 | 华为技术有限公司 | Forwarding method and forwarding device for multicast data message |
CN102316083A (en) * | 2010-07-06 | 2012-01-11 | 杭州华三通信技术有限公司 | Method and device for realizing multicast service in Internet protocol (IP) network |
CN102694734A (en) * | 2012-06-11 | 2012-09-26 | 烽火通信科技股份有限公司 | Multicasting method of double-layer switching equipment based on Linux kernel bridge |
CN102820977A (en) * | 2012-08-07 | 2012-12-12 | 福建星网锐捷网络有限公司 | Multicast method, multicast device and network device |
CN104796340A (en) * | 2014-01-22 | 2015-07-22 | 杭州华三通信技术有限公司 | Multicast data transmission method and device |
CN106470171A (en) * | 2016-09-18 | 2017-03-01 | 杭州迪普科技股份有限公司 | The delivery method of multicast forwarding list item and device |
WO2018121584A1 (en) * | 2016-12-30 | 2018-07-05 | 中兴通讯股份有限公司 | Data stream transmission method, apparatus, related devices and storage medium |
CN109495406A (en) * | 2017-09-13 | 2019-03-19 | 中兴通讯股份有限公司 | The retransmission method and forwarding device of multicasting virtual private network network VPN flow |
-
2021
- 2021-07-04 CN CN202110754049.6A patent/CN113490162B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1474563A (en) * | 2002-08-06 | 2004-02-11 | ��Ϊ��������˾ | Repeating method for multi-broadcast message in network communication |
CN101702672A (en) * | 2009-11-04 | 2010-05-05 | 华为技术有限公司 | Forwarding method and forwarding device for multicast data message |
CN102316083A (en) * | 2010-07-06 | 2012-01-11 | 杭州华三通信技术有限公司 | Method and device for realizing multicast service in Internet protocol (IP) network |
CN102694734A (en) * | 2012-06-11 | 2012-09-26 | 烽火通信科技股份有限公司 | Multicasting method of double-layer switching equipment based on Linux kernel bridge |
CN102820977A (en) * | 2012-08-07 | 2012-12-12 | 福建星网锐捷网络有限公司 | Multicast method, multicast device and network device |
CN104796340A (en) * | 2014-01-22 | 2015-07-22 | 杭州华三通信技术有限公司 | Multicast data transmission method and device |
CN106470171A (en) * | 2016-09-18 | 2017-03-01 | 杭州迪普科技股份有限公司 | The delivery method of multicast forwarding list item and device |
WO2018121584A1 (en) * | 2016-12-30 | 2018-07-05 | 中兴通讯股份有限公司 | Data stream transmission method, apparatus, related devices and storage medium |
CN109495406A (en) * | 2017-09-13 | 2019-03-19 | 中兴通讯股份有限公司 | The retransmission method and forwarding device of multicasting virtual private network network VPN flow |
Non-Patent Citations (2)
Title |
---|
刘杰等: "嵌入式Linux上的IGMPProxy研究与实现", 《武汉理工大学学报·信息与管理工程版》 * |
许广达: "基于IGMP的IPTV应用系统设计", 《硕士学位论文 专辑:信息科技 专题:电信技术》 * |
Also Published As
Publication number | Publication date |
---|---|
CN113490162B (en) | 2022-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10097689B2 (en) | System and methods for integrating short message service messaging with contact center applications | |
CN101409685B (en) | Forwarding method based on virtual LAN mapping and access equipment | |
US6178453B1 (en) | Virtual circuit switching architecture | |
US7031338B2 (en) | System and method for the consolidation of data packets | |
CN100566282C (en) | The Apparatus and method for of control transmitting multicast data | |
US20070011350A1 (en) | Method and apparatus for multicast management of user interface in a network access device | |
RU2007134860A (en) | METHOD AND SYSTEM OF INTELLECTUAL ROUTING | |
WO2013075436A1 (en) | Radio resource optimization method, device and system | |
CN106685827B (en) | Downlink message forwarding method and AP (access point) equipment | |
CN101184053B (en) | LAN export link selecting method, device and routing device | |
CN101304389A (en) | Method, apparatus and system for processing packet | |
CN109587082A (en) | A kind of asynchronous repeater system of message based on (SuSE) Linux OS and method | |
CN112751788A (en) | Double-plane switching method supporting multi-type frame mixed transmission | |
CN114866528A (en) | Data communication method based on MQTT and Websocket | |
US8819135B2 (en) | Method of performing data mediation, and an associated computer program product, data mediation device and information system | |
US20060209774A1 (en) | Wireless base station, wireless mobile device, and wireless access network | |
EP1917580B1 (en) | Peer-to-peer communication system | |
CN113490162B (en) | Optimization method for multicast data stream forwarding | |
CN101110786B (en) | Unified information system based on soft switching network | |
CN107483628A (en) | Unidirectional proxy method and system based on DPDK | |
CN101227306A (en) | Method and apparatus for copying message for multi-broadcast treatment | |
US9596577B1 (en) | Relaying mobile communications | |
CN100455049C (en) | Method for processing message in multimedia message service system | |
CN113422741B (en) | Time-triggered Ethernet switch structure | |
CN113206791B (en) | Message forwarding method and device |
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 |