Just copy over the "sll_protocol" field - if it's not an Ethernet type,
we just treat the frame as an LLC frame (if we care about Novell IPX-over-raw-802.3 frames, we'd have to handle them by checking for 0xFFFF as the first word - but we'd also have to do that when dissecting Ethernet frames).
This commit is contained in:
parent
dba6f764bb
commit
54b14dde63
26
pcap-linux.c
26
pcap-linux.c
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.46 2000-12-22 12:11:36 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.47 2000-12-22 12:24:20 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -410,29 +410,7 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata)
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map special Linux internal protocol types to
|
||||
* LINUX_SLL_P_ values; we want the same numerical
|
||||
* value to be used in the link-layer header even
|
||||
* if the numerical values for the ETH_P_ #defines
|
||||
* change, so that programs that look at the protocol
|
||||
* field will always be able to handle DLT_LINUX_SLL
|
||||
* captures.
|
||||
*/
|
||||
switch (ntohs(from.sll_protocol)) {
|
||||
|
||||
case ETH_P_802_2:
|
||||
hdrp->sll_protocol = ntohs(LINUX_SLL_P_802_2);
|
||||
break;
|
||||
|
||||
case ETH_P_802_3:
|
||||
hdrp->sll_protocol = ntohs(LINUX_SLL_P_802_3);
|
||||
break;
|
||||
|
||||
default:
|
||||
hdrp->sll_protocol = from.sll_protocol;
|
||||
break;
|
||||
}
|
||||
hdrp->sll_protocol = from.sll_protocol;
|
||||
hdrp->sll_hatype = htons(from.sll_hatype);
|
||||
hdrp->sll_halen = htons(from.sll_halen);
|
||||
memcpy(hdrp->sll_addr, from.sll_addr,
|
||||
|
|
11
sll.h
11
sll.h
|
@ -35,7 +35,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/libpcap/Attic/sll.h,v 1.3 2000-12-22 12:14:48 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/Attic/sll.h,v 1.4 2000-12-22 12:24:21 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -87,12 +87,3 @@ struct sll_header {
|
|||
#define LINUX_SLL_MULTICAST 2
|
||||
#define LINUX_SLL_OTHERHOST 3
|
||||
#define LINUX_SLL_OUTGOING 4
|
||||
|
||||
/*
|
||||
* The LINUX_SLL_ values for "sll_protocol"; these correspond to the
|
||||
* ETH_P_ values on Linux, but are defined here so that they're
|
||||
* available even on systems other than Linux, and so that they
|
||||
* don't change even if the ETH_P_ values change.
|
||||
*/
|
||||
#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */
|
||||
#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */
|
||||
|
|
Reference in New Issue