METHOD FOR LEARNING MEDIA ACCESS CONTROL ADDRESS, NETWORK DEVICE, AND SYSTEM
First Claim
1. A method for learning a media access control address, comprising:
- generating a key value according to a key field of a received packet, and obtaining an index value corresponding to the key value according to the key value;
performing a linear random iteration on the index value according to a preset number of iterations;
searching, according to an iteration index value obtained during the first iteration, in a media access control (MAC) address pool for a MAC address corresponding to the iteration index value obtained during the first iteration; and
if failing to find a MAC address corresponding to the iteration index value obtained during the first iteration in the MAC address pool, determining whether there is still an idle MAC address space in the MAC address pool, and continuing to perform an iteration operation;
when the number of iteration operations reaches a preset maximum number of iterations, if still failing to find MAC addresses corresponding to iteration index values obtained during iterations and determining that there is still an idle MAC address space in the MAC address pool, learning a MAC address of the received packet at a position where a first idle MAC address space appears.
2 Assignments
0 Petitions
Accused Products
Abstract
Embodiments of the present invention provide a method for learning a media access control address, a network device and a system. The method includes: generating a key value according to a key field of a received packet, and obtaining an index value corresponding to the key value according to the key value; performing a linear random iteration on the index value according to a preset number of iterations; searching, according to an iteration index value obtained during a first iteration, in a MAC address pool for a MAC address corresponding to the iteration index value obtained during the first iteration; and learning a MAC address of the packet according to a search result. By using the embodiments of the present invention a media access control address space may be fully utilized, and the problem of media access control address conflicts may be solved to the greatest extent.
5 Citations
12 Claims
-
1. A method for learning a media access control address, comprising:
-
generating a key value according to a key field of a received packet, and obtaining an index value corresponding to the key value according to the key value; performing a linear random iteration on the index value according to a preset number of iterations; searching, according to an iteration index value obtained during the first iteration, in a media access control (MAC) address pool for a MAC address corresponding to the iteration index value obtained during the first iteration; and if failing to find a MAC address corresponding to the iteration index value obtained during the first iteration in the MAC address pool, determining whether there is still an idle MAC address space in the MAC address pool, and continuing to perform an iteration operation;
when the number of iteration operations reaches a preset maximum number of iterations, if still failing to find MAC addresses corresponding to iteration index values obtained during iterations and determining that there is still an idle MAC address space in the MAC address pool, learning a MAC address of the received packet at a position where a first idle MAC address space appears. - View Dependent Claims (2, 3, 4, 5, 12)
-
-
6. A network device, comprising:
-
a generating module, configured to generate a key value according to a key field of a received packet; an obtaining module, configured to obtain an index value corresponding to the key value according to the key value generated by the generating module; an iteration module, configured to perform, according to a preset number of iterations, a linear random iteration on the index value obtained by the obtaining module; a searching module, configured to search, according to an iteration index value obtained during a first iteration, in a media access control (MAC) address pool for a MAC address corresponding to the iteration index value obtained during the first iteration; a determining module, configured to;
when the searching module does not find a MAC address corresponding to the iteration index value obtained during the first iteration in the MAC address pool, determine whether there is still an idle MAC address space in the MAC address pool, and instruct the iteration module to continue to perform the iteration operation; anda learning module, configured to;
when the number of iteration operations reaches a preset maximum number of iterations, if the searching module still fails to find MAC addresses corresponding to iteration index values obtained by the iteration module during iterations in the MAC address pool and the determining module determines that there is still an idle MAC address space in the MAC address pool, learn a MAC address of the received packet at a position where a first idle MAC address space appears in the MAC address pool. - View Dependent Claims (7, 8, 9, 10, 11)
-
Specification