[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] [PATCH] "Locally configured IP" check in ezjail-admin is not 100% reliable



On 14.01.2012 21:46, Thomas Steen Rasmussen wrote:
> ----------------------------------------------------
> [tykling@tykburk ~]$ nc -n -s 10.10.1.115 -u -w 0 127.0.0.1 1 2> /dev/null
> [tykling@tykburk ~]$ echo $?
> 0
> [tykling@tykburk ~]$ nc -n -s 10.10.1.116 -u -w 0 127.0.0.1 1 2> /dev/null
> [tykling@tykburk ~]$ echo $?
> 1
> [tykling@tykburk ~]$
> ----------------------------------------------------
Hello again,

I should probably have mentioned, in case it isn't obvious,
that the first IP is the one being checked, and the second IP
doesn't really matter. In the example, 10.10.1.115 is
locally configured and 10.10.1.116 is not.

The idea is simply to get nc to try binding to the IP, without
piping anything into nc so it doesn't send any data. We throw
away any error messages, and check the exitcode from nc.


Best regards,

Thomas Steen Rasmussen