forked from osmocom/wireshark
From Jaap Keuter:
- Editcap Mikko Tiihonen filed bug 379 including a patch for editcap. This wasn't picked up so far. I've ported the patch to svn 16820 and included a documentation patch. -packet-ieee80211.c Radek Vokal of RedHat filed a bug found by Vladimir Kondratiev of Intel in the 802.11 dissector. Radek provided a sample capture and Vladimir a oneliner patch. I've ported the patch to svn 16820 and tested it against the provided capture. Works well. -From Kan Sasaki A patch for packet-ospf.c is attached: - Fix the handling of the DN-bit of options field. - Add a new function dissect_ospf_bitfield() to dissect a bitfield such as options, flags. The following functions are merged by using this function. - dissect_ospf_lls_extended_options() - dissect_ospf_dbd() - dissect_ospf_options() - dissect_ospf_v3_prefix_options() - dissect the flags and prefix-options bitfield. - lldp Bugfix Bug 596 LLDP TIA Network Policy Decode is not correct - Camel make it possible to dissect based on OID. svn path=/trunk/; revision=16822
This commit is contained in:
parent
9269a3b4f2
commit
6f23144e46
|
@ -713,9 +713,10 @@ void proto_register_camel(void) {
|
|||
|
||||
proto_register_field_array(proto_camel, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
register_ber_oid_name("0.4.0.0.1.0.50.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmssf-to-gsmscf(50) version2(1)" );
|
||||
register_ber_oid_name("0.4.0.0.1.0.51.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-assist-handoff-gsmssf-to-gsmscf(51) version2(1)" );
|
||||
register_ber_oid_name("0.4.0.0.1.0.52.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmSRF-to-gsmscf(52) version2(1)" );
|
||||
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmssf-to-gsmscf(50) version2(1)" );
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.51.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-assist-handoff-gsmssf-to-gsmscf(51) version2(1)" );
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.52.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmSRF-to-gsmscf(52) version2(1)" );
|
||||
|
||||
/* Register our configuration options, particularly our ssn:s */
|
||||
/* Set default SSNs */
|
||||
|
|
66
editcap.c
66
editcap.c
|
@ -212,8 +212,10 @@ static void usage(void)
|
|||
|
||||
fprintf(stderr, "Usage: editcap [-r] [-h] [-v] [-T <encap type>] [-E <probability>]\n");
|
||||
fprintf(stderr, " [-F <capture type>] [-s <snaplen>] [-t <time adjustment>]\n");
|
||||
fprintf(stderr, " [-c <packets per file>]\n");
|
||||
fprintf(stderr, " <infile> <outfile> [ <record#>[-<record#>] ... ]\n");
|
||||
fprintf(stderr, " where\n");
|
||||
fprintf(stderr, " \t-c <packets per file> If given splits the output to different files\n");
|
||||
fprintf(stderr, " \t-E <probability> specifies the probability (between 0 and 1)\n");
|
||||
fprintf(stderr, " \t that a particular byte will will have an error.\n");
|
||||
fprintf(stderr, " \t-F <capture type> specifies the capture file type to write:\n");
|
||||
|
@ -260,10 +262,13 @@ int main(int argc, char *argv[])
|
|||
const struct wtap_pkthdr *phdr;
|
||||
int err_type;
|
||||
guint8 *buf;
|
||||
int split_packet_count = 0;
|
||||
int written_count = 0;
|
||||
char *filename;
|
||||
|
||||
/* Process the options first */
|
||||
|
||||
while ((opt = getopt(argc, argv, "E:F:hrs:t:T:v")) !=-1) {
|
||||
while ((opt = getopt(argc, argv, "E:F:hrs:c:t:T:v")) !=-1) {
|
||||
|
||||
switch (opt) {
|
||||
|
||||
|
@ -286,6 +291,20 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
split_packet_count = strtol(optarg, &p, 10);
|
||||
if (p == optarg || *p != '\0') {
|
||||
fprintf(stderr, "editcap: \"%s\" isn't a valid packet count\n",
|
||||
optarg);
|
||||
exit(1);
|
||||
}
|
||||
if (split_packet_count <= 0) {
|
||||
fprintf(stderr, "editcap: \"%d\" packet count must be larger than zero\n",
|
||||
split_packet_count);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case '?': /* Bad options if GNU getopt */
|
||||
usage();
|
||||
|
@ -372,11 +391,21 @@ int main(int argc, char *argv[])
|
|||
if (out_frame_type == -2)
|
||||
out_frame_type = wtap_file_encap(wth);
|
||||
|
||||
pdh = wtap_dump_open(argv[optind + 1], out_file_type,
|
||||
if (split_packet_count > 0) {
|
||||
filename = (char *) malloc(strlen(argv[optind+1]) + 20);
|
||||
if (!filename) {
|
||||
exit(5);
|
||||
}
|
||||
sprintf(filename, "%s-%05d", argv[optind+1], 0);
|
||||
} else {
|
||||
filename = argv[optind+1];
|
||||
}
|
||||
|
||||
pdh = wtap_dump_open(filename, out_file_type,
|
||||
out_frame_type, wtap_snapshot_length(wth), FALSE /* compressed */, &err);
|
||||
if (pdh == NULL) {
|
||||
|
||||
fprintf(stderr, "editcap: Can't open or create %s: %s\n", argv[optind+1],
|
||||
fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename,
|
||||
wtap_strerror(err));
|
||||
exit(1);
|
||||
|
||||
|
@ -387,6 +416,31 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (wtap_read(wth, &err, &err_info, &data_offset)) {
|
||||
|
||||
if (split_packet_count > 0 && (written_count % split_packet_count == 0)) {
|
||||
if (!wtap_dump_close(pdh, &err)) {
|
||||
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
|
||||
wtap_strerror(err));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sprintf(filename, "%s-%05d",argv[optind+1], count / split_packet_count);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Continuing writing in file %s\n", filename);
|
||||
}
|
||||
|
||||
pdh = wtap_dump_open(filename, out_file_type,
|
||||
out_frame_type, wtap_snapshot_length(wth), FALSE /* compressed */, &err);
|
||||
if (pdh == NULL) {
|
||||
|
||||
fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename,
|
||||
wtap_strerror(err));
|
||||
exit(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ((!selected(count) && !keep_em) ||
|
||||
(selected(count) && keep_em)) {
|
||||
|
||||
|
@ -486,11 +540,13 @@ int main(int argc, char *argv[])
|
|||
&err)) {
|
||||
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n",
|
||||
argv[optind + 1], wtap_strerror(err));
|
||||
filename, wtap_strerror(err));
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
written_count++;
|
||||
|
||||
}
|
||||
|
||||
count++;
|
||||
|
@ -514,7 +570,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (!wtap_dump_close(pdh, &err)) {
|
||||
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n", argv[optind + 1],
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
|
||||
wtap_strerror(err));
|
||||
exit(1);
|
||||
|
||||
|
|
|
@ -10466,9 +10466,10 @@ void proto_register_camel(void) {
|
|||
|
||||
proto_register_field_array(proto_camel, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
register_ber_oid_name("0.4.0.0.1.0.50.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmssf-to-gsmscf(50) version2(1)" );
|
||||
register_ber_oid_name("0.4.0.0.1.0.51.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-assist-handoff-gsmssf-to-gsmscf(51) version2(1)" );
|
||||
register_ber_oid_name("0.4.0.0.1.0.52.1","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmSRF-to-gsmscf(52) version2(1)" );
|
||||
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmssf-to-gsmscf(50) version2(1)" );
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.51.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-assist-handoff-gsmssf-to-gsmscf(51) version2(1)" );
|
||||
register_ber_oid_dissector_handle("0.4.0.0.1.0.52.1",camel_handle, proto_camel, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network|umts-Network(1) applicationContext(0) cap-gsmSRF-to-gsmscf(52) version2(1)" );
|
||||
|
||||
/* Register our configuration options, particularly our ssn:s */
|
||||
/* Set default SSNs */
|
||||
|
|
|
@ -636,7 +636,7 @@ find_header_length (guint16 fcf)
|
|||
case DATA_FRAME:
|
||||
len = (COOK_ADDR_SELECTOR(fcf) == DATA_ADDR_T4) ? DATA_LONG_HDR_LEN :
|
||||
DATA_SHORT_HDR_LEN;
|
||||
if( IS_DATA_QOS(fcf))
|
||||
if( IS_DATA_QOS(COMPOSE_FRAME_TYPE(fcf)))
|
||||
return len + 2;
|
||||
else
|
||||
return len;
|
||||
|
|
|
@ -1593,32 +1593,24 @@ dissect_media_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint
|
|||
tlvLen--;
|
||||
|
||||
/* Get flags */
|
||||
if (tlvLen < 1)
|
||||
{
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 0, "TLV too short");
|
||||
return;
|
||||
}
|
||||
tempByte = tvb_get_guint8(tvb, tempOffset);
|
||||
|
||||
/* Unknown policy flag */
|
||||
if (tree)
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 1, "%s",
|
||||
decode_boolean_bitfield(tempByte, 0x80, 8,"Policy: Unknown", "Policy: Defined"));
|
||||
|
||||
/* Tagged flag */
|
||||
if (tree)
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 1, "%s",
|
||||
decode_boolean_bitfield(tempByte, 0x40, 8,"Tagged: Yes", "Tagged: No"));
|
||||
tempOffset++;
|
||||
tlvLen--;
|
||||
|
||||
/* Get vlan id */
|
||||
if (tlvLen < 1)
|
||||
if (tlvLen < 2)
|
||||
{
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 0, "TLV too short");
|
||||
return;
|
||||
}
|
||||
tempShort = tvb_get_ntohs(tvb, tempOffset);
|
||||
|
||||
/* Unknown policy flag */
|
||||
if (tree)
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 2, "%s",
|
||||
decode_boolean_bitfield(tempShort, 0x8000, 16,"Policy: Unknown", "Policy: Defined"));
|
||||
|
||||
/* Tagged flag */
|
||||
if (tree)
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 2, "%s",
|
||||
decode_boolean_bitfield(tempShort, 0x4000, 16,"Tagged: Yes", "Tagged: No"));
|
||||
|
||||
/* Get vlan id */
|
||||
tempVLAN = (tempShort & 0x1FFE) >> 1;
|
||||
if (tree)
|
||||
proto_tree_add_text(tree, tvb, tempOffset, 2, "%s %u",
|
||||
|
|
Loading…
Reference in New Issue