Skip to content

Commit

Permalink
Merge pull request #906 from roykingz/devel
Browse files Browse the repository at this point in the history
fix cfgfile parser malloc problem and ipvsadm improvement
  • Loading branch information
ywc689 committed Sep 6, 2023
2 parents f016473 + 279a549 commit d683835
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ void *set_value(vector_t tokens)
strncat(alloc, str, strlen(str));
}
} else {
alloc = MALLOC(sizeof(char *) * (size + 1));
memcpy(alloc, str, size);
alloc = MALLOC(sizeof(char) * (size + 1));
memcpy(alloc, str, size + 1);
}

return alloc;
Expand Down
6 changes: 5 additions & 1 deletion tools/ipvsadm/ipvsadm.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce,
case 't':
case 'u':
case 'q':
case '1':
set_option(options, OPT_SERVICE);
if (c == 't') {
ce->dpvs_svc.proto = IPPROTO_TCP;
Expand Down Expand Up @@ -1721,7 +1722,10 @@ static void usage_exit(const char *program, const int exit_status)
" --dest-check CHECK_CONF config health check, inhibit scheduling to failed backends\n"
" CHECK_CONF:=disable|default(passive)|DETAIL(passive)|tcp|udp|ping, DETAIL:=UPDOWN|DOWNONLY\n"
" UPDOWN:=down_retry,up_confirm,down_wait,inhibit_min-inhibit_max, for example, the default is 1,1,3s,5-3600s\n"
" DOWNONLY:=down_retry,down_wait, for example, --dest-check=1,3s\n",
" DOWNONLY:=down_retry,down_wait, for example, --dest-check=1,3s\n"
" --laddr -z local-ip local IP\n"
" --blklst -k blacklist-ip blacklist IP for specific service\n"
" --whtlst -2 whitelist-ip whitelist IP for specific service\n",
DEF_SCHED);

exit(exit_status);
Expand Down

0 comments on commit d683835

Please sign in to comment.