Commit Graph

7 Commits

Author SHA1 Message Date
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 467c31637f Minor cleanup after laster squashed merge. 2017-09-28 09:23:03 -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 4dceea4901 Network routing table: Trivial name changes to make IPv4 and IPv6 more symmetric. Add debug logic to dump the content of the router table. 2017-08-10 16:18:06 -06:00
Gregory Nutt 64c8dba8c4 NET: Create net/sockets directory and hook into the build/configuration system 2014-06-28 16:41:55 -06:00
Gregory Nutt d120befd39 NET: Move routing table functions to net/route 2014-06-26 13:02:08 -06:00