+/*
+ Look at the address and determine if the connect attempt to this address must
+ use safe_connect() rather than the system connect() call. On linux, a smart
+ connect is needed if the target port is >32K and is even. This makes the assumption
+ that the local port rage floor is 32K; we could read something in /proc, but
+ at this point won't bother. Returns true if we determine that it is best to
+ use safe_connect().
+*/
+static int need_smartc( char* abuf ) {
+ char* tok;
+ int state = 1;
+ int v;
+
+ if( (tok = strchr( abuf, ':')) != NULL ) {
+ v = atoi( tok+1 );
+ if( v < 32767 || v % 2 != 0 ) {
+ state = 0;
+ }
+ }
+
+ return state;
+}
+