Skip to content

Commit 53cb8a6

Browse files
committed
Fix AppNeta Extended Headers on ICMP/ICMPv6 packets
1 parent 23581f7 commit 53cb8a6

File tree

4 files changed

+95
-90
lines changed

4 files changed

+95
-90
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ set(PROJECT_MAJOR_VERSION 4)
5353
set(PROJECT_MINOR_VERSION 6)
5454
set(PROJECT_PATCH_VERSION 2)
5555
set(PROJECT_BUILD_VERSION ${GIT_REVISION})
56-
set(PROJECT_VERSION_EXTENSION ".appneta.67")
56+
set(PROJECT_VERSION_EXTENSION ".appneta.68")
5757

5858
if(DEFINED ENV{WIRESHARK_VERSION_EXTRA})
5959
set(PROJECT_VERSION_EXTENSION "$ENV{WIRESHARK_VERSION_EXTRA}")

README.appneta.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,26 @@ Build
124124

125125
```shell
126126
pushd run
127-
hdiutil convert Wireshark\ 4.6.2.appneta.67\ Arm\ 64.dmg -format UDRW -o Wireshark\ 4.6.2.appneta.67\ Arm\ 64-rw.dmg
128-
hdiutil resize -size 500M Wireshark\ 4.6.2.appneta.67\ Arm\ 64-rw.dmg
129-
hdiutil attach Wireshark\ 4.6.2.appneta.67\ Arm\ 64-rw.dmg
130-
rm -rf /Volumes/Wireshark\ 4.6.2.appneta.67/Wireshark.app
131-
tar xvf Wireshark.app.tar.xz -C /Volumes/Wireshark\ 4.6.2.appneta.67
127+
hdiutil convert Wireshark\ 4.6.2.appneta.68\ Arm\ 64.dmg -format UDRW -o Wireshark\ 4.6.2.appneta.68\ Arm\ 64-rw.dmg
128+
hdiutil resize -size 500M Wireshark\ 4.6.2.appneta.68\ Arm\ 64-rw.dmg
129+
hdiutil attach Wireshark\ 4.6.2.appneta.68\ Arm\ 64-rw.dmg
130+
rm -rf /Volumes/Wireshark\ 4.6.2.appneta.68/Wireshark.app
131+
tar xvf Wireshark.app.tar.xz -C /Volumes/Wireshark\ 4.6.2.appneta.68
132132
```
133133

134134
* At this point you will use Finder to unmount the `.dmg` bundle
135135
* Now convert R/W bundle to R/O
136136

137137
```shell
138-
hdiutil convert Wireshark\ 4.6.2.appneta.67\ Arm\ 64-rw.dmg -format UDRO -o ~/data/Wireshark\ 4.6.2.appneta.67\ Arm\ 64.dmg
138+
hdiutil convert Wireshark\ 4.6.2.appneta.68\ Arm\ 64-rw.dmg -format UDRO -o ~/data/Wireshark\ 4.6.2.appneta.68\ Arm\ 64.dmg
139139
popd
140140
```
141141

142142
* Code sign the new bundle
143143

144144
```shell
145145
codesign --sign "Apple Development: Fred Klassen (VRZWY3PKS3)" --prefix "org.broadcom.appneta" \
146-
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose -f ~/data/Wireshark\ 4.6.2.appneta.67\ Arm\ 64.dmg
146+
--entitlements ../packaging/macosx/entitlements.plist --timestamp --verbose -f ~/data/Wireshark\ 4.6.2.appneta.68\ Arm\ 64.dmg
147147
```
148148

149149
* Test the new installer program
@@ -232,15 +232,15 @@ Build packages (from wireshark directory)
232232
export DH_QUIET=1
233233
export MAKEFLAGS=--silent
234234
dpkg-buildpackage -b -us -uc -jauto
235-
WS_VERSION=4.6.2.appneta.67 # << update this
235+
WS_VERSION=4.6.2.appneta.68 # << update this
236236
sudo mkdir -p /root/wireshark-${WS_VERSION}_repo
237237
sudo mv ../*.deb ../*.buildinfo ../*.changes \
238238
/root/wireshark-${WS_VERSION}_repo
239239

240240
Once packages are made:
241241

242242
sudo -i
243-
WS_VERSION=4.6.2.appneta.67
243+
WS_VERSION=4.6.2.appneta.68
244244
cd /root/wireshark-${WS_VERSION}_repo
245245
apt-ftparchive packages . > Packages
246246
cd ..
@@ -261,7 +261,7 @@ Verify that the correct version of wireshark will be installed
261261

262262
apt show wireshark 2> /dev/null | head -n2
263263
Package: wireshark
264-
Version: 4.6.2.appneta.67
264+
Version: 4.6.2.appneta.68
265265

266266
Do the install
267267

epan/dissectors/packet-appneta.c

Lines changed: 83 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -636,45 +636,32 @@ add_subtree(tvbuff_t *tvb, int *offset, proto_tree *current_tree,
636636
* the header; otherwise add items to the dissector tree.
637637
*/
638638
static int
639-
dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_resp_tree, void *data)
639+
dissect_responder_headers_parse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_resp_tree, int offset, int currentHeader, appneta_pkt_type_t appneta_pkt_type)
640640
{
641-
int currentHeader, nextHeader;
642-
uint8_t headerLength = 0, mode = 0;
643-
uint8_t flags = 0;
644-
int offset = 0;
645-
uint32_t id, flow, major, minor, revision, build, first_id = 0,
646-
burst_hold_time, i, depth;
647-
uint32_t cb_in_count = 0,
648-
cb_in_gap = 0,
649-
cb_out_count = 0,
650-
cb_out_gap = 0,
651-
cb_in_flags = 0;
652-
uint16_t port, portend, weight, burstsize = 0;
653-
proto_tree *current_tree = NULL, *field_tree = NULL;
654-
proto_item *tf = NULL;
655-
tvbuff_t *next_tvb;
656-
gboolean save_in_error_pkt;
657-
int remaining = tvb_captured_length_remaining(tvb, 0);
658-
appneta_pkt_type_t appneta_pkt_type = APPNETA_PACKET_TYPE_UNDEFINED;
659-
uint32_t pass = 0;
660-
661-
if (data && strcmp((const char *)data, "ani-payload") == 0) {
662-
currentHeader = HDR_SIGNATURE;
663-
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH;
664-
} else if (data && strcmp((const char *)data, "ani-reply-payload") == 0) {
665-
currentHeader = HDR_SIGNATURE;
666-
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH_REPLY;
667-
} else {
668-
currentHeader = HDR_SEQUENCE;
669-
}
641+
int remaining = tvb_captured_length_remaining(tvb, 0);
642+
uint32_t pass = 0;
670643

671644
while (currentHeader != HDR_LAST && currentHeader < HDR_INVALID) {
672-
current_tree = appneta_resp_tree;
673-
nextHeader = tvb_get_uint8(tvb, offset);
674-
headerLength = tvb_get_uint8(tvb, offset + 1);
645+
proto_tree *current_tree = appneta_resp_tree;
646+
int nextHeader = tvb_get_uint8(tvb, offset);
647+
int headerLength = tvb_get_uint8(tvb, offset + 1);
648+
uint8_t mode = 0;
649+
uint8_t flags = 0;
650+
uint32_t id, flow, major, minor, revision, build, first_id = 0,
651+
burst_hold_time, i, depth;
652+
uint32_t cb_in_count = 0,
653+
cb_in_gap = 0,
654+
cb_out_count = 0,
655+
cb_out_gap = 0,
656+
cb_in_flags = 0;
657+
uint16_t port, portend, weight, burst_size = 0;
658+
proto_tree *field_tree = NULL;
659+
proto_item *tf = NULL;
660+
tvbuff_t *next_tvb;
661+
bool save_in_error_pkt;
675662

676663
if (offset > remaining || pass++ > 50) {
677-
g_print("dissect_responder_header: opps: offset=%d remaining=%d pass=%d\n",
664+
g_print("dissect_responder_headers_parse: opps: offset=%d remaining=%d pass=%d\n",
678665
offset, remaining, pass);
679666
return 0;
680667
}
@@ -816,7 +803,7 @@ dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_
816803
current_tree = add_subtree(tvb, &offset, current_tree, currentHeader, headerLength,
817804
"Command Info Header");
818805
first_id = tvb_get_ntohl(tvb, offset);
819-
burstsize = tvb_get_ntohs(tvb, offset + 4);
806+
burst_size = tvb_get_ntohs(tvb, offset + 4);
820807
proto_tree_add_item(current_tree, hf_appneta_resp_first_id, tvb, offset, 4, ENC_NA);
821808
proto_tree_add_item(current_tree, hf_appneta_resp_burst_size, tvb, offset + 4, 2, ENC_NA);
822809
if (headerLength > 8) {
@@ -861,7 +848,7 @@ dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_
861848
} else if (mode == 0x85) {
862849
col_append_fstr(pinfo->cinfo, COL_INFO, " Burst Load (Primer)");
863850
}
864-
col_append_fstr(pinfo->cinfo, COL_INFO, " First ID=%d Packets=%d", first_id, burstsize);
851+
col_append_fstr(pinfo->cinfo, COL_INFO, " First ID=%d Packets=%d", first_id, burst_size);
865852
break;
866853
case HDR_OUTBOUNDARRIVAL:
867854
current_tree = add_subtree(tvb, &offset, current_tree, currentHeader, headerLength,
@@ -946,8 +933,8 @@ dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_
946933
"Inbound Packet Attributes");
947934
proto_tree_add_item(current_tree, hf_appneta_resp_inboundpacketcount, tvb, offset, 2, ENC_NA);
948935
proto_tree_add_item(current_tree, hf_appneta_resp_inboundpacketsize, tvb, offset + 2, 2, ENC_NA);
949-
burstsize = tvb_get_ntohs(tvb, offset);
950-
col_append_fstr(pinfo->cinfo, COL_INFO, "/%d (out/in)", burstsize);
936+
burst_size = tvb_get_ntohs(tvb, offset);
937+
col_append_fstr(pinfo->cinfo, COL_INFO, "/%d (out/in)", burst_size);
951938
break;
952939
case HDR_H323PORT:
953940
current_tree = add_subtree(tvb, &offset, current_tree, currentHeader, headerLength,
@@ -1231,15 +1218,34 @@ dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_
12311218
return offset;
12321219
}
12331220

1221+
static int
1222+
dissect_responder_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *appneta_resp_tree, void *data)
1223+
{
1224+
appneta_pkt_type_t appneta_pkt_type = APPNETA_PACKET_TYPE_UNDEFINED;
1225+
int currentHeader;
1226+
1227+
if (data && strcmp((const char *)data, "ani-payload") == 0) {
1228+
currentHeader = HDR_SIGNATURE;
1229+
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH;
1230+
} else if (data && strcmp((const char *)data, "ani-reply-payload") == 0) {
1231+
currentHeader = HDR_SIGNATURE;
1232+
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH_REPLY;
1233+
} else {
1234+
currentHeader = HDR_SEQUENCE;
1235+
}
1236+
1237+
return dissect_responder_headers_parse(tvb, pinfo, appneta_resp_tree, 0, currentHeader, appneta_pkt_type);
1238+
}
1239+
12341240
/*******************************************************************
12351241
* Code to dissect the packets targeting a Responder
12361242
*/
12371243
static int
12381244
dissect_appneta_responder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
12391245
{
1240-
unsigned int offset = 0;
1241-
proto_item *ti = NULL;
1242-
proto_tree *appneta_resp_tree = NULL;
1246+
uint32_t offset = 0;
1247+
proto_item *ti = NULL;
1248+
proto_tree *appneta_resp_tree = NULL;
12431249

12441250
/* determine how many bytes of the packet will be processed */
12451251
offset = dissect_rtp_header(tvb, pinfo, offset, NULL, TRUE);
@@ -1248,9 +1254,6 @@ dissect_appneta_responder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
12481254
if (!offset || tvb_captured_length(tvb) < offset)
12491255
return 0;
12501256

1251-
/* Make entry in Protocol column */
1252-
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AppNetaResponder");
1253-
12541257
/* Indicate the number of bytes that will be processed */
12551258
ti = proto_tree_add_item(tree, proto_appneta_resp, tvb, 0, offset, ENC_NA);
12561259

@@ -1268,6 +1271,9 @@ dissect_appneta_responder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
12681271
if (!offset)
12691272
return 0;
12701273

1274+
/* Make entry in Protocol column */
1275+
col_append_sep_fstr(pinfo->cinfo, COL_PROTOCOL, NULL, "AppNetaResp");
1276+
12711277
return call_dissector(appneta_payload_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree);
12721278
}
12731279

@@ -1339,16 +1345,16 @@ dissect_appneta_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
13391345
} else if (bytes >= path_payload_min_size &&
13401346
(!memcmp(cp, APPNETA_PAYLOAD_SIGNATURE, sizeof(APPNETA_PAYLOAD_SIGNATURE)) || !memcmp(cp, APPNETA_REPLY_PAYLOAD_SIGNATURE, sizeof(APPNETA_REPLY_PAYLOAD_SIGNATURE)))) {
13411347
/* path packet */
1342-
uint32_t iht_value = 0;
1343-
const char *reply_str;
1344-
char *type_str;
1348+
uint32_t iht_value = 0;
1349+
const char *reply_str;
1350+
appneta_pkt_type_t appneta_pkt_type;
13451351

13461352
if (!memcmp(cp, APPNETA_REPLY_PAYLOAD_SIGNATURE, sizeof(APPNETA_REPLY_PAYLOAD_SIGNATURE))) {
1347-
reply_str = "Reply ";
1348-
type_str = "appneta-reply-payload";
1353+
reply_str = "Reply ";
1354+
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH_REPLY;
13491355
} else {
1350-
reply_str = "";
1351-
type_str = "appneta-payload";
1356+
reply_str = "";
1357+
appneta_pkt_type = APPNETA_PACKET_TYPE_PATH;
13521358
}
13531359

13541360
offset = sizeof(APPNETA_PAYLOAD_SIGNATURE);
@@ -1407,38 +1413,37 @@ dissect_appneta_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
14071413

14081414
if (ext) {
14091415
/* Extended headers*/
1416+
// proto_tree *appneta_resp_tree = NULL;
1417+
14101418
++offset;
1411-
col_append_fstr(pinfo->cinfo, COL_INFO, " Extended %spayload", reply_str);
1412-
if (!appneta_responder_handle)
1413-
appneta_responder_handle = find_dissector("appneta_responder");
1419+
if (bytes >= ecb_payload_min_size && tvb_captured_length_remaining(tvb, offset) > 0) {
1420+
int currentHeader = tvb_get_uint8(tvb, offset);
1421+
/* Get a pointer to our subtree */
1422+
// appneta_resp_tree = proto_item_add_subtree(ti, ett_appneta_resp);
1423+
offset = dissect_responder_headers_parse(tvb, pinfo, data_tree, offset, currentHeader, appneta_pkt_type);
1424+
if (!offset)
1425+
return 0;
1426+
}
1427+
} else {
1428+
/* Path */
1429+
proto_tree_add_uint(data_tree, hf_payload_path_burst_length, tvb, offset, 3, burst_length);
1430+
proto_item_append_text(ti, " (%u bytes)", burst_length);
14141431

1415-
if (appneta_responder_handle && bytes >= ecb_payload_min_size &&
1416-
tvb_captured_length_remaining(tvb, offset) > 0)
1417-
call_dissector_with_data(appneta_responder_handle,
1418-
tvb_new_subset_remaining(tvb, offset),
1419-
pinfo, data_tree, type_str);
1432+
if (iht) {
1433+
proto_tree_add_uint(data_tree, hf_payload_path_iht_value, tvb, offset + 3, 4, iht_value);
1434+
proto_item_append_text(ti, " (iht=%u nsec)", iht_value);
1435+
offset += 4;
1436+
}
14201437

1421-
return tvb_captured_length(tvb);
1422-
}
1438+
col_append_fstr(pinfo->cinfo, COL_INFO, " Path %spayload:", reply_str);
1439+
col_append_fstr(pinfo->cinfo, COL_INFO, " first=%u last=%u", first, last);
14231440

1424-
/* Path */
1425-
proto_tree_add_uint(data_tree, hf_payload_path_burst_length, tvb, offset, 3, burst_length);
1426-
proto_item_append_text(ti, " (%u bytes)", burst_length);
1441+
if (iht)
1442+
col_append_fstr(pinfo->cinfo, COL_INFO, " iht=%u nsec", iht_value);
14271443

1428-
if (iht) {
1429-
proto_tree_add_uint(data_tree, hf_payload_path_iht_value, tvb, offset + 3, 4, iht_value);
1430-
proto_item_append_text(ti, " (iht=%u nsec)", iht_value);
1431-
offset += 4;
1444+
col_append_fstr(pinfo->cinfo, COL_INFO, " burst=%u", burst_length);
1445+
offset += sizeof(uint32_t) - 1;
14321446
}
1433-
1434-
col_append_fstr(pinfo->cinfo, COL_INFO, " Path %spayload:", reply_str);
1435-
col_append_fstr(pinfo->cinfo, COL_INFO, " first=%u last=%u", first, last);
1436-
1437-
if (iht)
1438-
col_append_fstr(pinfo->cinfo, COL_INFO, " iht=%u nsec", iht_value);
1439-
1440-
col_append_fstr(pinfo->cinfo, COL_INFO, " burst=%u", burst_length);
1441-
offset += sizeof(uint32_t) - 1;
14421447
} else {
14431448
return 0;
14441449
}
@@ -1713,7 +1718,7 @@ register_appneta_responder(void)
17131718

17141719
/* Register the protocol name and description */
17151720
proto_appneta_resp = proto_register_protocol("AppNeta Responder",
1716-
"AppNetaResponder", "appneta_resp");
1721+
"AppNetaResp", "appneta_resp");
17171722

17181723
/* Required function calls to register the header fields and subtrees used */
17191724
proto_register_field_array(proto_appneta_resp, hf, array_length(hf));

packaging/debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
wireshark (4.6.2.appneta.67) UNRELEASED; urgency=low
1+
wireshark (4.6.2.appneta.68) UNRELEASED; urgency=low
22

33
* Self-made package
44

0 commit comments

Comments
 (0)