summaryrefslogtreecommitdiff
path: root/net/ethereal/patches/patch-aa
blob: daf1977ef29a408b835ac6321d422edb12643bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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