2
0
Эх сурвалжийг харах

core: allow setting server id via --server-id command line param

Daniel-Constantin Mierla 6 жил өмнө
parent
commit
6ca77883af
1 өөрчлөгдсөн 10 нэмэгдсэн , 1 устгасан
  1. 10 1
      src/main.c

+ 10 - 1
src/main.c

@@ -204,7 +204,8 @@ Options:\n\
 #ifdef STATS
 "    -s file     File where to write internal statistics on SIGUSR1\n"
 #endif
-"    --subst=exp set a subst preprocessor directive\n\
+"    --server-id=num set the value for server_id\n\
+    --subst=exp set a subst preprocessor directive\n\
     --substdef=exp set a substdef preprocessor directive\n\
     --substdefs=exp set a substdefs preprocessor directive\n"
 #ifdef USE_SCTP
@@ -1906,6 +1907,7 @@ int main(int argc, char** argv)
 		{"subst",       required_argument, 0, KARGOPTVAL + 1},
 		{"substdef",    required_argument, 0, KARGOPTVAL + 2},
 		{"substdefs",   required_argument, 0, KARGOPTVAL + 3},
+		{"server-id",   required_argument, 0, KARGOPTVAL + 4},
 		{0, 0, 0, 0 }
 	};
 
@@ -2157,6 +2159,13 @@ int main(int argc, char** argv)
 						goto error;
 					}
 					break;
+			case KARGOPTVAL+4:
+					server_id=(int)strtol(optarg, &tmp, 10);
+					if ((tmp==0) || (*tmp)){
+						LM_ERR("bad server_id value: %s\n", optarg);
+						goto error;
+					}
+					break;
 
 			/* special cases */
 			case '?':