net/route: Support longest prefix match for routing

Support longest prefix match routing described as "Longest Match" in
RFC 1812, Section 5.2.4.3, Page 75.

Introduced `prefixlen` to indicate the prefix length of currently
founded route, and only looks up for longer prefix in all later steps.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng
2023-12-29 16:12:11 +08:00
committed by Xiang Xiao
parent 54f3452293
commit 3b74cfecc2
7 changed files with 433 additions and 114 deletions
+4 -3
View File
@@ -79,9 +79,10 @@ struct neighbor_addr_s
struct neighbor_entry_s
{
net_ipv6addr_t ne_ipaddr; /* IPv6 address of the Neighbor */
struct neighbor_addr_s ne_addr; /* Link layer address of the Neighbor */
clock_t ne_time; /* For aging, units of tick */
net_ipv6addr_t ne_ipaddr; /* IPv6 address of the Neighbor */
struct neighbor_addr_s ne_addr; /* Link layer address of the Neighbor */
clock_t ne_time; /* For aging, units of tick */
FAR struct net_driver_s *ne_dev; /* The device driver structure */
};
#ifdef __cplusplus