[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Lwip as a router
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-devel] Lwip as a router |
Date: |
Wed, 5 Mar 2014 09:42:06 +0100 |
Ghobad Emadi wrote:
> Yes, simple routing is possible, but I need to use lwip as a
> router with extended routing capabilities. As you know, when
> destination IP of received packet on Lwip does not belong to
> interfaces' subnet, Lwip does not forward it, however
> IP_FORWARDING is enabled.
For this, overriding LWIP_HOOK_IP4_ROUTE() should be enough to select the
correct interface.
> In addition, I need to have multiple gateway on one interface.
So you would have to change etharp_output() to search for the correct gateway
for the target IP address, I guess?
I'm not willing to add such a change to the main sources, but I could be talked
into adding a hook like for ip_route(), I guess. Then, your implementation
would require storing the multiple gateways in netif->state somewhere, and your
hook would search them there. The hook would be something like
ip_addr_t* LWIP_HOOK_ETHARP_GET_GW(struct netif* if, ip_addr_t* dst_addr);
Simon