[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [lwip] Question about ip_input
From: |
David Haas |
Subject: |
[lwip-users] [lwip] Question about ip_input |
Date: |
Thu, 09 Jan 2003 00:25:20 -0000 |
This is a multi-part message in MIME format.
------=_NextPart_000_01C4_01C2A071.26A6A800
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
The following code checks if a packet is for us in ip_input:
if(ip_addr_isany(&(netif->ip_addr)) ||
ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||
(ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask)) &&
ip_addr_maskcmp(&(iphdr->dest), &(netif->ip_addr), &(netif->netmask))) =
||
ip_addr_cmp(&(iphdr->dest), IP_ADDR_BROADCAST)) {
break;
}
Why is one of the criteria ip_addr_isany(&(netif->ip_addr)) ?
This says that if our address is 0.0.0.0 we will take any packet and =
process it as if it is for us. A netif which has a wrongly initialized =
or configured ip address is likely to be 0.0.0.0. In fact, I think we =
should ignore any interface with address 0.0.0.0.
David Haas
NBS Card Technology
70 Eisenhower Drive,
Paramus, NJ 07652
Voice: 201-845-7373 x183
Fax: 201-845-3337
email: address@hidden
------=_NextPart_000_01C4_01C2A071.26A6A800
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>The following code checks if a packet is for us in=20
ip_input:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> =
if(ip_addr_isany(&(netif->ip_addr))=20
||<BR> =
ip_addr_cmp(&(iphdr->dest),=20
&(netif->ip_addr)) ||<BR> =20
(ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask))=20
&&<BR> ip_addr_maskcmp(&(iphdr->dest),=20
&(netif->ip_addr), &(netif->netmask)))=20
||<BR> =
ip_addr_cmp(&(iphdr->dest),=20
IP_ADDR_BROADCAST)) {<BR> =20
break;<BR> }<BR></FONT></DIV>
<DIV><FONT size=3D2>Why is one of the criteria=20
ip_addr_isany(&(netif->ip_addr)) ?</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>This says that if our address is 0.0.0.0 we will =
take any=20
packet and process it as if it is for us. A netif which has a wrongly=20
initialized or configured ip address is likely to be 0.0.0.0. In fact, I =
think=20
we should ignore any interface with address 0.0.0.0.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> </DIV></FONT>
<DIV><FONT size=3D2>David Haas<BR>NBS Card Technology<BR>70 Eisenhower=20
Drive,<BR>Paramus, NJ 07652<BR>Voice: 201-845-7373 x183<BR>Fax:=20
201-845-3337<BR>email: <A=20
href=3D"mailto:address@hidden">address@hidden</A><BR></FONT></DIV><=
/BODY></HTML>
------=_NextPart_000_01C4_01C2A071.26A6A800--
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] [lwip] Question about ip_input,
David Haas <=