lwip: add source ip based route for unicast packet
Add source IP based route for unicast packets forwarding.
This commit is contained in:
parent
ffaf08e851
commit
2e1427a239
1 changed files with 2 additions and 4 deletions
|
@ -133,16 +133,14 @@ bool ip4_netif_exist(const ip4_addr_t *src, const ip4_addr_t *dest)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Source based IPv4 routing hook function. This function works only
|
* Source based IPv4 routing hook function.
|
||||||
* when destination IP is broadcast IP.
|
|
||||||
*/
|
*/
|
||||||
struct netif * ESP_IRAM_ATTR
|
struct netif * ESP_IRAM_ATTR
|
||||||
ip4_route_src_hook(const ip4_addr_t *dest, const ip4_addr_t *src)
|
ip4_route_src_hook(const ip4_addr_t *dest, const ip4_addr_t *src)
|
||||||
{
|
{
|
||||||
struct netif *netif = NULL;
|
struct netif *netif = NULL;
|
||||||
|
|
||||||
/* destination IP is broadcast IP? */
|
if ((src != NULL) && !ip4_addr_isany(src)) {
|
||||||
if ((src != NULL) && (dest->addr == IPADDR_BROADCAST)) {
|
|
||||||
/* iterate through netifs */
|
/* iterate through netifs */
|
||||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||||
/* is the netif up, does it have a link and a valid address? */
|
/* is the netif up, does it have a link and a valid address? */
|
||||||
|
|
Loading…
Reference in a new issue