Skip to content

Commit

Permalink
core: allow setting server id via --server-id command line param
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed May 16, 2019
1 parent a5781fc commit 6ca7788
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.c
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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 '?':
Expand Down

0 comments on commit 6ca7788

Please sign in to comment.