Skip to content

Commit

Permalink
Merge pull request #516 from ytwang0320/kp2019
Browse files Browse the repository at this point in the history
updated keepalived
  • Loading branch information
ywc689 authored Jan 8, 2020
2 parents 62ed07c + 05d1d9c commit 58ee09c
Show file tree
Hide file tree
Showing 384 changed files with 257,013 additions and 27,147 deletions.
43 changes: 24 additions & 19 deletions src/ipset.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ static struct dpvs_sockopts ipset_sockopts = {

static int ipset_parse_conf_file(void)
{
char *buf, *pstr;
bool found_num = false;
char *buf, ch;
struct dp_vs_multi_ipset_conf *ips = NULL;
int ip_num = 0, ipset_size = 0, ip_index = 0;

Expand All @@ -342,24 +341,30 @@ static int ipset_parse_conf_file(void)
RTE_LOG(WARNING, IPSET, "no memory for ipset buf\n");
return -1;
}
while(!feof(g_current_stream)) {
if((ch=getc(g_current_stream))=='\n')
ip_num++;
}
if (!ip_num) {
RTE_LOG(WARNING, IPSET, "no ip in the gfwip \n");
FREE(buf);
return -1;
}

RTE_LOG(DEBUG, IPSET, "gfwip list has %u ips\n", ip_num);

fseek(g_current_stream, 0, SEEK_SET);

ipset_size = sizeof(struct dp_vs_multi_ipset_conf) + ip_num*sizeof(struct dp_vs_ipset_conf);
ips = rte_calloc_socket(NULL, 1, ipset_size, 0, rte_socket_id());
if (ips == NULL) {
RTE_LOG(WARNING, IPSET, "no memory for ipset conf\n");
FREE(buf);
return -1;
}
ips->num = ip_num;

while (read_line(buf, CFG_FILE_MAX_BUF_SZ)) {
if (false == found_num && NULL != (pstr = strstr(buf, IPSET_CFG_MEMBERS))) {
pstr += strlen(IPSET_CFG_MEMBERS);
ip_num = atoi(pstr);
found_num = true;
ipset_size = sizeof(struct dp_vs_multi_ipset_conf) + ip_num*sizeof(struct dp_vs_ipset_conf);
ips = rte_calloc_socket(NULL, 1, ipset_size, 0, rte_socket_id());
if (ips == NULL) {
RTE_LOG(WARNING, IPSET, "no memory for ipset conf\n");
break;
}
ips->num = ip_num;
continue;
}
if (ips == NULL) {
RTE_LOG(WARNING, IPSET, "cannot get gfwip members\n");
break;
}
if (inet_pton(AF_INET, buf, &ips->ipset_conf[ip_index].addr) <= 0)
ips->ipset_conf[ip_index].af = 0;
else
Expand Down
2 changes: 1 addition & 1 deletion tools/ipvsadm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MAN = $(RPM_BUILD_ROOT)/$(MANDIR)/man8
INIT = $(RPM_BUILD_ROOT)/etc/rc.d/init.d
MKDIR = mkdir
INSTALL = install
STATIC_LIBS = ../keepalived/keepalived/libipvs-2.6/libipvs.a
STATIC_LIBS = ../keepalived/keepalived/check/libcheck.a
DPVSDEPS = ../../src/common.o

ifeq "${ARCH}" "sparc64"
Expand Down
Loading

0 comments on commit 58ee09c

Please sign in to comment.