lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] weird piece of code in etharp since 0.5.3+ ??


From: leon . woestenberg
Subject: [lwip-users] Re: [lwip] weird piece of code in etharp since 0.5.3+ ??
Date: Wed, 08 Jan 2003 23:51:45 -0000

Hello Martin,

ah yes, of course. This piece of code is used once ip_route() returns
"netif_default",
i.e. the interface where the default gateway is on.

The ARP code then fills in the Ethernet address of the gateway.

OK, everything seems correct. Will add some comments to the code.

Regards,

Leon.



                                                                                
                                                       
                      Martin Glunz                                              
                                                       
                      <address@hidden        To:       address@hidden           
                                                       
                      itza.de>                 cc:                              
                                                       
                      Sent by:                 Subject:  Re: [lwip] weird piece 
of code in etharp since 0.5.3+ ??                      
                      address@hidden                                            
                                                    
                      e                                                         
                                                       
                                                                                
                                                       
                                                                                
                                                       
                      29-11-2002 11:38                                          
                                                       
                      Please respond to                                         
                                                       
                      lwip                                                      
                                                       
                                                                                
                                                       
                                                                                
                                                       




address@hidden wrote:
>
> Hello,
>
> I came across something weird which seems to be in lwIP since 0.5.3 or
so:
>
> etharp.c/etharp_output() contains this piece of code:
>
>   }
>   else {
>     if(!ip_addr_maskcmp(ipaddr, &(netif->ip_addr), &(netif->netmask))) {
>       ipaddr = &(netif->gw);
>     }
>
> It seems to send a packet to the default gateway if its address is not on
> the
> local network.
>
> Now, shouldn't this decision be made in the IP layer _only_? I.e. the
> packet should not be output on this interface in the first place.
>

I've seen this too. It works if there is only one interface, I never
tested more than one interface on my target system.
Problem is that only the mac address of the default gw must be placed
in the packet, the destination IP must be preserved, and inside
etharp.c it seems to be a good place to do so (for a quick hack,
i guess).
I never analyzed the ip_route code, so I can't tell if it is easily
possible to move this code there, but I think it is the right way to
handle the default gw in ip_route.


Martin Glunz


fortune says today:
Swipple's Rule of Order:
             He who shouts the loudest has the floor.

WANTED: Schrödinger's Cat. Dead or Alive.

There are only 10 kinds of people. Those who
understand binary and those who don't.
[This message was sent through the lwip discussion list.]




[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]