[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] RFC: ip_input() program flow
From: |
Leon Woestenberg |
Subject: |
[lwip-devel] RFC: ip_input() program flow |
Date: |
Sun, 27 Jun 2004 23:44:26 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
Hello,
I am currently implementing interface up/down status in CVS head tree. I
came across this:
ip_input(p, inp_netif) processes the incoming packet p which was
received on network interface 'netif'.
In this function, we match p against *ALL* interfaces, i.e. we accept
host-local forwarding by default.
Why do we do so? Is this standards compliant?
Example: Suppose two interfaces: 192.168.0.1/24 and 10.1.0.1/16
A packet ingressing on the 10.1.0.1/16 netif with destination
192.168.0.1 will be accepted,
even if routing is disabled.
-- current pseudo code --
drop non-IPv4 packets
drop packets where header is laid out over multiple pbufs (i.e. in
non-contiguous memory)
drop wrong checksum packets
dest_netif = any local netif IP address that matches destination IP address
if LWIP_DHCP then if dest_netif = NULL then dest_netif := inp_netif
if dest_netif = NULL {
if non-broadcast packet then ip_forward(p, inp_netif)
free(p)
}
reassemble
if p.protocol=udp then udp_input(p, inp_netif);
if p.protocol=tcp then tcp_input(p, inp_netif)
--
-- proposed pseudo code --
drop non-IPv4 packets
drop packets where header is laid out over multiple pbufs (i.e. in
non-contiguous memory)
drop wrong checksum packets
if netif IP address matches destination IP address && netif.status = up,
dest_netif := inp_netif
else if forwarding enabled {
dest_netif = any local netif IP address that matches destination IP
address && netif.status = up
}
if LWIP_DHCP then if dest_netif = NULL then dest_netif := inp_netif
if dest_netif = NULL {
if non-broadcast packet then ip_forward(p, inp_netif)
free(p)
}
reassemble
if p.protocol=udp then udp_input(p, inp_netif);
if p.protocol=tcp then tcp_input(p, inp_netif)
--
Regards,
Leon.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] RFC: ip_input() program flow,
Leon Woestenberg <=