Commit Graph

11 Commits

Author SHA1 Message Date
Zhe Weng 3b74cfecc2 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>
2024-01-09 05:58:10 -08:00
Gustavo Henrique Nihei 76acb32e29 Fix typos reported by codespell 2021-02-25 11:31:49 -08:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao e0307fcd8f boards/sim/sim/sim/src/sim_bringup.c: Mount tmpfs to CONFIG_LIBC_TMPDIR in sim_bringup if CONFIG_FS_TMPFS is defined. 2019-11-23 07:58:50 -06:00
Gregory Nutt e4652bd3dc Squashed commit of the following:
fs: Add truncate() support for userfs
    fs/unionfs:  Add truncate() support to the unionfs
    fs/tmpfs:  Add ftruncate() support to tmpfs
    syscall/: Add system call support for ftruncate()
    net/route:  Adding ftruncate() support eliminates an issue in file-based routing table management.
    fs:  Add basic framework to support truncate() and ftruncate().  The infrastructure is complete.  Now, however, the actual implementation of ftruncate() will have to be done for each file system.
2018-01-03 16:03:56 -06:00
Gregory Nutt ae78a925eb Add support for an in-memory routing table cache in order to improve performance when the routing table is retained in a file. The cache holds the most recently used routing table entries and so can eliminate some file access.
Squashed commit of the following:

    net/route:  Flush in cache when any entry is deleted from the routing table.  When a router matching an IP address is found, add the routing table entry to the cache.

    net/route:  Add utility functions to manage an in-memory cache to improve performance when use a file-based routing table.
2017-09-29 12:04:45 -06:00
Gregory Nutt 44d88abb83 This commit adds support for routing tables in files in a file system. This might be useful for customized, per-unit routing tables.
There are two issues with it however:

1. Reading from file system on a per packet basis could be slow.  I think it probably should have a small, in-memory cache of most frequently used routes for good problem.

2. Currently the delroute logic is disabled due to a problem with the design.  NuttX does not currently support truncate().  Therefore, it is not possible to delete entries from the routing table file.

In this current implementation, that leaves the last entry intact at the end of the file.  An alternative design might include a tag on each record to indicate if the record is valid or not.  That would work but would add complexity to the other routing table functions.

The existing implementation is available for testing purposes only if CONFIG_EXPERIMENTAL=y.

Squashed commit of the following:

    net/route:  The current delroute design depends on file truncation.  However, NuttX does not currently support truncate.  Alternative, more complex designs are possible but not implemented.  At present the file routing table are otherwise functional but the delroute logic is disabled via CONFIG_EXPERIMENTAL.  Enable it only if you plan to fix it.

    net/route:  Fix some issues with locking routing table files.

    net/route:  Add partial implementation of delroute for the case where the routing table is in a file.

    net/route:  Add support for seeking to positions in the routing table.

    net/route: Add net_addroute_ipv4/6() using a file-based routing table.

    net/route: Add net_foreach_ipv4/4() using a file-based routing table.

    net/route:  Initial build, configuration, and fs utilies to support routing tables in a file.
2017-09-29 08:33:36 -06:00
Gregory Nutt 3aa18ef56e Addes support for read-only routing tables. Prior to this change, routing tables were only support in RAM and had to be initialized with explicit logic to add the necessary routes to the routing table. With this change, routes may be defined in the pre-initialized, read-only routing table provided by the board-specific logic
This would be particularly useful, for example, in the case where there is only a single network adaptor and you want all output packets to go to the single adaptor in all cases.  So for that behavior you could add a read-only routing table to the board-specific long that contains a single entry, the default route: 0.0.0.0/0.

Squashed commit of the following:

    net/route:  RAM and ROM routing tables build correctly in all IPv4 and IPv6 configurations.

    net/route: Verify IPv6 ROM route build; Make number of ROM routes a variable, not a configuration item.

    net/route:  Add initial support for ROM-base, read-only routing tables.

    net/route:  Adjust and generalize some structures, rename some functions, and add configuration and build support that will eventually support read-only routing tables.

    net/route:  Some initial though experiments on use of a fixe, read-only routing table
2017-09-28 09:04:31 -06:00
Gregory Nutt d88583ffcf net/route: Permit IPv4 and IPv6 routing tables to be of different sizes 2017-09-27 12:04:51 -06:00
Gregory Nutt 342f5fe33d Fix references to the no-longer-existent misc/ directory in comments, README files, and documentation 2015-06-28 08:08:57 -06:00
Gregory Nutt d120befd39 NET: Move routing table functions to net/route 2014-06-26 13:02:08 -06:00