diff options
author | marcus <marcus@FreeBSD.org> | 2006-04-28 19:23:29 +0000 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2006-04-28 19:23:29 +0000 |
commit | 9127147b898c6d34bc6d12bd66328bb9db6a8397 (patch) | |
tree | 1283ed715fc6dc8e3991b2738e4be9c96878571c /net | |
parent | 56be81155c064b5aae52af95bfce0fcf6fe33f33 (diff) | |
download | FreeBSD-ports-9127147b898c6d34bc6d12bd66328bb9db6a8397.zip FreeBSD-ports-9127147b898c6d34bc6d12bd66328bb9db6a8397.tar.gz |
Fix parsing of radiotap packet captures.
Submitted by: sam
Obtained from: Ethereal SVN
Diffstat (limited to 'net')
-rw-r--r-- | net/ethereal/Makefile | 2 | ||||
-rw-r--r-- | net/ethereal/files/patch-epan_dissectors_packet-ieee80211.c | 11 | ||||
-rw-r--r-- | net/ethereal/files/patch-epan_dissectors_packet-radiotap.c | 198 | ||||
-rw-r--r-- | net/wireshark/Makefile | 2 | ||||
-rw-r--r-- | net/wireshark/files/patch-epan_dissectors_packet-ieee80211.c | 11 | ||||
-rw-r--r-- | net/wireshark/files/patch-epan_dissectors_packet-radiotap.c | 198 |
6 files changed, 398 insertions, 24 deletions
diff --git a/net/ethereal/Makefile b/net/ethereal/Makefile index 7db2bb5..7baf7b9 100644 --- a/net/ethereal/Makefile +++ b/net/ethereal/Makefile @@ -7,7 +7,7 @@ PORTNAME= ethereal PORTVERSION= 0.99.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \ ftp://ftp.ethereal.com/pub/ethereal/all-versions/ diff --git a/net/ethereal/files/patch-epan_dissectors_packet-ieee80211.c b/net/ethereal/files/patch-epan_dissectors_packet-ieee80211.c deleted file mode 100644 index af27da5..0000000 --- a/net/ethereal/files/patch-epan_dissectors_packet-ieee80211.c +++ /dev/null @@ -1,11 +0,0 @@ ---- epan/dissectors/packet-ieee80211.c.orig Wed Apr 26 22:19:29 2006 -+++ epan/dissectors/packet-ieee80211.c Wed Apr 26 22:19:58 2006 -@@ -723,7 +723,7 @@ find_header_length (guint16 fcf) - case DATA_FRAME: - len = (FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : - DATA_SHORT_HDR_LEN; -- if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) -+ if (COMPOSE_FRAME_TYPE(fcf) == DATA_QOS_DATA) - return len + 2; - else - return len; diff --git a/net/ethereal/files/patch-epan_dissectors_packet-radiotap.c b/net/ethereal/files/patch-epan_dissectors_packet-radiotap.c new file mode 100644 index 0000000..f66df6c --- /dev/null +++ b/net/ethereal/files/patch-epan_dissectors_packet-radiotap.c @@ -0,0 +1,198 @@ +--- epan/dissectors/packet-radiotap.c.orig Mon Apr 17 14:46:52 2006 ++++ epan/dissectors/packet-radiotap.c Fri Apr 28 19:21:24 2006 +@@ -382,7 +382,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + proto_item *ti = NULL; + int offset; + guint32 version, pad; +- guint32 length; ++ guint length, length_remaining; + guint32 rate, freq, flags; + gint8 dbm; + guint8 db, rflags; +@@ -416,11 +416,13 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + ti = proto_tree_add_uint(radiotap_tree, hf_radiotap_length, + tvb, offset + 2, 2, length); + } ++ length_remaining = length; ++ + /* + * FIXME: This only works if there is exactly 1 it_present + * field in the header + */ +- if (length < sizeof(struct ieee80211_radiotap_header)) { ++ if (length_remaining < sizeof(struct ieee80211_radiotap_header)) { + /* + * Radiotap header is shorter than the fixed-length portion + * plus one "present" bitset. +@@ -435,7 +437,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + present_tree = proto_item_add_subtree(pt, ett_radiotap_present); + } + offset += sizeof(struct ieee80211_radiotap_header); +- length -= sizeof(struct ieee80211_radiotap_header); ++ length_remaining -= sizeof(struct ieee80211_radiotap_header); + + rflags = 0; + for (; present; present = next_present) { +@@ -447,7 +449,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + + switch (bit) { + case IEEE80211_RADIOTAP_FLAGS: +- if (length < 1) ++ if (length_remaining < 1) + break; + rflags = tvb_get_guint8(tvb, offset); + if (tree) { +@@ -459,13 +461,12 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + tvb, 0, 0, (rflags&IEEE80211_RADIOTAP_F_DATAPAD) != 0); + } + offset++; +- length--; ++ length_remaining--; + /* XXX CFP, WEP, FRAG */ + break; + case IEEE80211_RADIOTAP_RATE: +- if (length < 1) ++ if (length_remaining < 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", +@@ -477,12 +478,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "Data Rate: %d.%d Mb/s", rate / 2, rate & 1 ? 5 : 0); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_ANTSIGNAL: +- if (length < 1) ++ if (length_remaining < 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); +@@ -494,12 +494,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Signal: %d dBm", dbm); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DB_ANTSIGNAL: +- if (length < 1) ++ if (length_remaining < 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); +@@ -511,12 +510,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Signal: %u dB", db); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_ANTNOISE: +- if (length < 1) ++ if (length_remaining < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_int_format(radiotap_tree, +@@ -525,12 +523,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Noise: %d dBm", dbm); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DB_ANTNOISE: +- if (length < 1) ++ if (length_remaining < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + db = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_uint_format(radiotap_tree, +@@ -539,34 +536,31 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Noise: %u dB", db); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_ANTENNA: +- if (length < 1) ++ if (length_remaining < 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)); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_TX_POWER: +- if (length < 1) ++ if (length_remaining < 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)); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_CHANNEL: +- if (length < 4) ++ if (length_remaining < 4) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + freq = tvb_get_letohs(tvb, offset); + flags = tvb_get_letohs(tvb, offset+2); +@@ -577,31 +571,29 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + tvb, offset+2, 2, flags); + } + offset+=4; +- length-=4; ++ length_remaining-=4; + break; + case IEEE80211_RADIOTAP_FHSS: + case IEEE80211_RADIOTAP_LOCK_QUALITY: + case IEEE80211_RADIOTAP_TX_ATTENUATION: + case IEEE80211_RADIOTAP_DB_TX_ATTENUATION: +- if (length < 2) ++ if (length_remaining < 2) + break; +- rflags = tvb_get_guint8(tvb, offset); + #if 0 + tvb_get_letohs(tvb, offset); + #endif + offset+=2; +- length-=2; ++ length_remaining-=2; + break; + case IEEE80211_RADIOTAP_TSFT: +- if (length < 8) ++ if (length_remaining < 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)); + } + offset+=8; +- length-=8; ++ length_remaining-=8; + break; + default: + /* diff --git a/net/wireshark/Makefile b/net/wireshark/Makefile index 7db2bb5..7baf7b9 100644 --- a/net/wireshark/Makefile +++ b/net/wireshark/Makefile @@ -7,7 +7,7 @@ PORTNAME= ethereal PORTVERSION= 0.99.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \ ftp://ftp.ethereal.com/pub/ethereal/all-versions/ diff --git a/net/wireshark/files/patch-epan_dissectors_packet-ieee80211.c b/net/wireshark/files/patch-epan_dissectors_packet-ieee80211.c deleted file mode 100644 index af27da5..0000000 --- a/net/wireshark/files/patch-epan_dissectors_packet-ieee80211.c +++ /dev/null @@ -1,11 +0,0 @@ ---- epan/dissectors/packet-ieee80211.c.orig Wed Apr 26 22:19:29 2006 -+++ epan/dissectors/packet-ieee80211.c Wed Apr 26 22:19:58 2006 -@@ -723,7 +723,7 @@ find_header_length (guint16 fcf) - case DATA_FRAME: - len = (FCF_ADDR_SELECTOR(fcf) == DATA_ADDR_T4) ? DATA_LONG_HDR_LEN : - DATA_SHORT_HDR_LEN; -- if (DATA_FRAME_IS_QOS(COMPOSE_FRAME_TYPE(fcf))) -+ if (COMPOSE_FRAME_TYPE(fcf) == DATA_QOS_DATA) - return len + 2; - else - return len; diff --git a/net/wireshark/files/patch-epan_dissectors_packet-radiotap.c b/net/wireshark/files/patch-epan_dissectors_packet-radiotap.c new file mode 100644 index 0000000..f66df6c --- /dev/null +++ b/net/wireshark/files/patch-epan_dissectors_packet-radiotap.c @@ -0,0 +1,198 @@ +--- epan/dissectors/packet-radiotap.c.orig Mon Apr 17 14:46:52 2006 ++++ epan/dissectors/packet-radiotap.c Fri Apr 28 19:21:24 2006 +@@ -382,7 +382,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + proto_item *ti = NULL; + int offset; + guint32 version, pad; +- guint32 length; ++ guint length, length_remaining; + guint32 rate, freq, flags; + gint8 dbm; + guint8 db, rflags; +@@ -416,11 +416,13 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + ti = proto_tree_add_uint(radiotap_tree, hf_radiotap_length, + tvb, offset + 2, 2, length); + } ++ length_remaining = length; ++ + /* + * FIXME: This only works if there is exactly 1 it_present + * field in the header + */ +- if (length < sizeof(struct ieee80211_radiotap_header)) { ++ if (length_remaining < sizeof(struct ieee80211_radiotap_header)) { + /* + * Radiotap header is shorter than the fixed-length portion + * plus one "present" bitset. +@@ -435,7 +437,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + present_tree = proto_item_add_subtree(pt, ett_radiotap_present); + } + offset += sizeof(struct ieee80211_radiotap_header); +- length -= sizeof(struct ieee80211_radiotap_header); ++ length_remaining -= sizeof(struct ieee80211_radiotap_header); + + rflags = 0; + for (; present; present = next_present) { +@@ -447,7 +449,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + + switch (bit) { + case IEEE80211_RADIOTAP_FLAGS: +- if (length < 1) ++ if (length_remaining < 1) + break; + rflags = tvb_get_guint8(tvb, offset); + if (tree) { +@@ -459,13 +461,12 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + tvb, 0, 0, (rflags&IEEE80211_RADIOTAP_F_DATAPAD) != 0); + } + offset++; +- length--; ++ length_remaining--; + /* XXX CFP, WEP, FRAG */ + break; + case IEEE80211_RADIOTAP_RATE: +- if (length < 1) ++ if (length_remaining < 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", +@@ -477,12 +478,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "Data Rate: %d.%d Mb/s", rate / 2, rate & 1 ? 5 : 0); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_ANTSIGNAL: +- if (length < 1) ++ if (length_remaining < 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); +@@ -494,12 +494,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Signal: %d dBm", dbm); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DB_ANTSIGNAL: +- if (length < 1) ++ if (length_remaining < 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); +@@ -511,12 +510,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Signal: %u dB", db); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_ANTNOISE: +- if (length < 1) ++ if (length_remaining < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + dbm = (gint8) tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_int_format(radiotap_tree, +@@ -525,12 +523,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Noise: %d dBm", dbm); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DB_ANTNOISE: +- if (length < 1) ++ if (length_remaining < 1) + break; +- rflags = tvb_get_guint8(tvb, offset); + db = tvb_get_guint8(tvb, offset); + if (tree) { + proto_tree_add_uint_format(radiotap_tree, +@@ -539,34 +536,31 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + "SSI Noise: %u dB", db); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_ANTENNA: +- if (length < 1) ++ if (length_remaining < 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)); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_DBM_TX_POWER: +- if (length < 1) ++ if (length_remaining < 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)); + } + offset++; +- length--; ++ length_remaining--; + break; + case IEEE80211_RADIOTAP_CHANNEL: +- if (length < 4) ++ if (length_remaining < 4) + break; +- rflags = tvb_get_guint8(tvb, offset); + if (tree) { + freq = tvb_get_letohs(tvb, offset); + flags = tvb_get_letohs(tvb, offset+2); +@@ -577,31 +571,29 @@ dissect_radiotap(tvbuff_t *tvb, packet_i + tvb, offset+2, 2, flags); + } + offset+=4; +- length-=4; ++ length_remaining-=4; + break; + case IEEE80211_RADIOTAP_FHSS: + case IEEE80211_RADIOTAP_LOCK_QUALITY: + case IEEE80211_RADIOTAP_TX_ATTENUATION: + case IEEE80211_RADIOTAP_DB_TX_ATTENUATION: +- if (length < 2) ++ if (length_remaining < 2) + break; +- rflags = tvb_get_guint8(tvb, offset); + #if 0 + tvb_get_letohs(tvb, offset); + #endif + offset+=2; +- length-=2; ++ length_remaining-=2; + break; + case IEEE80211_RADIOTAP_TSFT: +- if (length < 8) ++ if (length_remaining < 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)); + } + offset+=8; +- length-=8; ++ length_remaining-=8; + break; + default: + /* |