Sean Boudreau(deleted)
|
Re: Blocking external access for qconn
|
Sean Boudreau(deleted)
08/06/2010 1:16 PM
post62089
|
Re: Blocking external access for qconn
You probably need
addr.sin_addr.s_addr = local ? htonl(INADDR_LOOPBACK) : INADDR_ANY;
but I would have thought the bind would fail. Check 'netstat -an'.
Regards,
-seanb
On Fri, Aug 06, 2010 at 01:12:40PM -0400, Elena Laskavaia wrote:
> So I changed code to this:
> memset(&addr, 0x00, sizeof addr);
> addr.sin_len = sizeof addr;
> addr.sin_addr.s_addr = local?INADDR_LOOPBACK:INADDR_ANY;
> addr.sin_family = AF_INET;
> addr.sin_port = 9000;
>
> if (bind(fd, (struct sockaddr *)&addr, addr.sin_len) == -1) {
> ...
> }
> But it does not accept connection now (if I run with local flag):
>
> localhost:/tmp)telnet localhost 9000
> Trying 127.0.0.1...
> telnet: connect to address 127.0.0.1: Connection refused
> Trying ::1...
> telnet: socket: Address family not supported by protocol family
>
> Anything else I need to change?
>
> Sean Boudreau wrote:
> > On Fri, Aug 06, 2010 at 12:17:53PM -0400, Elena Laskavaia wrote:
> >
> >> Lets say I start qconn on port 8000 on target.
> >> I want DENY all connections to this port from all hosts except localhost.
> >> Can I do it using network configuration or do I have to have firewall for that?
> >> Or can I change qconn code to do something like this?
> >>
> >
> > Instead of bind()ing to INADDR_ANY:8000 you can
> > bind() to INADDR_LOOPBACK:8000.
> >
> > Regards,
> >
> > -seanb
> >
> >
> >
> > _______________________________________________
> >
> > General
> > http://community.qnx.com/sf/go/post62060
> >
> >
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post62087
>
|
|
|