Antonio de Angelis wrote: > In data 25 agosto 2008 alle ore 22:57:43, Jonathan Larmour > <[EMAIL PROTECTED]> ha scritto: > >> Antonio de Angelis wrote: >>> Hi all, >>> I've built a simple server application for the Win32 port. But now I >>> want to implement a simple mechanism to refuse incoming connections >>> from certain ip addresses... how can I get the ip address of a remote >>> host that has just connected to the server? Thanks >> >> Which API are you using? Sockets, netconn (also known as sequential >> API) or raw? > > raw api.
First of all, just to be clear, lwIP is not able to refuse incoming connections with anything like a "connection refused" ICMP message. It's deliberately simple in that respect, in line with its general ethos, so it doesn't have packet filtering capabilities. What you can do easily instead is simply close the connection immediately after it is established. So when your accept function is called, you can check the remote IP then. The remote IP is simply available inside the PCB, e.g. assuming struct tcp_pcb *pcb : pcb->ip->remote_ip Less officially, you would probably not find it hard to hack in a callback in tcp_listen_input in src/core/tcp_in.c. Hope this helps, Jifl -- eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. ------["Si fractum non sit, noli id reficere"]------ Opinions==mine _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
