]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ip-packet: Fix compiler warning seen on FreeBSD 15
authorTobias Brunner <tobias@strongswan.org>
Fri, 12 Dec 2025 07:10:13 +0000 (08:10 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 12 Dec 2025 14:58:31 +0000 (15:58 +0100)
We explicitly use untoh16() so this warning isn't relevant:

  ip_packet.c:313:42: error: taking address of packed member 'ip_len' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]

src/libipsec/ip_packet.c

index b623c9bfa940547bc3257c94b4f2be63b483a9dd..08a42111b447632fb28186e0205ff03196757e4f 100644 (file)
@@ -310,7 +310,7 @@ ip_packet_t *ip_packet_create(chunk_t packet)
                        }
                        ip = (struct ip*)packet.ptr;
                        /* remove any RFC 4303 TFC extra padding */
-                       packet.len = min(packet.len, untoh16(&ip->ip_len));
+                       packet.len = min(packet.len, untoh16((void*)&ip->ip_len));
                        payload = chunk_skip(packet, ip->ip_hl * 4);
                        if ((ip->ip_off & htons(IP_OFFMASK)) == 0 &&
                                !parse_transport_header(payload, ip->ip_p, &sport, &dport))