Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation warning in pcap/logpkt.c CHKSUM_ADD_RANGE [-Waddress-of-packed-member] #52

Open
wllm-rbnt opened this issue Mar 23, 2021 · 0 comments

Comments

@wllm-rbnt
Copy link
Contributor

There is a compilation warning about pointer alignment in pcap/logpkt.c

[...]
gcc -DHAVE_CONFIG_H -I.  -I. -I./common/include -I./common/lib -I./null -I./ssl -I./base -I./pcap -D_DEFAULT_SOURCE=1 -DLINUX -DOPENSSL -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -c -o pcap/ssldump-pcap_logger.o `test -f 'pcap/pcap_logger.c' || echo './'`pcap/pcap_logger.c
pcap/logpkt.c: In function ‘logpkt_pcap_build’:
pcap/logpkt.c:351:3: warning: converting a packed ‘ip4_hdr_t’ pointer (alignment 1) to a ‘uint16_t’ {aka ‘short unsigned int’} pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
  351 |   CHKSUM_ADD_RANGE(sum, ip4_hdr, sizeof(ip4_hdr_t));
      |   ^~~~~~~~~~~~~~~~
pcap/logpkt.c:80:9: note: defined here
   80 | typedef struct __attribute__((packed)) {
      |         ^~~~~~
pcap/logpkt.c:399:2: warning: converting a packed ‘tcp_hdr_t’ pointer (alignment 1) to a ‘uint16_t’ {aka ‘short unsigned int’} pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
  399 |  CHKSUM_ADD_RANGE(sum, tcp_hdr, sizeof(tcp_hdr_t) + payloadlen);
      |  ^~~~~~~~~~~~~~~~
pcap/logpkt.c:102:9: note: defined here
  102 | typedef struct __attribute__((packed)) {
      |         ^~~~~~
[...]

This issue is related to the code imported from https://github.com/droe/sslsplit
It is tracked at droe/sslsplit#256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant