From 143058b37b697107371da9ce4919cf0712869ca5 Mon Sep 17 00:00:00 2001 From: ywc689 Date: Wed, 8 Jan 2020 11:09:05 +0800 Subject: [PATCH] fix format and build problem of new keepalived version --- .gitignore | 1 + src/ipset.c | 4 +-- tools/Makefile | 1 + tools/ipvsadm/ipvsadm.c | 52 ++++++++++++++++++------------------- tools/keepalived/install-sh | 1 - 5 files changed, 30 insertions(+), 29 deletions(-) delete mode 120000 tools/keepalived/install-sh diff --git a/.gitignore b/.gitignore index 8be1e7227..7a3fc6ac5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ tools/keepalived/keepalived/libipvs-2.6/libipvs.a tools/keepalived/keepalived/vrrp/Makefile tools/keepalived/lib/Makefile tools/keepalived/lib/config.h +tools/keepalived/install-sh src/dpvs .cache.mk .tmp_versions/ diff --git a/src/ipset.c b/src/ipset.c index 0cddc3e26..301d3d419 100644 --- a/src/ipset.c +++ b/src/ipset.c @@ -341,8 +341,8 @@ 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') + while (!feof(g_current_stream)) { + if ((ch=getc(g_current_stream)) == '\n') ip_num++; } if (!ip_num) { diff --git a/tools/Makefile b/tools/Makefile index 0692213bb..01e31fb5c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -28,6 +28,7 @@ config: keepalived_conf keepalived_conf: if [ ! -f keepalived/Makefile ]; then \ cd keepalived && \ + ./build_setup && \ ./configure && \ cd -; \ fi diff --git a/tools/ipvsadm/ipvsadm.c b/tools/ipvsadm/ipvsadm.c index a986e7989..2092bc6d8 100644 --- a/tools/ipvsadm/ipvsadm.c +++ b/tools/ipvsadm/ipvsadm.c @@ -193,7 +193,7 @@ static const char* optnames[] = { "syncid", "exact", "ops", - "pe" , + "pe" , "local-address" , "blklst-address", "synproxy" , @@ -214,39 +214,39 @@ static const char* optnames[] = { static const char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] = { /* -n -c svc -s -p -M -r fwd -w -x -y -mc tot dmn -st -rt thr -pc srt sid -ex ops pe laddr blst syn ifname sockpair hashtag cpu*/ -/*ADD*/ +/*ADD*/ {'x', 'x', '+', ' ', ' ', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', ' ', 'x', 'x', 'x', ' ', 'x' ,'x' ,' ', 'x'}, -/*EDIT*/ +/*EDIT*/ {'x', 'x', '+', ' ', ' ', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', ' ', 'x', 'x', 'x', ' ', 'x' ,'x' ,' ', 'x'}, -/*DEL*/ +/*DEL*/ {'x', 'x', '+', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*FLUSH*/ +/*FLUSH*/ {'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*LIST*/ +/*LIST*/ {' ', '1', '1', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '1', '1', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'x', 'x', 'x', 'x', 'x', 'x' ,' ' ,'x', ' '}, -/*ADDSRV*/ +/*ADDSRV*/ {'x', 'x', '+', 'x', 'x', 'x', '+', ' ', ' ', ' ', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*DELSRV*/ +/*DELSRV*/ {'x', 'x', '+', 'x', 'x', 'x', '+', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*EDITSRV*/ +/*EDITSRV*/ {'x', 'x', '+', 'x', 'x', 'x', '+', ' ', ' ', ' ', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*TIMEOUT*/ +/*TIMEOUT*/ {'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*STARTD*/ +/*STARTD*/ {'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*STOPD*/ +/*STOPD*/ {'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*RESTORE*/ +/*RESTORE*/ {'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*SAVE*/ +/*SAVE*/ {' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*ZERO*/ +/*ZERO*/ {'x', 'x', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', 'x'}, -/*ADDLADDR*/ +/*ADDLADDR*/ {'x', 'x', '+', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '+', 'x', 'x', '+' ,'x' ,'x', 'x'}, -/*DELLADDR*/ +/*DELLADDR*/ {'x', 'x', '+', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '+', 'x', 'x', '+' ,'x' ,'x', 'x'}, -/*GETLADDR*/ +/*GETLADDR*/ {'x', 'x', ' ', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' ,'x' ,'x', ' '}, /*ADDBLKLST*/ {'x', 'x', '+', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', '+', 'x', 'x' ,'x' ,'x', 'x'}, @@ -307,7 +307,7 @@ enum { TAG_NO_SORT, TAG_PERSISTENCE_ENGINE, TAG_SOCKPAIR, - TAG_CPU, + TAG_CPU, }; /* various parsing helpers & parsing functions */ @@ -610,7 +610,7 @@ parse_options(int argc, char **argv, struct ipvs_command_entry *ce, strncpy(ce->svc.user.sched_name, optarg, IP_VS_SCHEDNAME_MAXLEN); if (!memcmp(ce->svc.user.sched_name, "conhash", strlen("conhash"))) - ce->svc.user.flags = ce->svc.user.flags | IP_VS_SVC_F_SIP_HASH; + ce->svc.user.flags = ce->svc.user.flags | IP_VS_SVC_F_SIP_HASH; break; case 'p': set_option(options, OPT_PERSISTENT); @@ -1202,7 +1202,7 @@ parse_service(char *buf, ipvs_service_t *svc) * Get sockpair from the arguments. * sockpair := PROTO:SIP:SPORT:TIP:TPORT * PROTO := [tcp|udp] - * SIP,TIP := dotted-decimal ip address + * SIP,TIP := dotted-decimal ip address or square-blacketed ip6 address * SPORT,TPORT := range(0, 65535) */ static int @@ -1739,7 +1739,7 @@ static void print_largenum(unsigned long long i, unsigned int format) printf("%*llu", len <= 8 ? 9 : len + 1, i); return; } - + if (i < 100000000) /* less than 100 million */ printf("%9llu", i); else if (i < 1000000000) /* less than 1 billion */ @@ -1826,7 +1826,7 @@ print_service_entry(ipvs_service_entry_t *se, unsigned int format, lcoreid_t cid proto = "UDP"; else if (se->user.protocol == IPPROTO_ICMP) proto = "ICMP"; - else + else proto = "ICMPv6"; sprintf(svc_name, "%s %s", proto, vname); @@ -1866,7 +1866,7 @@ print_service_entry(ipvs_service_entry_t *se, unsigned int format, lcoreid_t cid left -= snprintf(svc_name + strlen(svc_name), left, ",MATCH %s", proto); - + if (strcmp(se->user.srange, "[::-::]:0-0") != 0 && strcmp(se->user.srange, "0.0.0.0-0.0.0.0:0-0") != 0) left -= snprintf(svc_name + strlen(svc_name), left, @@ -2041,7 +2041,7 @@ static void list_laddrs_print_laddr(struct ip_vs_laddr_entry * entry) char pbuf[INET6_ADDRSTRLEN]; inet_ntop(entry->af, (char *)&entry->addr, pbuf, sizeof(pbuf)); - + printf("%-20s %-8s %-20s %-10lu %-10u\n", "", "", @@ -2058,7 +2058,7 @@ static void print_service_and_laddrs(struct ip_vs_get_laddrs* d, int with_title) list_laddrs_print_service(d); for(i = 0 ; i < d->num_laddrs ; i ++){ - list_laddrs_print_laddr(d->entrytable + i); + list_laddrs_print_laddr(d->entrytable + i); } return; diff --git a/tools/keepalived/install-sh b/tools/keepalived/install-sh deleted file mode 120000 index 4fcda595b..000000000 --- a/tools/keepalived/install-sh +++ /dev/null @@ -1 +0,0 @@ -/usr/share/automake-1.13/install-sh \ No newline at end of file