From: Martin Schwenke Date: Mon, 8 Aug 2022 01:31:03 +0000 (+1000) Subject: ctdb-common: Fix a warning in the pcap code X-Git-Tag: samba-4.17.11~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98ee0c125781081bb98cdb78ed3a9df8478ee243;p=thirdparty%2Fsamba.git ctdb-common: Fix a warning in the pcap code [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 (cherry picked from commit 8b54587b1aed28aa2f3af7161a077aa9dd83894c) --- 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)) {