mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
Kernel: Add a global routing table
Previously the system had no concept of assigning different routes for different destination addresses as the default gateway IP address was directly assigned to a network adapter. This default gateway was statically assigned and any update would remove the previously existing route. This patch is a beginning step towards implementing #180. It implements a simple global routing table that is referenced during the routing process. With this implementation it is now possible for a user or service (i.e. DHCP) to dynamically add routes to the table. The routing table will select the most specific route when possible. It will select any direct match between the destination and routing entry addresses. If the destination address overlaps between multiple entries, the Kernel will use the longest prefix match, or the longest number of matching bits between the destination address and the routing address. In the event that there is no entries found for a specific destination address, this implementation supports entries for a default route to be set for any specified interface. This is a small first step towards enhancing the system's routing capabilities. Future enhancements would include referencing a configuration file at boot to load pre-defined static routes.
This commit is contained in:
parent
0718b20df0
commit
8596b1e0c3
4 changed files with 104 additions and 15 deletions
|
@ -14,6 +14,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct rtentry {
|
||||
struct sockaddr rt_dst; /* the target address */
|
||||
struct sockaddr rt_gateway; /* the gateway address */
|
||||
struct sockaddr rt_genmask; /* the target network mask */
|
||||
unsigned short int rt_flags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue