Try SO_BINDTODEVICE socket option
Ciao Dirk On Tue, Nov 7, 2017 at 3:55 PM, Fabian Cenedese <[email protected]> wrote: > At 15:20 07.11.2017, you wrote: > >Hi, > > > >I am doing similar thing. I think I will use one thread to collect data > from multiple devices and feed them to corresponding netif->input. > >Don't feed data directly to tcpip_input, if you do so, make sure you pass > the right netif to it. Anyway make sure you have two individual netif. > > I do have two netifs, as mentioned before, I call netif_add/setup twice. > Reading and processing the incoming frames is one thing, sending the > reply back over the same interface is another. > > >For UDP, I believe you can bind with IP_ANY to listen on same port on all > devices. In UDP recv callback, you can find the source IP in the parameters. > > I already bind with sin_addr.s_addr=PP_HTONL(INADDR_ANY), > but this fails on the second bind. Somehow makes sense > as LwIP wouldn't know which one to give an incoming frame. But if the > sockets were netif specific then it would be possible for both netifs to > listen > on the same port. > > >Are you working on something like a router? If so, what protocol you are > working on and do you have any code resources to share, please? > > No, this is not a router but our main fieldbus CPU. One interface would be > used for loading, communication, visualisation etc. The other interface > could be used by the customer to access any network device, be it > TCP/IP or Profinet, Modbus, whatever. > The operating system is only open to our customers, sorry. But the > LwIP part is still standard so far. But that may change now. > > Thanks > > bye Fabi > > > _______________________________________________ > lwip-users mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/lwip-users >
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
