Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!msunews!news.gmi.edu!aanews.merit.net!news.cic.net!newsxfer.nether.net!newsxfer.itd.umich.edu!feeder.chicago.cic.net!su-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!howland.erols.net!rill.news.pipex.net!pipex!oleane!jussieu.fr!fdn.fr!r2d2.fdn.org!sphynx.fdn.fr!causse From: causse@sphynx.fdn.fr (Philippe Causse) Subject: Re: Accept()-ing a connection from a specific IP address... X-Newsreader: TIN [version 1.2 PL2] Organization: individual - paris - france Message-ID: <EAHuuM.129@sphynx.fdn.fr> References: <864144757.18711@dejanews.com> Date: Tue, 20 May 1997 19:15:58 GMT Lines: 28 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:41334 moballa@WESTECHMobile.com wrote: : Is there any way to use the Accept() routine to only accept a connection : from a specific IP address? Currently my program accepts a connection : from anyone issuing a connect() call to it. I would like to specify that : it should only accept a connection from a particular IP address. : Does anyone know how to do this? Yes ! Afetr you created your `listening' socket: 1) bind it to the interface you whish to accept calls from (getnetent could help) 2) When accept() returns, check the peer address and if the address is not an "allowed one", you should immediately close the returned socket. Other option (simpler, faster): use the tcp_wrappers library ! : Thanks in advance, : Marco Oballa : -------------------==== Posted via Deja News ====----------------------- : http://www.dejanews.com/ Search, Read, Post to Usenet -- ------------------------------------------------------------------- P. Causse http://www.fdn.fr/~pcausse 4.4BSD/X11R6/Motif-2.0/C++ mailto:causse@sphynx.fdn.fr (UUCP)