lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] multiple netifs in no_sys environment


From: steffen.storck
Subject: Re: [lwip-users] multiple netifs in no_sys environment
Date: Fri, 7 Jun 2019 11:45:58 +0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Thank your for your answer.

I made it work by defining  the LWIP_ARP_FILTER_NETIF_FN function in 
netif_input() to determine which netif to use for sending and further checks.

Thanks again.

Code of the filter function looks like this


struct netif *netif_filter(void *p, struct netif *netif, unsigned short type)
{
uint32_t addr;

switch(type)
{
case ETHTYPE_IP:
if(((struct pbuf*) p)->len < ETH_IP_DESTINATION_IP_POS + sizeof(addr)) return 
netif;
memcpy(&addr, (uint8_t*) (((struct pbuf*) p)->payload)+ 
(ETH_IP_DESTINATION_IP_POS + ETH_PAD_SIZE), sizeof(addr));
break;

case ETHTYPE_ARP:
if(((struct pbuf*) p)->len < ETH_ARP_DESTINATION_IP_POS + sizeof(addr)) return 
netif;
memcpy(&addr, (uint8_t*) (((struct pbuf*) 
p)->payload)+(ETH_ARP_DESTINATION_IP_POS + ETH_PAD_SIZE), sizeof(addr));
break;

default:
return netif;
}


if(addr^netif->ip_addr.addr)
{
for(uint32_t i=0; i<xnetif_count; i++)
{
struct netif *const ptr = xnetif+i;
if(!(addr^ptr->ip_addr.addr)) return ptr;
}
}

return netif;
}


- -----Ursprüngliche Nachricht-----
Von: lwip-users <lwip-users-bounces+steffen.storck=address@hidden> Im Auftrag 
von Sergio R. Caprile
Gesendet: Montag, 29. April 2019 14:59
An: address@hidden
Betreff: Re: [lwip-users] multiple netifs in no_sys environment

The lwIP stack will not work as a router unless you actually write the
routing code yourself. Since in your scenario the non-local address is
the device netif address, that should work. If it were some other host
in that very same network (172...) connected to the lwIP device, it
would not (unless you write the code).
How to do it: you just setup two netifs. I would set the 192... to
default. Try the echo server and it should work.

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

________________________________


SEW-EURODRIVE GmbH & Co KG
Kommanditgesellschaft, Sitz: Bruchsal, RG Mannheim HRA 230970
Komplementärin: SEW-EURODRIVE Verwaltungs-GmbH, Sitz: Bruchsal, RG Mannheim HRB 
230207

Gesellschafter: Jürgen Blickle, Rainer Blickle
Geschäftsführung: Jürgen Blickle (Vorsitzender), Udo Aull, Dr. Jörg Hermes, Dr. 
Hans Krattenmacher, Johann Soder, Dr. Jürgen Zanghellini

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.4.2 (Build 502)
Charset: iso-8859-1

wsBVAwUBXPpOeOPdlEjxNdWZAQi9lwgAqYB2fxsbF+bRB0kD0OHvssaKO8Mu6OrC
X6USB64zSf8bTwo1iuG1n8ble9rIUmAhb+iIpFJiHeQqDPsLOB2XHK5ayF7xNBfb
OaW2HlfBthKBowKrhxBaCs6ztbXRjQ9havu7nv407fasyMFdtn99050sKVT9gsFh
JJYl6M/sJPRgKAG5oQruvAjB7rIZzltZaCaD0uxe5cY3PyOETGt9dqL6nu6Bq5u0
Fa8IbpGZsEGAOpq1Rmhj+Xdlfi2ocSkZrhip3BbJeY7PCJiX2REYqyQNl7p079mf
Ifrzg6AFMpvJse9DX0bmG7FzYfMEFMEV2V8JyT0dXw8fxHpHt1j2MA==
=0a9j
-----END PGP SIGNATURE-----



reply via email to

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