From 9d728228ad9687577c4d158a8e68eee4356283f8 Mon Sep 17 00:00:00 2001 From: drochner Date: Tue, 25 Apr 2006 15:40:56 +0000 Subject: re-apply the fix for alignment of radiotap data fields, and fix two newly introduced problems: -botch in picking up IEEE80211_RADIOTAP_FLAGS -wrong offset passed to inner dissector --- net/ethereal/distinfo | 3 +- net/ethereal/patches/patch-aa | 118 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 net/ethereal/patches/patch-aa (limited to 'net') diff --git a/net/ethereal/distinfo b/net/ethereal/distinfo index 1de5ff7b575..c6cf4d68981 100644 --- a/net/ethereal/distinfo +++ b/net/ethereal/distinfo @@ -1,5 +1,6 @@ -$NetBSD: distinfo,v 1.51 2006/04/25 12:29:25 salo Exp $ +$NetBSD: distinfo,v 1.52 2006/04/25 15:40:56 drochner Exp $ SHA1 (ethereal-0.99.0.tar.bz2) = 466299ac49f21904ed91b93e81667f226637e868 RMD160 (ethereal-0.99.0.tar.bz2) = f86e21ae60d53e1ed60b61e58c2941ecfd4d8696 Size (ethereal-0.99.0.tar.bz2) = 8884587 bytes +SHA1 (patch-aa) = fab9658f576d15fbf458f173411f650787adf7bf diff --git a/net/ethereal/patches/patch-aa b/net/ethereal/patches/patch-aa new file mode 100644 index 00000000000..daf1977ef29 --- /dev/null +++ b/net/ethereal/patches/patch-aa @@ -0,0 +1,118 @@ +$NetBSD: patch-aa,v 1.17 2006/04/25 15:40:56 drochner Exp $ + +--- epan/dissectors/packet-radiotap.c.orig 2006-04-17 16:46:52.000000000 +0200 ++++ epan/dissectors/packet-radiotap.c +@@ -388,6 +388,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + guint8 db, rflags; + guint32 present, next_present; + int bit; ++ gint8 align; + + if(check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN"); +@@ -465,7 +466,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_RATE: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + rate = tvb_get_guint8(tvb, offset) & 0x7f; + if (check_col(pinfo->cinfo, COL_TX_RATE)) { + col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%d.%d", +@@ -482,7 +482,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_DBM_ANTSIGNAL: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (check_col(pinfo->cinfo, COL_RSSI)) { + col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm); +@@ -499,7 +498,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_DB_ANTSIGNAL: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + db = tvb_get_guint8(tvb, offset); + if (check_col(pinfo->cinfo, COL_RSSI)) { + col_add_fstr(pinfo->cinfo, COL_RSSI, "%u dB", db); +@@ -516,7 +514,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_DBM_ANTNOISE: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_int_format(radiotap_tree, +@@ -530,7 +527,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_DB_ANTNOISE: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + db = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_uint_format(radiotap_tree, +@@ -544,7 +540,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_ANTENNA: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_uint(radiotap_tree, hf_radiotap_antenna, + tvb, offset, 1, tvb_get_guint8(tvb, offset)); +@@ -555,7 +550,6 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_DBM_TX_POWER: + if (length < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_int(radiotap_tree, hf_radiotap_txpower, + tvb, offset, 1, tvb_get_guint8(tvb, offset)); +@@ -564,9 +558,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + length--; + break; + case IEEE80211_RADIOTAP_CHANNEL: ++ align = ((offset + 1) & ~1) - offset; ++ offset += align; ++ length -= align; + if (length < 4) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + freq = tvb_get_letohs(tvb, offset); + flags = tvb_get_letohs(tvb, offset+2); +@@ -583,9 +579,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + case IEEE80211_RADIOTAP_LOCK_QUALITY: + case IEEE80211_RADIOTAP_TX_ATTENUATION: + case IEEE80211_RADIOTAP_DB_TX_ATTENUATION: ++ align = ((offset + 1) & ~1) - offset; ++ offset += align; ++ length -= align; + if (length < 2) + break; +- rflags = tvb_get_guint8(tvb, offset); + #if 0 + tvb_get_letohs(tvb, offset); + #endif +@@ -593,9 +591,13 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + length-=2; + break; + case IEEE80211_RADIOTAP_TSFT: ++#if 0 /* can't happen because always first */ ++ align = ((offset + 7) & ~7) - offset; ++ offset += align; ++ length -= align; ++#endif + if (length < 8) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_uint64(radiotap_tree, hf_radiotap_mactime, + tvb, offset, 8, tvb_get_letoh64(tvb, offset)); +@@ -618,7 +620,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + /* dissect the 802.11 header next */ + call_dissector((rflags & IEEE80211_RADIOTAP_F_DATAPAD) ? + ieee80211_datapad_handle : ieee80211_handle, +- tvb_new_subset(tvb, length, -1, -1), pinfo, tree); ++ tvb_new_subset(tvb, offset + length, -1, -1), pinfo, tree); + } + + void -- cgit v1.2.3