Treat 13 as if it came from OpenBSD except on BSD/OS, so that if there

are any BSD/OS users still out there using Wireshark to read RFC 1483
ATM captures from BSD/OS, they can still do so, but all other users get
to read OpenBSD DLT_ENC captures, not just users *on* OpenBSD.

That also lets us simplify some hacks to deal with a link-layer type of
13 on Nokia IPSO captures.

svn path=/trunk/; revision=30159
This commit is contained in:
Guy Harris 2009-09-25 21:55:39 +00:00
parent 3a92e1e456
commit 7be78a2d55
2 changed files with 20 additions and 29 deletions

View File

@ -230,18 +230,8 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
}
}
/*
* We treat a DLT_ value of 13 specially - it appears that in
* Nokia libpcap format, it's some form of ATM with what I
* suspect is a pseudo-header (even though Nokia's IPSO is
* based on FreeBSD, which #defines DLT_SLIP_BSDOS as 13).
*
* We don't yet know whether this is a Nokia capture, so if
* "wtap_pcap_encap_to_wtap_encap()" returned WTAP_ENCAP_UNKNOWN
* but "hdr.network" is 13, we don't treat that as an error yet.
*/
file_encap = wtap_pcap_encap_to_wtap_encap(hdr.network);
if (file_encap == WTAP_ENCAP_UNKNOWN && hdr.network != 13) {
if (file_encap == WTAP_ENCAP_UNKNOWN) {
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
*err_info = g_strdup_printf("pcap: network type %u unknown or unsupported",
hdr.network);
@ -481,22 +471,17 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info)
}
}
if (hdr.network == 13) {
/*
* OK, if this was a Nokia capture, make it
* WTAP_ENCAP_ATM_PDUS, otherwise return
* an error.
*/
if (wth->file_type == WTAP_FILE_PCAP_NOKIA)
wth->file_encap = WTAP_ENCAP_ATM_PDUS;
else {
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
*err_info = g_strdup_printf("pcap: network type %u unknown or unsupported",
hdr.network);
g_free(wth->capture.pcap);
return -1;
}
}
/*
* We treat a DLT_ value of 13 specially - it appears that in
* Nokia libpcap format, it's some form of ATM with what I
* suspect is a pseudo-header (even though Nokia's IPSO is
* based on FreeBSD, which #defines DLT_SLIP_BSDOS as 13).
*
* If this is a Nokia capture, treat 13 as WTAP_ENCAP_ATM_PDUS,
* rather than as what we normally treat it.
*/
if (wth->file_type == WTAP_FILE_PCAP_NOKIA && hdr.network == 13)
wth->file_encap = WTAP_ENCAP_ATM_PDUS;
return 1;
}

View File

@ -443,11 +443,17 @@ static const struct {
* 13 is DLT_ATM_RFC1483 on BSD/OS.
*
* 13 is DLT_ENC in OpenBSD, which is, I suspect, some kind
* of decrypted IPSEC traffic.
* of decrypted IPsec traffic.
*
* We treat 13 as WTAP_ENCAP_ENC on all systems except those
* that define DLT_ATM_RFC1483 as 13 - presumably only
* BSD/OS does so - so that, on BSD/OS systems, we still
* treate 13 as WTAP_ENCAP_ATM_RFC1483, but, on all other
* systems, we can read OpenBSD DLT_ENC captures.
*/
#if defined(DLT_ATM_RFC1483) && (DLT_ATM_RFC1483 == 13)
{ 13, WTAP_ENCAP_ATM_RFC1483 },
#elif defined(DLT_ENC) && (DLT_ENC == 13)
#else
{ 13, WTAP_ENCAP_ENC },
#endif