aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorJieqiang Wang <jieqiang.wang@arm.com>2021-02-10 15:16:51 +0000
committerBeno�t Ganne <bganne@cisco.com>2021-03-04 09:22:57 +0000
commit3f79e27409301217f493e41f104a848903ca4103 (patch)
tree5bac33d93488b264d19b681ebc1e6810178a1909 /src/vppinfra
parent57084e54082a29d19d2e4b71581c2a4980f8ce15 (diff)
vppinfra: fix compiling error due to incompatible udphdr field names
Compiling VPP on CentOS 7 will fail shown as below. The root cause is that uh_sport/uh_dport field names for struct udphdr are chosen only if macro __FAVOR_BSD in /usr/include/netinet/udp.h is defined for glibc version less than 2.19. Fix this issue by using source and dest field names in struct udphdr for compatibility reasons. FAILED: vppinfra/CMakeFiles/vppinfra.dir/unix-formats.c.o ccache /opt/rh/devtoolset-9/root/bin/cc -Dvppinfra_EXPORTS -I/vpp/src -I. -Iinclude -Wno-address-of-packed-member -g -fPIC -Werror -Wall -march=corei7 -mtune=corei7-avx -O2 -fstack-protector -D_FORTIFY_SOURCE=2 -fno-common -flto -fno-fat-lto-objects -fPIC -fvisibility=hidden -ffunction-sections -fdata-sections -MD -MT vppinfra/CMakeFiles/vppinfra.dir/unix-formats.c.o -MF vppinfra/CMakeFiles/vppinfra.dir/unix-formats.c.o.d -o vppinfra/CMakeFiles/vppinfra.dir/unix-formats.c.o -c /vpp/src/vppinfra/unix-formats.c /vpp/src/vppinfra/unix-formats.c: In function 'format_udp4_packet': /vpp/src/vppinfra/unix-formats.c:319:19: error: 'struct udphdr' has no member named 'uh_sport' 319 | u16 source = udp->uh_sport; | ^~ /vpp/src/vppinfra/unix-formats.c:320:17: error: 'struct udphdr' has no member named 'uh_dport' 320 | u16 dest = udp->uh_dport; Type: fix Change-Id: Ifc99c7286ea3fac463096152267033ac0518c230 Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com> Reviewed-by: Lijian Zhang <lijian.zhang@arm.com> Reviewed-by: Tianyu Li <tianyu.li@arm.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/unix-formats.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/vppinfra/unix-formats.c b/src/vppinfra/unix-formats.c
index 678700e6129..af1eb1aaa7b 100644
--- a/src/vppinfra/unix-formats.c
+++ b/src/vppinfra/unix-formats.c
@@ -316,13 +316,10 @@ u8 * format_udp4_packet (u8 * s, va_list * args)
struct iphdr * ip = (void *) p;
struct udphdr * udp = (void *) (ip + 1);
- u16 source = udp->uh_sport;
- u16 dest = udp->uh_dport;
-
s = format (s, "udp %U:%U -> %U:%U", format_network_address, AF_INET,
- &ip->saddr, format_network_port, IPPROTO_UDP, ntohs (source),
- format_network_address, AF_INET, &ip->daddr, format_network_port,
- IPPROTO_UDP, ntohs (dest));
+ &ip->saddr, format_network_port, IPPROTO_UDP,
+ ntohs (udp->source), format_network_address, AF_INET, &ip->daddr,
+ format_network_port, IPPROTO_UDP, ntohs (udp->dest));
return s;
}