It's a bit more convenient for Ethereal if the "sll_protocol" field is
at the end of the link-layer header; put it there. Put in a comment indicating that the layout of the link-layer header shouldn't be changed; if a new header is necessary, a new DLL_ type should be introduced for it.
This commit is contained in:
parent
5d92f34251
commit
7574015989
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.49 2000-12-23 03:04:06 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.50 2000-12-23 07:50:18 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -410,13 +410,13 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata)
|
|||
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,
|
||||
(from.sll_halen > SLL_ADDRLEN) ?
|
||||
SLL_ADDRLEN :
|
||||
from.sll_halen);
|
||||
hdrp->sll_protocol = from.sll_protocol;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
15
sll.h
15
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.5 2000-12-22 22:34:16 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/libpcap/Attic/sll.h,v 1.6 2000-12-23 07:50:19 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -60,6 +60,17 @@
|
|||
* specified by the previous value.
|
||||
*
|
||||
* All fields except for the link-layer address are in network byte order.
|
||||
*
|
||||
* DO NOT change the layout of this structure, or change any of the
|
||||
* LINUX_SLL_ values below. If you must change the link-layer header
|
||||
* for a "cooked" Linux capture, introduce a new DLT_ type (ask
|
||||
* "tcpdump-workers@tcpdump.org" for one, so that you don't give it a
|
||||
* value that collides with a value already being used), and use the
|
||||
* new header in captures of that type, so that programs that can
|
||||
* handle DLT_LINUX_SLL captures will continue to handle them correctly
|
||||
* without any change, and so that capture files with different headers
|
||||
* can be told apart and programs that read them can dissect the
|
||||
* packets in them.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -70,10 +81,10 @@
|
|||
|
||||
struct sll_header {
|
||||
u_int16_t sll_pkttype; /* packet type */
|
||||
u_int16_t sll_protocol; /* protocol */
|
||||
u_int16_t sll_hatype; /* link-layer address type */
|
||||
u_int16_t sll_halen; /* link-layer address length */
|
||||
u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */
|
||||
u_int16_t sll_protocol; /* protocol */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Reference in New Issue