|
My Kernel v0.1.0
|

Data Structures | |
| struct | net_interface |
| A network interface. More... | |
| struct | subnet |
| An interface subnet. More... | |
Functions | |
| struct net_interface * | net_interface_new (struct ethernet_device *, const char *) |
| Create a new network interface. | |
| error_t | net_interface_add_subnet (struct net_interface *, __be ipv4_t, uint8_t cidr) |
| Add a new subnet to a network interface. | |
| const struct subnet * | net_interface_find_subnet (__be ipv4_t) |
| Find the first subnet that contains the specified address. More... | |
| struct net_interface * | net_interface_find (__be ipv4_t) |
| Find the interface by source IP address. | |
Network interfaces are a layer just above the network device, used for packet routing. It associates subnets to network devices, allowing us to retreive which network device should be used depending on the destination address.
An interface can correspond to only ONE network device, but can have multiple subnet masks.
A subnet is used to match the destination IP when sending a packet.
Each subnet contains a source IP, and a subnet mask. If the destination is in the subnet's range, then its source IP is used as the packet's source address and the packet is sent through the subnet's containing interface's network device.
| const struct subnet * net_interface_find_subnet | ( | __be | ipv4_t | ) |