ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] packet-lorawan.c compile error because of stuff added yesterday

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Tue, 13 Jun 2017 13:29:18 -0700
Hi folks,

After I did a git pull, I started getting this error:

  CC       packet-lorawan.lo
packet-lorawan.c: In function 'dissect_lorawan':
packet-lorawan.c:657:7: error: variable 'frame_length' set but not
used [-Werror=unused-but-set-variable]
  gint frame_length;

Seems to be related to this:

        frame_length = current_offset;
+#if GCRYPT_VERSION_NUMBER >= 0x010600 /* 1.6.0 */
        if (encryption_keys) {
                guint8 *msg = (guint8
*)wmem_alloc0(wmem_packet_scope(), frame_length + 16);
                msg[0] = 0x49;
@@ -824,7 +833,9 @@ dissect_lorawan(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree _U_, void *d
                if (calculate_mic(msg, frame_length + 16,
encryption_keys->nwkskey->data) != tvb_get_guint32(tvb,
current_offset, ENC_LITTLE_ENDIAN)) {
                        proto_tree_add_expert_format(lorawan_tree,
pinfo, &ei_lorawan_invalid_crc, tvb, current_offset, 4, "Invalid
CRC");
                }
-       } else {
+       } else
+#endif
+       {

It's a bit rude to cause build errors just because I don't have gcrypt
1.6.0 or above.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)