Skip to content

Commit

Permalink
Merge pull request #950 from ywc689/bugfix
Browse files Browse the repository at this point in the history
Bugfixes from Issues
  • Loading branch information
ywc689 authored May 29, 2024
2 parents e1d2929 + e19269d commit 41f762d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/ipvs/ip_vs_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,8 @@ static int conn_term_lcore(void *arg)
if (!rte_lcore_is_enabled(rte_lcore_id()))
return EDPVS_DISABLED;

conn_flush();

if (this_conn_tbl) {
conn_flush();
rte_free(this_conn_tbl);
this_conn_tbl = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ipvs/ip_vs_laddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static inline int __laddr_step(struct dp_vs_service *svc)
* */
if (strncmp(svc->scheduler->name, "rr", 2) == 0 ||
strncmp(svc->scheduler->name, "wrr", 3) == 0)
return (random() % 100) < 5 ? 2 : 1;
return rte_rand_max(100) < 5 ? 2 : 1;

return 1;
}
Expand Down
12 changes: 8 additions & 4 deletions src/ipvs/ip_vs_proxy_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,10 @@ int proxy_proto_insert(struct proxy_info *ppinfo, struct dp_vs_conn *conn,
if (unlikely(NULL == inet_ntop(AF_INET, &ppinfo->addr.ip4.dst_addr,
tbuf2, sizeof(tbuf2))))
return EDPVS_INVAL;
sprintf(ppv1buf, "PROXY TCP4 %s %s %d %d\r\n", tbuf1, tbuf2,
ntohs(ppinfo->addr.ip4.src_port), ntohs(ppinfo->addr.ip4.dst_port));
if (unlikely(snprintf(ppv1buf, sizeof(ppv1buf), "PROXY TCP4 %s %s %d %d\r\n",
tbuf1, tbuf2, ntohs(ppinfo->addr.ip4.src_port),
ntohs(ppinfo->addr.ip4.dst_port)) > sizeof(ppv1buf)))
return EDPVS_INVAL;
break;
case AF_INET6:
if (unlikely(NULL == inet_ntop(AF_INET6, ppinfo->addr.ip6.src_addr,
Expand All @@ -494,8 +496,10 @@ int proxy_proto_insert(struct proxy_info *ppinfo, struct dp_vs_conn *conn,
if (unlikely(NULL == inet_ntop(AF_INET6, ppinfo->addr.ip6.dst_addr,
tbuf2, sizeof(tbuf2))))
return EDPVS_INVAL;
sprintf(ppv1buf, "PROXY TCP6 %s %s %d %d\r\n", tbuf1, tbuf2,
ntohs(ppinfo->addr.ip6.src_port), ntohs(ppinfo->addr.ip6.dst_port));
if (unlikely(snprintf(ppv1buf, sizeof(ppv1buf), "PROXY TCP6 %s %s %d %d\r\n",
tbuf1, tbuf2, ntohs(ppinfo->addr.ip6.src_port),
ntohs(ppinfo->addr.ip6.dst_port)) > sizeof(ppv1buf)))
return EDPVS_INVAL;
break;
default:
return EDPVS_NOTSUPP;
Expand Down
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ int main(int argc, char *argv[])

gettimeofday(&tv, NULL);
srandom(tv.tv_sec ^ tv.tv_usec ^ getpid());
rte_srand((uint64_t)(tv.tv_sec ^ tv.tv_usec ^ getpid()));
sys_start_time();

if (get_numa_nodes() > DPVS_MAX_SOCKET) {
Expand Down

0 comments on commit 41f762d

Please sign in to comment.