Data control method, device, equipment and medium based on FTTR

Through the dynamic data management and control method based on FTTR on the gateway device and the differentiated application of target control rules and sub-rules, the problem of low reliability of data management and control of the gateway device is solved, and more efficient and reliable data management and control effects are achieved.

CN118660248BActive Publication Date: 2024-10-29SICHUAN TIANYI COMHEART TELECOM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411147991.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-10-29
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In the existing technology, gateway devices have low reliability during data management and control, resulting in poor management and control effects.

Method used

Adopt the FTTR-based data management and control method, realize the dynamic configuration and application of target management and control rules on the gateway device, select different sub-rules according to the current time period for data management and control of the packets to be processed, and use the system kernel and data packets of the Linux operating system The filtering firewall mechanism performs data filtering and discarding operations to avoid direct data control in the network protocol stack.

Benefits of technology

It improves the gateway's data control effect, enhances the reliability and adaptability of management and control, avoids limited data parsing functions and errors in the network protocol stack, and improves the problem of poor gateway data control effect in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118660248B_ABST
    Figure CN118660248B_ABST
Patent Text Reader

Abstract

The data control method and device, equipment and medium based on FTTR provided in the present application relate to the field of network communication technology. In the present application, firstly, in response to the serial port instruction or the remote protocol command, the target control application of the gateway device is subjected to rule configuration operation to form the corresponding target control rule; secondly, after the target control rule is configured and formed, and when the received message to be processed is transmitted to the network protocol stack of the system kernel, the message to be processed can be obtained from the network protocol stack through the target control application; then, the target control application can be used to determine the target sub-rule from the target control rule including the first sub-rule and the second sub-rule based on the time period to which the current time belongs, and perform data control operation on the message to be processed according to the target sub-rule. Based on the above content, the problem of poor gateway data control effect existing in the prior art can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a data control method and apparatus, device and medium based on FTTR. Background Art

[0002] The communications industry is constantly accelerating the upgrade of optical bandwidth, and the continuous improvement of network infrastructure such as optical access (such as FTTR, Fiber to The Room, is a fiber access architecture in the field of communications technology, which aims to lay optical fiber directly to each room), which has brought convenience to our lives. At the same time, innovative business applications are also increasing, such as online games, online education, TikTok, online videos, online shopping, online chat, etc. Therefore, higher and higher requirements are put forward for network security, network access control, etc. However, the inventors have found that in the prior art, the gateway device has relatively poor reliability when controlling the corresponding data, resulting in poor control effect. Summary of the invention

[0003] In view of this, the purpose of this application is to provide a data control method and device, equipment and medium based on FTTR to improve the problem of poor data control effect in the prior art.

[0004] To achieve the above objectives, this application adopts the following technical solutions:

[0005] A data control method based on FTTR is applied to a gateway device, wherein the gateway device has a Linux operating system, and the Linux operating system has a system kernel. The data control method based on FTTR includes:

[0006] In response to the received serial port instruction or remote protocol command, a rule configuration operation is performed on the target control application of the gateway device to form a target control rule corresponding to the target control application, wherein the target control rule includes at least a first sub-rule and a second sub-rule, at least part of the rule content between the first sub-rule and the second sub-rule is different, and the target control application adopts the first sub-rule in a first time period, and adopts the second sub-rule in a second time period different from the first time period;

[0007] After the target control rule is configured and formed, and when the received message to be processed is transmitted to the network protocol stack of the system kernel, the message to be processed is obtained from the network protocol stack through the target control application, wherein the message to be processed belongs to a message transmitted from the terminal device to the gateway device through the FTTR system, or a message transmitted from other network devices to the gateway device and needs to be transmitted from the gateway device to the terminal device through the FTTR system;

[0008] Through the target control application, based on the time period to which the current time belongs, a target sub-rule is determined from the first sub-rule and the second sub-rule included in the target control rule, and data control operations are performed on the message to be processed according to the target sub-rule.

[0009] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the target control application determines the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performs data control operations on the to-be-processed message according to the target sub-rule, including:

[0010] By means of the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule, wherein the target control application belongs to a data packet filtering firewall, and the data packet filtering firewall obtains the to-be-processed message from the network protocol stack through a configured hook function, and the to-be-processed message belongs to a message transmitted from the terminal device to the gateway device through the FTTR system;

[0011] Through the target control application, the message to be processed is imported into the FORWARD chain of the filter table, and in the FORWARD chain, according to the target sub-rule, the data control operation is performed on the message to be processed, wherein the filter table belongs to the table in the data packet filtering firewall used to filter the data packet, and the FORWARD chain belongs to the main chain of the filter table.

[0012] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the step of importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and performing data control operations on the to-be-processed message in the FORWARD chain according to the target sub-rule, includes:

[0013] Importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and importing the to-be-processed message into the first-level subchain in the FORWARD chain, and importing the to-be-processed message from the first-level subchain into the second-level subchain;

[0014] In the second-level subchain, the MAC address of the message to be processed is matched and confirmed with the pre-configured MAC address set, and when matching, the message to be processed is marked, and the IP address of the marked message to be processed is matched and confirmed with the pre-configured IP address set to obtain a corresponding IP address matching confirmation result;

[0015] When the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received;

[0016] When the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, a receiving operation is performed on the message to be processed; or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, a discarding operation is performed on the message to be processed.

[0017] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the step of importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and performing data control operations on the to-be-processed message in the FORWARD chain according to the target sub-rule, includes:

[0018] Importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and importing the to-be-processed message into the first-level subchain in the FORWARD chain, and importing the to-be-processed message from the first-level subchain into the second-level subchain;

[0019] In the second-level subchain, the IP address of the message to be processed is matched and confirmed with a pre-configured IP address set to obtain a corresponding IP address matching confirmation result;

[0020] When the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received;

[0021] When the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, a receiving operation is performed on the message to be processed; or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, a discarding operation is performed on the message to be processed.

[0022] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the step of determining the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs through the target control application, and performing data control operations on the to-be-processed message according to the target sub-rule, also includes:

[0023] After discarding the message to be processed, mapping the MAC address and IP address of the message to be processed through the target control application to obtain a first address mapping parameter and a second address mapping parameter corresponding to the message to be processed;

[0024] In a pre-constructed target log file, determining whether there is target log data that matches the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed, wherein the discarded historical message recorded in the target log data is a historical message whose MAC address and IP address match the MAC address and IP address of the message to be processed and whose discard operation execution time is the most recent, and the time interval between the discard operation execution time of the discarded historical message recorded in the target log data and the discard operation execution time of the message to be processed is less than a pre-configured reference time interval;

[0025] When the target log data is present in the target log file, determining not to record the discarding operation of the to-be-processed message;

[0026] When the target log data is not present in the target log file, the discard operation of the message to be processed is recorded and processed to form log data corresponding to the message to be processed in the target log file, wherein the log data includes the MAC address, IP address, operation type or operation content of the discard operation and execution time of the discard operation of the message to be processed.

[0027] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the target control application determines the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performs data control operations on the to-be-processed message according to the target sub-rule, including:

[0028] By means of the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule, wherein the target control application belongs to a DNS proxy application, and the message to be processed belongs to a DNS request message transmitted by a terminal device through an FTTR system or a response message to a DNS request transmitted by a DNS server;

[0029] According to the target sub-rule, the MAC address and domain name of the message to be processed are matched and confirmed with a pre-configured reference MAC address set and reference domain name set;

[0030] When the reference MAC address set and the reference domain name set belong to the blacklist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, discard the message to be processed; or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, receive the message to be processed;

[0031] When the reference MAC address set and the reference domain name set belong to a whitelist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, a receiving operation is performed on the message to be processed; or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, a discarding operation is performed on the message to be processed.

[0032] In a preferred embodiment of the present application, in the above-mentioned FTTR-based data control method, the step of matching and confirming the MAC address and domain name of the message to be processed with the pre-configured reference MAC address set and reference domain name set according to the target sub-rule includes:

[0033] According to the target sub-rule, the MAC address of the message to be processed is matched and confirmed with a pre-configured reference MAC address set;

[0034] According to the target sub-rule, the domain name of the message to be processed is matched and confirmed with a pre-configured reference domain name set. In the process of matching and confirmation, when comparing and analyzing the domain name of the message to be processed with the reference domain name in the reference domain name set, the corresponding two domain names are compared in sequence from suffix to prefix to determine whether they are consistent.

[0035] The present application also provides a FTTR-based data control device, which is applied to a gateway device, wherein the gateway device has a Linux operating system, and the Linux operating system has a system kernel. The FTTR-based data control device includes:

[0036] a rule configuration module, configured to perform a rule configuration operation on the target control application of the gateway device in response to a received serial port instruction or a remote protocol command, so as to form a target control rule corresponding to the target control application, wherein the target control rule includes at least a first sub-rule and a second sub-rule, at least part of the rule content between the first sub-rule and the second sub-rule is different, and the target control application adopts the first sub-rule in a first time period, and adopts the second sub-rule in a second time period different from the first time period;

[0037] A message acquisition module, used for acquiring the message to be processed from the network protocol stack through the target control application after configuring the target control rule and when transmitting the received message to be processed to the network protocol stack of the system kernel, wherein the message to be processed belongs to a message transmitted from the terminal device to the gateway device through the FTTR system, or a message transmitted from other network devices to the gateway device and needs to be transmitted from the gateway device to the terminal device through the FTTR system;

[0038] The data control module is used to determine the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule through the target control application based on the time period to which the current time belongs, and perform data control operations on the message to be processed according to the target sub-rule.

[0039] On the basis of the above, the present application further provides a method comprising:

[0040] Memory for storing computer programs;

[0041] The processor connected to the memory is used to execute the computer program stored in the memory to implement the above-mentioned FTTR-based data control method.

[0042] On the basis of the above, the present application also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is run, each step of the above-mentioned FTTR-based data control method is executed.

[0043] The data control method and apparatus, equipment and medium based on FTTR provided in the present application can perform rule configuration operations on the target control application of the gateway device in response to serial port instructions or remote protocol commands to form corresponding target control rules; secondly, after the target control rules are configured and formed, and when the received messages to be processed are transmitted to the network protocol stack of the system kernel, the messages to be processed can be obtained from the network protocol stack through the target control application; then, the target control application can be used to determine the target sub-rule from the target control rules including the first sub-rule and the second sub-rule based on the time period to which the current time belongs, and perform data control operations on the messages to be processed according to the target sub-rules. Based on the above content, since the target control application can be configured to perform rule configuration operations through serial port instructions or remote protocol commands, and the formed target control rules can have different rule contents for different time periods, differentiated control of data in different time periods can be achieved, which can be better adapted to actual needs, that is, reliable control of gateway data can be achieved. In addition, since data control operations are performed on the messages (data) extracted from the network protocol stack through the target control application, that is, data control operations are not performed in the network protocol stack (that is, no data control operations are performed in the network protocol stack), this can, to a certain extent, avoid the problem of limited data parsing function of the network protocol stack due to data control operations performed in the network protocol stack, and it can also, to a certain extent, avoid the problem of easy errors in data control operations due to data control operations performed in the network protocol stack (the relationship in the network protocol stack is more complicated, and there are generally more calls, and erroneous calls can easily cause the processing of messages to enter an infinite loop, etc.), in this way, the gateway's data control effect can be further improved, thereby improving the problem of poor gateway data control effect in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings.

[0045] Figure 1 A structural block diagram of a gateway device provided in an embodiment of the present application.

[0046] Figure 2 A flow chart of a FTTR-based data control method provided in an embodiment of the present application.

[0047] Figure 3 A block diagram of a FTTR-based data control device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0049] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0050] like Figure 1 As shown, an embodiment of the present application provides a gateway device, wherein the gateway device may include a memory, a processor, and a data control device based on FTTR.

[0051] In detail, the memory and the processor are electrically connected directly or indirectly to achieve data transmission or interaction. For example, the memory and the processor can be electrically connected through one or more communication buses or signal lines. The FTTR-based data control device includes at least one software function module stored in the memory in the form of software or firmware. The processor is used to execute an executable computer program stored in the memory, for example, the software function module and computer program included in the FTTR-based data control device, so as to implement the FTTR-based data control method provided in the embodiment of the present application.

[0052] Optionally, the memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0053] Furthermore, the processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a system on chip (SoC), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0054] Understandably, Figure 1 The structure shown is for illustration only. The gateway device may also include Figure 1 More or fewer components as shown, or with Figure 1 The different configurations shown, for example, may also include a communication unit for exchanging information with other devices (such as a background server, etc.).

[0055] Combination Figure 2 , an embodiment of the present application also provides a FTTR-based data control method that can be applied to the above-mentioned gateway device. Among them, the method steps defined in the process related to the FTTR-based data control method can be implemented by the gateway device. The gateway device has a Linux operating system, and the Linux operating system has a system kernel (Operating System Kernel, the kernel of the operating system is the core component of the operating system, responsible for managing and controlling various hardware resources of the computer system, and providing an interface for application programs to access these resources. The kernel is the basic part of the operating system, which interacts directly with the hardware and performs some basic system tasks, such as process management, memory management, file system management, device driver management, etc.).

[0056] The following will Figure 2 The specific process shown is explained in detail.

[0057] Step S110, in response to the received serial port instruction or remote protocol command, a rule configuration operation is performed on the target control application of the gateway device to form a target control rule corresponding to the target control application.

[0058] In an embodiment of the present application, the gateway device can respond to received serial port instructions (instructions issued by other electronic devices through the serial port) or remote protocol commands (such as commands or instructions sent based on the Telnet console) to perform rule configuration operations on the target management and control application of the gateway device to form target management and control rules corresponding to the target management and control application. Among them, the target control rule includes at least a first sub-rule and a second sub-rule (that is, the target control rule may only include the first sub-rule and the second sub-rule, or may further include a third sub-rule, a fourth sub-rule, etc. on the basis of including the first sub-rule and the second sub-rule), at least some of the rule contents between the first sub-rule and the second sub-rule are different, and the target control application adopts the first sub-rule in a first time period, and adopts the second sub-rule in a second time period different from the first time period; exemplarily, the first sub-rule may be based on a configured whitelist or blacklist to perform corresponding data reception (including forwarding, etc.) or data discard, and the second sub-rule may be a corresponding control of not receiving data or discarding data. For example, in the first time period, the received message may be controlled accordingly according to the whitelist or blacklist, and in the second time period, the received message may not be controlled accordingly (in other embodiments, the second sub-rule may also have certain control content, as long as the control content corresponding to the first sub-rule is incomplete).

[0059] Step S120, after the target control rule is configured and when the received message to be processed is transmitted to the network protocol stack of the system kernel, the message to be processed is obtained from the network protocol stack through the target control application.

[0060] In an embodiment of the present application, the gateway device can obtain the message to be processed from the network protocol stack through the target control application after configuring the target control rules and when transmitting the received message to be processed to the network protocol stack of the system kernel (exemplarily, the system kernel also has a network driver layer, such as an Ethernet driver layer or an optical fiber transceiver packet driver layer, and after the network driver layer obtains the message to be processed from the corresponding interface, it can be transmitted to the network protocol stack, such as the TCP / IP protocol stack). Among them, the message to be processed belongs to the message transmitted from the terminal device to the gateway device through the FTTR system, or the message transmitted to the gateway device by other network devices and needs to be transmitted by the gateway device to the terminal device through the FTTR system (such as the response message replied by other network devices based on the request after the terminal device makes a request to other network devices, such as a server, etc.).

[0061] Step S130, through the target control application, based on the time period to which the current time belongs, determine the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule, and perform data control operations on the message to be processed according to the target sub-rule.

[0062] In an embodiment of the present application, the gateway device can determine the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs through the target control application, and perform data control operations on the message to be processed according to the target sub-rule. Exemplarily, when the current time belongs to the first time period, the target control application can perform data control operations on the message to be processed based on the first sub-rule, and when the current time belongs to the second time period, the target control application can perform data control operations on the message to be processed based on the second sub-rule, such as receiving or discarding.

[0063] Based on the above content, since the target control application can be configured with rules through serial port instructions or remote protocol commands, and the formed target control rules can have different rule contents for different time periods, the differentiated control of data in different time periods can be achieved, which can be better adapted to actual needs, that is, reliable control of gateway data can be achieved. In addition, since the data control operation is performed on the message (data) extracted from the network protocol stack through the target control application, that is, the data control operation is not performed in the network protocol stack (that is, the data control operation is not performed in the network protocol stack), in this way, the problem of limited data parsing function of the network protocol stack caused by performing data control operations in the network protocol stack can be avoided to a certain extent, and the problem of easy errors in data control operations caused by performing data control operations in the network protocol stack can also be avoided to a certain extent (the relationship in the network protocol stack is relatively complex, and there are generally more calls, and erroneous calls are easy to cause the processing of messages to enter an infinite loop, etc.), in this way, the gateway's control effect on data can be further improved, thereby improving the problem of poor gateway data control effect in the prior art. Based on this, users can block the needs of certain applications for certain hanging terminals according to time periods, for example, restricting children from playing online games and online shopping.

[0064] First, it should be noted that for step S110, the specific method of performing rule configuration operations on the target control application is not limited and can be selected according to actual needs.

[0065] For example, in an alternative implementation, the corresponding information can be configured through the DBus configuration interface of the gateway device under the serial port and / or Telnet console; wherein, after receiving the corresponding information, the gateway device can use the application layer command ipset to configure the MAC set and the destination IP set according to the combination mode of the MAC address and the destination IP address information, on the one hand, perform the blocking monitoring configuration of the DNS proxy module according to the combination mode of the MAC address and domain name information, the time period and the black and white list mode, and on the other hand, perform the iptables and ip6tables default policy configuration according to the black and white list mode, and perform the time period monitoring configuration according to the time period and blocking mode information. The default policy configuration of the black and white list iptables and ip6tables is as follows: the default policy of the black list is DROP (discard), and the default policy of the white list is ACCEPT (receive).

[0066] For example, you can call the ipset command to configure the MAC set (filter_mac) and the IP set (filter_ip). In the specific execution of the rules, you can call the iptables and ip6tables commands, and import the data into the subchain app_filter in the FORWARD chain of the filter table according to the filter condition of the entry br0 (br0 is usually regarded as the main interface of the network bridge), and then import the data into the subchain app_filter again in the subchain app_filter. In the subchain app_filter_MAC_dstIP, the set module is first used to match the ipset MAC set (filter_mac) according to the source MAC address method, and the skb->mark flag is set for the matching data; then, according to the previously set skb->mark flag and the set module, the ipset IP set (filter_ip) is matched by the destination IP address method, and the data is imported into the subchain app_filter_MAC_dstIP_B (blacklist mode) or app_filter_MAC_dstIP_F (whitelist mode) according to the blacklist and whitelist mode. Alternatively, you can call the ipset command to configure the IP set (filter_ip); during the specific execution of the rule, call the iptables and ip6tables commands, import the data into the subchain app_filter in the FORWARD chain of the filter table according to the entry br0 filter condition, and then import the data into the subchain app_filter again in the subchain app_filter. In the subchain app_filter_dstIP, use the set module to match the ipset IP set (filter_ip) according to the destination IP address, and import the data into the subchain app_filter_dstIP_B (blacklist mode) or app_filter_dstIP_F (whitelist mode) again according to the blacklist and whitelist mode.

[0067] Secondly, it should be noted that for step S120, the specific method of obtaining the to-be-processed message from the network protocol stack through the target control application is not limited and can also be selected according to actual needs.

[0068] For example, in an alternative implementation, when the target control application belongs to a packet filtering firewall, such as iptables and ip6tables, the packet filtering firewall can obtain the to-be-processed message from the network protocol stack through a configured hook function. Alternatively, the target control application belongs to a DNS proxy application, wherein the DNS proxy application (module) plays an important role in the gateway device, responsible for processing and forwarding DNS requests and responses to implement DNS resolution, caching, filtering and other functions. The DNS proxy application usually receives and processes DNS data messages through a certain layer (e.g., the transport layer) in the network protocol stack.

[0069] Thirdly, it should be noted that for step S130, the specific manner of performing data control operations on the to-be-processed message according to the target sub-rule is not limited and can also be selected according to actual needs.

[0070] For example, in an alternative implementation, in order to be able to perform more reliable management and control of data messages, the above-mentioned step S130 may further include step S131 and step S132, and the specific content of each step is described as follows.

[0071] Step S131: through the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule.

[0072] In an embodiment of the present application, the time period to which the current time belongs can be first determined by the target control application (for example, in order to avoid excessive consumption of resources, the time period to which the current time belongs can be determined once every certain time interval, such as every 60 seconds, that is, after the determination, the current determination result is used within the next 60 seconds), and then, when the current time belongs to the first time period, the first sub-rule included in the target control rule can be used as the target sub-rule. Among them, the target control application belongs to a data packet filtering firewall (such as firewall software such as iptables or ip6tables), and the data packet filtering firewall obtains the to-be-processed message from the network protocol stack through a configured hook function, and the to-be-processed message belongs to a message transmitted from the terminal device to the gateway device through the FTTR system. For example, in a network protocol stack, firewall software usually obtains packets through hook functions provided by the operating system. Hook functions are a mechanism that allows software to insert custom code when a specific event occurs in order to intercept, check or modify the behavior of the event. For firewall software, hook functions can be used to intercept network packets and check or filter them. In different operating systems and network protocol stack implementations, the specific names and implementation methods of hook functions may vary. The following are some common hook functions: Netfilter Hooks: In the Linux operating system, Netfilter is a framework for implementing packet filtering and network address translation. It provides a set of hook functions that allow user space programs to intercept and process packets when they pass through specific locations in the network protocol stack. Common Netfilter hook functions include: NF_INET_PRE_ROUTING: a hook triggered when a packet arrives at the front end of the network protocol stack; NF_INET_POST_ROUTING: a hook triggered when a packet leaves the back end of the network protocol stack.

[0073] Step S132: import the message to be processed into the FORWARD chain of the filter table through the target control application, and perform data control operations on the message to be processed in the FORWARD chain according to the target sub-rule.

[0074] In an embodiment of the present application, after obtaining the message to be processed, the message to be processed can be imported into the FORWARD chain of the filter table through the target control application, and in the FORWARD chain, according to the target sub-rule, the data control operation is performed on the message to be processed. Wherein, the filter table belongs to the table in the packet filtering firewall used to filter and process the data packets, and the FORWARD chain belongs to the main chain of the filter table.

[0075] It can be understood that, in the above-mentioned step S132, the specific manner of performing the data control operation on the to-be-processed message according to the target sub-rule in the FORWARD chain is not limited and can be selected according to actual needs.

[0076] For example, in an alternative implementation, in order to enable more reliable management and control of the messages to be processed, the above-mentioned step S132 may further include step S132a, step S132b, step S132c and step S132d, and the specific content of each step is described as follows.

[0077] Step S132a, through the target management and control application, import the pending message into the FORWARD chain of the filter table, import the pending message into the first-level subchain in the FORWARD chain, and import the pending message from the first-level subchain to the second-level subchain.

[0078] In an embodiment of the present application, after obtaining the message to be processed, the message to be processed can be imported into the FORWARD chain of the filter table through the target control application, and the message to be processed can be imported into the first-level subchain (such as app_filter) in the FORWARD chain, and the message to be processed can be imported from the first-level subchain to the second-level subchain (such as app_filter_MAC_dstIP) so that corresponding processing can be performed in the subchain.

[0079] Step S132b, in the second-level subchain, the MAC address of the message to be processed is matched and confirmed with the pre-configured MAC address set, and when matching, the message to be processed is marked, and the IP address of the marked message to be processed is matched and confirmed with the pre-configured IP address set to obtain the corresponding IP address matching confirmation result.

[0080] In an embodiment of the present application, in the second-level subchain, the MAC address of the message to be processed can be matched and confirmed with a pre-configured MAC address set, such as determining whether there is a MAC address in the MAC address set that is consistent with the MAC address of the marked message to be processed, and when matching, the message to be processed is marked (such as marking the skb->mark flag), and the IP address of the marked message to be processed is matched and confirmed with a pre-configured IP address set to obtain a corresponding IP address matching confirmation result, such as determining whether there is an IP address in the IP address set that is consistent with the IP address of the marked message to be processed.

[0081] Step S132c, when the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received.

[0082] In an embodiment of the present application, after performing corresponding confirmation, when the IP address set belongs to a blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set (such as there is an IP address in the IP address set that is consistent with the IP address of the message to be processed), the message to be processed is discarded, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set (such as there is no IP address in the IP address set that is consistent with the IP address of the message to be processed), the message to be processed is received (such as forwarded to other devices).

[0083] Step S132d, when the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is received, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is discarded.

[0084] In an embodiment of the present application, after performing corresponding confirmation, when the IP address set belongs to a whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set (such as there is an IP address in the IP address set that is consistent with the IP address of the message to be processed), a receiving operation is performed on the message to be processed (such as forwarding it to other devices), or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set (such as there is no IP address in the IP address set that is consistent with the IP address of the message to be processed), a discard operation is performed on the message to be processed.

[0085] For example, in another alternative implementation, in order to be able to more efficiently manage and control the messages to be processed, the above-mentioned step S132 may further include step S132e, step S132f, step S132g and step S132h, and the specific content of each step is described as follows.

[0086] Step S132e, through the target management and control application, import the pending message into the FORWARD chain of the filter table, import the pending message into the first-level subchain in the FORWARD chain, and import the pending message from the first-level subchain to the second-level subchain.

[0087] In an embodiment of the present application, after obtaining the message to be processed, the message to be processed can be imported into the FORWARD chain of the filter table through the target management application, and the message to be processed can be imported into the first-level subchain (such as app_filter) in the FORWARD chain, and the message to be processed can be imported from the first-level subchain to the second-level subchain (such as app_filter_dstIP) so that corresponding processing can be performed in the subchain.

[0088] Step S132f, in the second-level subchain, the IP address of the message to be processed is matched and confirmed with a pre-configured IP address set to obtain a corresponding IP address matching confirmation result.

[0089] In an embodiment of the present application, in the second-level sub-chain, the IP address of the message to be processed can be matched and confirmed with a pre-configured IP address set to obtain a corresponding IP address matching confirmation result, such as determining whether there is an IP address in the IP address set that is consistent with the IP address of the message to be processed.

[0090] Step S132g, when the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received.

[0091] In an embodiment of the present application, after obtaining the IP address match confirmation result, when the IP address set belongs to a blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set (such as there is an IP address in the IP address set that is consistent with the IP address of the message to be processed), the message to be processed may be discarded, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set (such as there is no IP address in the IP address set that is consistent with the IP address of the message to be processed), a receiving operation (such as forwarding, etc.) may be performed on the message to be processed.

[0092] Step S132h, when the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is received, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is discarded.

[0093] In an embodiment of the present application, after obtaining the IP address match confirmation result, when the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set (such as there is an IP address in the IP address set that is consistent with the IP address of the message to be processed), a receiving operation is performed on the message to be processed, or, when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set (such as there is no IP address in the IP address set that is consistent with the IP address of the message to be processed), a discarding operation is performed on the message to be processed.

[0094] It can be understood that, based on the above content, in order to make the reliability of the control operations on the message relatively higher, so that the corresponding operations can be recorded to facilitate subsequent misoperation monitoring, etc., the above-mentioned step S130 can also include step S133, step S134, step S135 and step S136, and the specific content of each step is described as follows.

[0095] Step S133, after discarding the message to be processed, mapping the MAC address and IP address of the message to be processed through the target management and control application to obtain the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed.

[0096] In an embodiment of the present application, if the specific operation type or operation content of the data control operation performed based on step S132 is to discard the message to be processed, the MAC address and IP address of the message to be processed can be mapped through the target control application to obtain the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed. For example, by performing hash mapping on the MAC address, the corresponding first address mapping parameter can be obtained, and by performing hash mapping on the IP address, the corresponding second address mapping parameter can be obtained.

[0097] Step S134: determining whether there is target log data in the pre-constructed target log file that matches the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed.

[0098] In an embodiment of the present application, after obtaining the first address mapping parameter and the second address mapping parameter, it is possible to determine whether there is target log data in a pre-constructed target log file that matches the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed. The discarded historical message recorded in the target log data belongs to a historical message whose MAC address and IP address match the MAC address and IP address of the message to be processed and whose discard operation execution time is the most recent, and the time interval between the discard operation execution time of the discarded historical message recorded in the target log data and the discard operation execution time of the message to be processed is less than a pre-configured reference time interval. In other words, the address mapping parameters corresponding to the MAC address and IP address of the historical message in the target log file can be compared and analyzed one by one with the first address mapping parameter and the second address mapping parameter. In addition, the specific value of the reference time interval is not limited, for example, it can be 1 minute.

[0099] Step S135: When the target log file contains the target log data, determine not to record the discarding operation of the to-be-processed message.

[0100] In the embodiment of the present application, when the target log data is present in the target log file, it is determined not to record the discarding operation of the message to be processed. In other words, if the message with the same MAC address and IP address has been recorded in a short period of time, it will not be recorded again, so that the problem of resource waste can be improved to a certain extent.

[0101] Step S136, when the target log file does not contain the target log data, a discarding operation of the message to be processed is recorded to form log data corresponding to the message to be processed in the target log file.

[0102] In an embodiment of the present application, when the target log data is not present in the target log file, the discard operation of the message to be processed is recorded and processed to form log data corresponding to the message to be processed in the target log file. In other words, no message with the same MAC address and IP address has been recorded in a short period of time, so corresponding records can be made so that subsequent misoperation monitoring can be performed based on the records. Among them, the log data includes the MAC address of the message to be processed (such as the source MAC address, etc.), the IP address (such as the destination IP address and the source IP address), the operation type or operation content of the discard operation (such as any symbol or text that can indicate that a discard operation is being performed), and the execution time of the discard operation.

[0103] It should also be noted that for step S130, in the process of performing data control operations on the message to be processed according to the target sub-rule, it can also be performed based on other methods.

[0104] For example, in an alternative implementation, in order to flexibly adapt to a dynamically changing network environment without frequently updating the IP address interception rules, the above-mentioned step S130 may further include step S137, step S138, step S139 and step S141, and the specific content of each step is described as follows.

[0105] Step S137: through the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule.

[0106] In an embodiment of the present application, the time period to which the current time belongs can be determined by the target control application, and then, when the current time belongs to the first time period, the first sub-rule included in the target control rule can be used as the target sub-rule. The target control application is a DNS proxy application, and the message to be processed is a DNS request message transmitted by the terminal device through the FTTR system or a response message of a DNS request transmitted by the DNS server.

[0107] Step S138: According to the target sub-rule, the MAC address and domain name of the message to be processed are matched and confirmed with a pre-configured reference MAC address set and reference domain name set.

[0108] In an embodiment of the present application, after determining the target sub-rule, the MAC address and domain name of the message to be processed can be matched and confirmed with a pre-configured reference MAC address set and reference domain name set according to the target sub-rule, such as comparing and analyzing the MAC address and domain name of the message to be processed with the reference MAC address and reference domain name in the reference MAC address set and reference domain name set one by one to determine whether they are consistent (matched).

[0109] Step S139, when the reference MAC address set and the reference domain name set belong to the blacklist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, the message to be processed is discarded, or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, the message to be processed is received.

[0110] In an embodiment of the present application, after a match is confirmed, when the reference MAC address set and the reference domain name set belong to a blacklist set, and when the MAC address and domain name of the message to be processed match both the reference MAC address set and the reference domain name set (such as both the reference MAC address set and the reference domain name set contain reference MAC addresses and reference domain names that match the MAC address and domain name of the message to be processed), the message to be processed is discarded; or, when the MAC address and domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set (such as both the reference MAC address set and the reference domain name set contain reference MAC addresses and reference domain names that match the MAC address and domain name of the message to be processed, such as neither exists or only one exists), the message to be processed is received.

[0111] Step S141, when the reference MAC address set and the reference domain name set belong to the whitelist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, the message to be processed is received, or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, the message to be processed is discarded.

[0112] In an embodiment of the present application, after a match is confirmed, when the reference MAC address set and the reference domain name set belong to a whitelist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set (as described above), a receiving operation is performed on the message to be processed; or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set (as described above), a discarding operation is performed on the message to be processed.

[0113] It is understandable that, in the above step S138, the specific method of performing the matching confirmation of the MAC address and the domain name is not limited and can be selected according to actual needs.

[0114] For example, in an alternative implementation, in order to make the matching confirmation of the MAC address and the domain name more efficient, the above-mentioned step S138 may further include step S138a and step S138b, and the specific content of each step is described as follows.

[0115] Step S138a: According to the target sub-rule, the MAC address of the message to be processed is matched and confirmed with a pre-configured reference MAC address set.

[0116] In the embodiment of the present application, the MAC address of the message to be processed can be directly matched one by one with the reference MAC addresses in the pre-configured reference MAC address set for confirmation.

[0117] Step S138b: According to the target sub-rule, the domain name of the message to be processed is matched and confirmed with a pre-configured reference domain name set.

[0118] In an embodiment of the present application, the domain name of the message to be processed can be matched and confirmed one by one with the reference domain name in the pre-configured reference domain name set. In the process of matching and confirming, when comparing and analyzing the domain name of the message to be processed with the reference domain name in the reference domain name set, the corresponding two domain names are compared in sequence from the suffix to the prefix to determine whether they are consistent, such as first comparing whether the suffixes are consistent, if not, it is determined that there is no match, if they are consistent, further comparison can be performed along this direction, and finally, the prefixes can be compared to determine whether they are consistent.

[0119] It should be noted that when the message to be processed is a response message to a DNS request, if the corresponding MAC address and domain name match, the IP address in the response message to the DNS request can also be assigned to the corresponding IP address set. In this way, reliable control of subsequent messages can be achieved.

[0120] Combination Figure 3 The embodiment of the present application also provides a FTTR-based data control device applicable to the above-mentioned gateway device. The FTTR-based data control device may include a rule configuration module, a message acquisition module and a data control module.

[0121] The rule configuration module is used to perform rule configuration operations on the target control application of the gateway device in response to the received serial port instruction or remote protocol command to form a target control rule corresponding to the target control application, wherein the target control rule includes at least a first sub-rule and a second sub-rule, and at least part of the rule content between the first sub-rule and the second sub-rule is different, and the target control application adopts the first sub-rule in a first time period and adopts the second sub-rule in a second time period different from the first time period. In an embodiment of the present application, the rule configuration module can be used to execute Figure 2 As shown in step S110, the relevant contents of the rule configuration module can refer to the above description of step S110.

[0122] The message acquisition module is used to obtain the message to be processed from the network protocol stack through the target control application after configuring the target control rule and when the received message to be processed is transmitted to the network protocol stack of the system kernel, wherein the message to be processed belongs to the message transmitted from the terminal device to the gateway device through the FTTR system, or the message transmitted from other network devices to the gateway device and needs to be transmitted from the gateway device to the terminal device through the FTTR system. In the embodiment of the present application, the message acquisition module can be used to execute Figure 2 As shown in step S120, the relevant contents of the message acquisition module can refer to the above description of step S120.

[0123] The data control module is used to determine the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs through the target control application, and perform data control operations on the to-be-processed message according to the target sub-rule. Figure 2 As shown in step S130, the relevant contents of the data control module can refer to the above description of step S130.

[0124] In the embodiment of the present application, corresponding to the above-mentioned FTTR-based data control method applied to the gateway device, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is run, each step of the FTTR-based data control method is executed. Among them, each step executed when the aforementioned computer program is run will not be described one by one here, and reference can be made to the above explanation of the FTTR-based data control method.

[0125] In summary, the FTTR-based data control method and apparatus, equipment and medium provided in the present application can perform rule configuration operations on the target control application of the gateway device in response to serial port instructions or remote protocol commands to form corresponding target control rules; secondly, after the target control rules are configured and formed, and when the received message to be processed is transmitted to the network protocol stack of the system kernel, the message to be processed can be obtained from the network protocol stack through the target control application; then, the target control application can be used to determine the target sub-rule from the target control rules including the first sub-rule and the second sub-rule based on the time period to which the current time belongs, and perform data control operations on the message to be processed according to the target sub-rule. Based on the above content, since the target control application can be configured to perform rule configuration operations through serial port instructions or remote protocol commands, and the formed target control rules can have different rule contents for different time periods, differentiated control of data in different time periods can be achieved, which can be better adapted to actual needs, that is, reliable control of gateway data can be achieved. In addition, since data control operations are performed on the messages (data) extracted from the network protocol stack through the target control application, that is, data control operations are not performed in the network protocol stack (that is, no data control operations are performed in the network protocol stack), this can, to a certain extent, avoid the problem of limited data parsing function of the network protocol stack due to data control operations performed in the network protocol stack, and it can also, to a certain extent, avoid the problem of easy errors in data control operations due to data control operations performed in the network protocol stack (the relationship in the network protocol stack is more complicated, and there are generally more calls, and erroneous calls can easily cause the processing of messages to enter an infinite loop, etc.), in this way, the gateway's data control effect can be further improved, thereby improving the problem of poor gateway data control effect in the prior art.

[0126] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device and method embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0127] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0128] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, electronic device, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code. It should be noted that in this article, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0129] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data control method based on FTTR, It is characterized in that Applied to a gateway device, the gateway device has a Linux operating system, the Linux operating system has a system kernel, and the FTTR-based data control method includes: In response to the received serial port instruction or remote protocol command, a rule configuration operation is performed on the target control application of the gateway device to form a target control rule corresponding to the target control application, wherein the target control rule includes at least a first sub-rule and a second sub-rule, at least part of the rule content between the first sub-rule and the second sub-rule is different, and the target control application adopts the first sub-rule in a first time period, and adopts the second sub-rule in a second time period different from the first time period; After the target control rule is configured and formed, and when the received message to be processed is transmitted to the network protocol stack of the system kernel, the message to be processed is obtained from the network protocol stack through the target control application, wherein the message to be processed belongs to a message transmitted from the terminal device to the gateway device through the FTTR system, or a message transmitted from other network devices to the gateway device and needs to be transmitted from the gateway device to the terminal device through the FTTR system; By means of the target control application, based on the time period to which the current time belongs, a target sub-rule is determined from the first sub-rule and the second sub-rule included in the target control rule, and a data control operation is performed on the message to be processed according to the target sub-rule; Among them, the step of determining, by the target control application, a target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performing a data control operation on the message to be processed according to the target sub-rule includes: By means of the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule, wherein the target control application belongs to a data packet filtering firewall, and the data packet filtering firewall obtains the to-be-processed message from the network protocol stack through a configured hook function, and the to-be-processed message belongs to a message transmitted from the terminal device to the gateway device through the FTTR system; By means of the target control application, the to-be-processed message is imported into the FORWARD chain of the filter table, and in the FORWARD chain, according to the target sub-rule, a data control operation is performed on the to-be-processed message, wherein the filter table belongs to a table in the packet filtering firewall for filtering data packets, and the FORWARD chain belongs to the main chain of the filter table; The step of importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and performing data control operations on the to-be-processed message in the FORWARD chain according to the target sub-rule includes: Importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and importing the to-be-processed message into the first-level subchain in the FORWARD chain, and importing the to-be-processed message from the first-level subchain into the second-level subchain; In the second-level subchain, the MAC address of the message to be processed is matched and confirmed with the pre-configured MAC address set, and when matching, the message to be processed is marked, and the IP address of the marked message to be processed is matched and confirmed with the pre-configured IP address set to obtain a corresponding IP address matching confirmation result; When the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received; When the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, a receiving operation is performed on the message to be processed, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, a discarding operation is performed on the message to be processed; Among them, the step of determining, by the target control application, a target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performing a data control operation on the message to be processed according to the target sub-rule, also includes: After discarding the message to be processed, mapping the MAC address and IP address of the message to be processed through the target control application to obtain a first address mapping parameter and a second address mapping parameter corresponding to the message to be processed; In a pre-constructed target log file, determining whether there is target log data that matches the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed, wherein the discarded historical message recorded in the target log data is a historical message whose MAC address and IP address match the MAC address and IP address of the message to be processed and whose discard operation execution time is the most recent, and the time interval between the discard operation execution time of the discarded historical message recorded in the target log data and the discard operation execution time of the message to be processed is less than a pre-configured reference time interval; When the target log data is present in the target log file, determining not to record the discarding operation of the to-be-processed message; When the target log data is not present in the target log file, the discard operation of the message to be processed is recorded and processed to form log data corresponding to the message to be processed in the target log file, wherein the log data includes the MAC address, IP address, operation type or operation content of the discard operation and execution time of the discard operation of the message to be processed.

2. The FTTR-based data control method according to claim 1, It is characterized in that The step of determining, by the target control application, a target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performing a data control operation on the message to be processed according to the target sub-rule includes: By means of the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule, wherein the target control application belongs to a DNS proxy application, and the message to be processed belongs to a DNS request message transmitted by a terminal device through an FTTR system or a response message to a DNS request transmitted by a DNS server; According to the target sub-rule, the MAC address and domain name of the message to be processed are matched and confirmed with a pre-configured reference MAC address set and reference domain name set; When the reference MAC address set and the reference domain name set belong to the blacklist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, discard the message to be processed; or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, receive the message to be processed; When the reference MAC address set and the reference domain name set belong to a whitelist set, and when the MAC address and the domain name of the message to be processed match both the reference MAC address set and the reference domain name set, a receiving operation is performed on the message to be processed; or, when the MAC address and the domain name of the message to be processed at least partially do not match the reference MAC address set and the reference domain name set, a discarding operation is performed on the message to be processed.

3. The FTTR-based data control method according to claim 2, It is characterized in that The step of matching and confirming the MAC address and domain name of the message to be processed with a pre-configured reference MAC address set and reference domain name set according to the target sub-rule includes: According to the target sub-rule, the MAC address of the message to be processed is matched and confirmed with a pre-configured reference MAC address set; According to the target sub-rule, the domain name of the message to be processed is matched and confirmed with a pre-configured reference domain name set. In the process of matching and confirmation, when comparing and analyzing the domain name of the message to be processed with the reference domain name in the reference domain name set, the corresponding two domain names are compared in sequence from suffix to prefix to determine whether they are consistent.

4. A data control device based on FTTR, It is characterized in that Applied to a gateway device, the gateway device has a Linux operating system, the Linux operating system has a system kernel, and the FTTR-based data control device includes: a rule configuration module, configured to perform a rule configuration operation on the target control application of the gateway device in response to a received serial port instruction or a remote protocol command, so as to form a target control rule corresponding to the target control application, wherein the target control rule includes at least a first sub-rule and a second sub-rule, at least part of the rule content between the first sub-rule and the second sub-rule is different, and the target control application adopts the first sub-rule in a first time period, and adopts the second sub-rule in a second time period different from the first time period; A message acquisition module, used for acquiring the message to be processed from the network protocol stack through the target control application after configuring the target control rule and when transmitting the received message to be processed to the network protocol stack of the system kernel, wherein the message to be processed belongs to a message transmitted from the terminal device to the gateway device through the FTTR system, or a message transmitted from other network devices to the gateway device and needs to be transmitted from the gateway device to the terminal device through the FTTR system; A data control module, configured to determine, through the target control application, a target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and perform data control operations on the message to be processed according to the target sub-rule; Among them, the target control application determines the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performs data control operations on the to-be-processed message according to the target sub-rule, including: By means of the target control application, when the current time belongs to the first time period, the first sub-rule included in the target control rule is used as the target sub-rule, wherein the target control application belongs to a data packet filtering firewall, and the data packet filtering firewall obtains the to-be-processed message from the network protocol stack through a configured hook function, and the to-be-processed message belongs to a message transmitted from the terminal device to the gateway device through the FTTR system; By means of the target control application, the to-be-processed message is imported into the FORWARD chain of the filter table, and in the FORWARD chain, according to the target sub-rule, a data control operation is performed on the to-be-processed message, wherein the filter table belongs to a table in the packet filtering firewall for filtering data packets, and the FORWARD chain belongs to the main chain of the filter table; The method of importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and performing data control operations on the to-be-processed message in the FORWARD chain according to the target sub-rule, includes: Importing the to-be-processed message into the FORWARD chain of the filter table through the target control application, and importing the to-be-processed message into the first-level subchain in the FORWARD chain, and importing the to-be-processed message from the first-level subchain into the second-level subchain; In the second-level subchain, the MAC address of the message to be processed is matched and confirmed with the pre-configured MAC address set, and when matching, the message to be processed is marked, and the IP address of the marked message to be processed is matched and confirmed with the pre-configured IP address set to obtain a corresponding IP address matching confirmation result; When the IP address set belongs to the blacklist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, the message to be processed is discarded, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, the message to be processed is received; When the IP address set belongs to the whitelist set, and when the IP address match confirmation result indicates that the IP address of the message to be processed matches the IP address set, a receiving operation is performed on the message to be processed, or when the IP address match confirmation result indicates that the IP address of the message to be processed does not match the IP address set, a discarding operation is performed on the message to be processed; Wherein, the target control application determines the target sub-rule from the first sub-rule and the second sub-rule included in the target control rule based on the time period to which the current time belongs, and performs data control operations on the to-be-processed message according to the target sub-rule, and also includes: After discarding the message to be processed, mapping the MAC address and IP address of the message to be processed through the target control application to obtain a first address mapping parameter and a second address mapping parameter corresponding to the message to be processed; In a pre-constructed target log file, determining whether there is target log data that matches the first address mapping parameter and the second address mapping parameter corresponding to the message to be processed, wherein the discarded historical message recorded in the target log data is a historical message whose MAC address and IP address match the MAC address and IP address of the message to be processed and whose discard operation execution time is the most recent, and the time interval between the discard operation execution time of the discarded historical message recorded in the target log data and the discard operation execution time of the message to be processed is less than a pre-configured reference time interval; When the target log data is present in the target log file, determining not to record the discarding operation of the to-be-processed message; When the target log data is not present in the target log file, the discard operation of the message to be processed is recorded and processed to form log data corresponding to the message to be processed in the target log file, wherein the log data includes the MAC address, IP address, operation type or operation content of the discard operation and execution time of the discard operation of the message to be processed.

5. A gateway device, It is characterized in that include: Memory for storing computer programs; A processor connected to the memory is used to execute the computer program stored in the memory to implement the FTTR-based data control method described in any one of claims 1 to 3.

6. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when running, executes the FTTR-based data control method described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Firewall system, safety service platform and firewall system management method

    CN101610264A

  • Industrial network firewall rule generation method and device based on machine learning

    CN112532633A