diff options
| -rw-r--r-- | print-sl.c | 6 | ||||
| -rw-r--r-- | print-tcp.c | 8 | ||||
| -rw-r--r-- | tcp.h | 12 |
3 files changed, 10 insertions, 16 deletions
@@ -21,7 +21,7 @@ #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 @@ -193,7 +193,7 @@ sliplink_print(register const u_char *p, register const struct ip *ip, */ 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; @@ -283,7 +283,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip, * '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); } diff --git a/print-tcp.c b/print-tcp.c index e70ffa35..ed6ff343 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -21,7 +21,7 @@ #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 @@ -264,7 +264,7 @@ tcp_print(register const u_char *bp, register u_int length, dport = ntohs(tp->th_dport); - hlen = tp->th_off * 4; + hlen = TH_OFF(tp) * 4; /* * If data present and NFS port used, assume NFS. @@ -320,7 +320,7 @@ tcp_print(register const u_char *bp, register u_int length, 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| @@ -640,7 +640,7 @@ tcp_print(register const u_char *bp, register u_int length, /* * 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); @@ -1,4 +1,4 @@ -/* @(#) $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. @@ -67,14 +67,8 @@ struct tcphdr { 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 |
