#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.52 2000-09-29 04:58:50 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.53 2000-10-03 02:26:53 itojun Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
*/
lastconn = ((struct ip *)&p[SLX_CHDR])->ip_p;
hlen = ip->ip_hl;
- hlen += ((struct tcphdr *)&((int *)ip)[hlen])->th_off;
+ hlen += TH_OFF((struct tcphdr *)&((int *)ip)[hlen]);
lastlen[dir][lastconn] = length - (hlen << 2);
printf("utcp %d: ", lastconn);
break;
* 'length - hlen' is the amount of data in the packet.
*/
hlen = ip->ip_hl;
- hlen += ((struct tcphdr *)&((int32_t *)ip)[hlen])->th_off;
+ hlen += TH_OFF((struct tcphdr *)&((int32_t *)ip)[hlen]);
lastlen[dir][lastconn] = length - (hlen << 2);
printf(" %d (%d)", lastlen[dir][lastconn], cp - chdr);
}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.76 2000-09-30 03:35:56 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.77 2000-10-03 02:26:53 itojun Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
dport = ntohs(tp->th_dport);
- hlen = tp->th_off * 4;
+ hlen = TH_OFF(tp) * 4;
/*
* If data present and NFS port used, assume NFS.
urp = ntohs(tp->th_urp);
if (qflag) {
- (void)printf("tcp %d", length - tp->th_off * 4);
+ (void)printf("tcp %d", length - TH_OFF(tp) * 4);
return;
}
if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH|
/*
* Decode payload if necessary.
*/
- bp += (tp->th_off * 4);
+ bp += TH_OFF(tp) * 4;
if (flags & TH_RST) {
if (vflag)
print_tcp_rst_data(bp, length);
-/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.3 2000-09-29 05:05:48 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.4 2000-10-03 02:26:53 itojun Exp $ (LBL) */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
u_short th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int th_x2:4, /* (unused) */
- th_off:4; /* data offset */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int th_off:4, /* data offset */
- th_x2:4; /* (unused) */
-#endif
+ u_char th_x2off;
+#define TH_OFF(th) ((th)->th_x2off & 0x0f) /* data offset, th_off */
u_char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02