diff --git a/src/main.c b/src/main.c index 31ab2d61611..99fa60ba346 100644 --- a/src/main.c +++ b/src/main.c @@ -952,10 +952,16 @@ int parse_proto(unsigned char* s, long len, int* proto) break; #ifdef USE_TCP case PROTO2UINT3('t', 'c', 'p'): + if (tcp_disable) { + return -1; + } *proto=PROTO_TCP; break; #ifdef USE_TLS case PROTO2UINT3('t', 'l', 's'): + if (tcp_disable || tls_disable) { + return -1; + } *proto=PROTO_TLS; break; #endif @@ -967,10 +973,14 @@ int parse_proto(unsigned char* s, long len, int* proto) #ifdef USE_SCTP else if (likely(len==4)){ i=PROTO2UINT4(s[0], s[1], s[2], s[3]); - if (i==PROTO2UINT4('s', 'c', 't', 'p')) + if (i==PROTO2UINT4('s', 'c', 't', 'p')) { + if (sctp_disable) { + return -1; + } *proto=PROTO_SCTP; - else + } else { return -1; + } } #endif /* USE_SCTP */ else @@ -2218,10 +2228,25 @@ int main(int argc, char** argv) goto error; } break; + case 'T': + #ifdef USE_TCP + tcp_disable=1; + #else + fprintf(stderr,"WARNING: tcp support not compiled in\n"); + #endif + break; + case 'S': + #ifdef USE_SCTP + sctp_disable=1; + #else + fprintf(stderr,"WARNING: sctp support not compiled in\n"); + #endif + break; case 'l': if ((n_lst=parse_phostport_mh(optarg, &tmp, &tmp_len, &port, &proto))==0){ - fprintf(stderr, "bad -l address specifier: %s\n", + fprintf(stderr, "bad -l address specifier: %s\n" + "Check disabled protocols\n", optarg); goto error; } @@ -2254,15 +2279,13 @@ int main(int argc, char** argv) case 'D': dont_fork_cnt++; break; - case 'T': - #ifdef USE_TCP - tcp_disable=1; - #else - fprintf(stderr,"WARNING: tcp support not compiled in\n"); - #endif - break; case 'N': #ifdef USE_TCP + if (tcp_disable) { + fprintf(stderr, "could not configure TCP children: -N %s\n" + "TCP support disabled\n", optarg); + goto error; + } tcp_cfg_children_no=strtol(optarg, &tmp, 10); if ((tmp==0) ||(*tmp)){ fprintf(stderr, "bad process number: -N %s\n", @@ -2285,15 +2308,13 @@ int main(int argc, char** argv) fprintf(stderr,"WARNING: tcp support not compiled in\n"); #endif break; - case 'S': - #ifdef USE_SCTP - sctp_disable=1; - #else - fprintf(stderr,"WARNING: sctp support not compiled in\n"); - #endif - break; case 'Q': #ifdef USE_SCTP + if (sctp_disable) { + fprintf(stderr, "could not configure SCTP children: -Q %s\n" + "SCTP support disabled\n", optarg); + goto error; + } sctp_children_no=strtol(optarg, &tmp, 10); if ((tmp==0) ||(*tmp)){ fprintf(stderr, "bad process number: -O %s\n",