From 8b54587b1aed28aa2f3af7161a077aa9dd83894c Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 8 Aug 2022 11:31:03 +1000 Subject: [PATCH] ctdb-common: Fix a warning in the pcap code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [173/416] Compiling ctdb/common/system_socket.c ../../common/system_socket.c: In function ‘ctdb_sys_read_tcp_packet’: ../../common/system_socket.c:1016:15: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] 1016 | eth = (struct ether_header *)buffer; | ^ Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/common/system_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c index ced2b17fc21..71c60853ee3 100644 --- a/ctdb/common/system_socket.c +++ b/ctdb/common/system_socket.c @@ -998,7 +998,7 @@ int ctdb_sys_read_tcp_packet(int s, uint16_t *window) { int ret; - struct ether_header *eth; + const struct ether_header *eth; struct pcap_pkthdr pkthdr; const u_char *buffer; pcap_t *pt = (pcap_t *)private_data; @@ -1012,7 +1012,7 @@ int ctdb_sys_read_tcp_packet(int s, ZERO_STRUCTP(dst); /* Ethernet */ - eth = (struct ether_header *)buffer; + eth = (const struct ether_header *)buffer; /* we want either IPv4 or IPv6 */ if (eth->ether_type == htons(ETHERTYPE_IP)) {