From fe34ab1885bf2c8acb68f82a9cf51355c38bfcf1 Mon Sep 17 00:00:00 2001 From: wencyu Date: Tue, 7 Jun 2022 18:36:28 +0800 Subject: [PATCH] fix some compile problems found on ubuntu Signed-off-by: wencyu --- README.md | 2 +- include/conf/neigh.h | 2 +- scripts/dpdk-build.sh | 2 +- src/Makefile | 1 + tools/dpip/Makefile | 1 + tools/dpip/ipset.c | 2 +- tools/keepalived/keepalived/check/check_udp.c | 8 ++++---- tools/keepalived/keepalived/include/ip_vs.h | 15 ++++++++++++++- 8 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b8524fdad..0ac74c350 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ $ make # or "make -j" to speed up $ make install ``` > Notes: -> 1. Build dependencies may be needed, such as `pkg-config`(version 0.29.2+),`automake`, `libnl3`, `libnl-genl-3.0`, `openssl`, `popt` and `numactl`. You can install the missing dependencies by using the package manager of the system, e.g., `yum install popt-devel` (CentOS). +> 1. Build dependencies may be needed, such as `pkg-config`(version 0.29.2+),`automake`, `libnl3`, `libnl-genl-3.0`, `openssl`, `popt` and `numactl`. You can install the missing dependencies by using the package manager of the system, e.g., `yum install popt-devel automake` (CentOS) or `apt install libpopt-dev autoconfig` (Ubuntu). > 2. Early `pkg-config` versions (v0.29.2 before) may cause dpvs build failure. If so, please upgrade this tool. Output files are installed to `dpvs/bin`. diff --git a/include/conf/neigh.h b/include/conf/neigh.h index 618cad2a7..bb70c7363 100644 --- a/include/conf/neigh.h +++ b/include/conf/neigh.h @@ -45,7 +45,7 @@ struct dp_vs_neigh_conf { char ifname[IFNAMSIZ]; uint8_t flag; uint8_t cid; -}__attribute__((__packed__)); +}__attribute__((__packed__, aligned(2))); struct dp_vs_neigh_conf_array { int neigh_nums; diff --git a/scripts/dpdk-build.sh b/scripts/dpdk-build.sh index 9e7741292..8416120b0 100755 --- a/scripts/dpdk-build.sh +++ b/scripts/dpdk-build.sh @@ -106,5 +106,5 @@ echo -e "DPDK library installed successfully into directory: \033[32m$(pwd)/dpdk ## export dpdk lib echo -e "You can use this library in dpvs by running the command below:" echo -e "\033[32m" -echo -e "export PKG_CONFIG_PATH=$(pwd)/dpdklib/lib64/pkgconfig" +echo -e "export PKG_CONFIG_PATH=$(find $(pwd) -name pkgconfig)" echo -e "\033[0m" diff --git a/src/Makefile b/src/Makefile index 1ef63e5ea..64c9471b6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -50,6 +50,7 @@ CFLAGS += -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -mcmodel=medium ifeq ($(shell test $(GCC_VERSION) -ge 70 && echo 1), 1) CFLAGS += -Wno-format-truncation CFLAGS += -Wno-stringop-truncation + CFLAGS += -Wno-address-of-packed-member CFLAGS += -Wstringop-overflow=0 endif diff --git a/tools/dpip/Makefile b/tools/dpip/Makefile index 0b1a3a4a5..e1bbe21e4 100644 --- a/tools/dpip/Makefile +++ b/tools/dpip/Makefile @@ -23,6 +23,7 @@ TARGET = build/dpip CFLAGS = -g -O0 CFLAGS += -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes +CFLAGS += -Wno-address-of-packed-member CFLAGS += -I ../../include CFLAGS += -I ../keepalived/keepalived/include diff --git a/tools/dpip/ipset.c b/tools/dpip/ipset.c index 26f2c831f..baeee9257 100644 --- a/tools/dpip/ipset.c +++ b/tools/dpip/ipset.c @@ -820,7 +820,7 @@ ipset_check(const struct dpip_obj *obj, dpip_cmd_t cmd) static void bitmap_dump_header(char *buf, struct ipset_info *info) { - char range[50]; + char range[128]; char addr[INET6_ADDRSTRLEN], addr2[INET6_ADDRSTRLEN]; if (info->bitmap.cidr) { diff --git a/tools/keepalived/keepalived/check/check_udp.c b/tools/keepalived/keepalived/check/check_udp.c index 5f1f3c6f6..16a7ec336 100644 --- a/tools/keepalived/keepalived/check/check_udp.c +++ b/tools/keepalived/keepalived/check/check_udp.c @@ -312,7 +312,7 @@ udp_check_thread(thread_ref_t thread) if (recv_buf) FREE(recv_buf); - return; + return 0; } static int @@ -331,7 +331,7 @@ udp_connect_thread(thread_ref_t thread) if (!checker->enabled) { thread_add_timer(thread->master, udp_connect_thread, checker, checker->delay_loop); - return; + return 0; } if ((fd = socket(co->dst.ss_family, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_UDP)) == -1) { @@ -339,7 +339,7 @@ udp_connect_thread(thread_ref_t thread) thread_add_timer(thread->master, udp_connect_thread, checker, checker->delay_loop); - return; + return 0; } status = udp_bind_connect(fd, co, udp_check->payload, udp_check->payload_len); @@ -350,7 +350,7 @@ udp_connect_thread(thread_ref_t thread) udp_epilog(thread, false); } - return; + return 0; } #ifdef THREAD_DUMP diff --git a/tools/keepalived/keepalived/include/ip_vs.h b/tools/keepalived/keepalived/include/ip_vs.h index e8a7e0bc2..90d8a6672 100644 --- a/tools/keepalived/keepalived/include/ip_vs.h +++ b/tools/keepalived/keepalived/include/ip_vs.h @@ -22,7 +22,7 @@ // ///////////////////////////////////////////////////////////////////////////////////////// -#define IP_VS_VERSION_CODE 0x010808 /* DPVS v1.8.8 */ +#define IP_VS_VERSION_CODE 0x010902 /* DPVS v1.9.2 */ #define NVERSION(version) \ (version >> 16) & 0xFF, \ (version >> 8) & 0xFF, \ @@ -85,6 +85,19 @@ #define IP_VS_SO_GET_LADDRS (IP_VS_BASE_CTL+8) #define IP_VS_SO_GET_MAX IP_VS_SO_GET_LADDRS +/* Tunnel types */ +enum { + IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0, /* IPIP */ + IP_VS_CONN_F_TUNNEL_TYPE_GUE, /* GUE */ + IP_VS_CONN_F_TUNNEL_TYPE_GRE, /* GRE */ + IP_VS_CONN_F_TUNNEL_TYPE_MAX, +}; + +/* Tunnel encapsulation flags */ +#define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM (0) +#define IP_VS_TUNNEL_ENCAP_FLAG_CSUM (1 << 0) +#define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM (1 << 1) + /* * The struct ip_vs_service_user and struct ip_vs_dest_user are * used to set IPVS rules through setsockopt.