Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 1998 12:49:20 -0800
From:      Paul Traina <pst@Shockwave.COM>
To:        questions@FreeBSD.ORG
Subject:   getting remote side of tcp connection's address before accept()?
Message-ID:  <199802202049.MAA06911@precipice.shockwave.com>

next in thread | raw e-mail | index | archive | help
Folks,

I'd like to be able to refuse tcp connections to a particular daemon
from a certain list of addresses.

What I'd ideally like to do is bind and listen on a socket, then
when a connection request comes in, check the remote peer's address
information, and allow the connection only if the address info
was correct.

If I do it with a standard:

		bind
		listen
		accept
		if (!good_address)
			close
			
The tcp connection is accepted and then closed.  I want the TCP
connection to be refused, never accepted.

Under ISO/TP4, the accept(2) and recvmsg(2) manual pages inply you
can pull this off by closing the accept'ed socket before ever doing
any real read/write operations to it.

Has anyone ever pulled this off with tcp sockets?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802202049.MAA06911>