]> The Tcpdump Group git mirrors - tcpdump/commitdiff
corrected bitfield fix (careless char -> int rewrite broke struct for
authoritojun <itojun>
Fri, 28 Apr 2000 11:01:49 +0000 (11:01 +0000)
committeritojun <itojun>
Fri, 28 Apr 2000 11:01:49 +0000 (11:01 +0000)
protocol header).

igrp.h
print-igrp.c

diff --git a/igrp.h b/igrp.h
index 1d84b543912919c7b2227201a8198610d3079626..e05429842d8befd3c14abf445a424dac2a5a543d 100644 (file)
--- a/igrp.h
+++ b/igrp.h
@@ -3,19 +3,15 @@
 /* IGRP Header */
 
 struct igrphdr {
-#ifdef WORDS_BIGENDIAN
-       u_int ig_v:4;           /* protocol version number */
-       u_int ig_op:4;          /* opcode */
-#else
-       u_int ig_op:4;          /* opcode */
-       u_int ig_v:4;           /* protocol version number */
-#endif
-       u_char ig_ed;           /* edition number */
-       u_short ig_as;          /* autonomous system number */
-       u_short ig_ni;          /* number of subnet in local net */
-       u_short ig_ns;          /* number of networks in AS */
-       u_short ig_nx;          /* number of networks ouside AS */
-       u_short ig_sum;         /* checksum of IGRP header & data */
+       u_int8_t ig_vop;        /* protocol version number / opcode */
+#define IGRP_V(x)      (((x) & 0xf0) >> 4)
+#define IGRP_OP(x)     ((x) & 0x0f)
+       u_int8_t ig_ed;         /* edition number */
+       u_int16_t ig_as;        /* autonomous system number */
+       u_int16_t ig_ni;        /* number of subnet in local net */
+       u_int16_t ig_ns;        /* number of networks in AS */
+       u_int16_t ig_nx;        /* number of networks ouside AS */
+       u_int16_t ig_sum;       /* checksum of IGRP header & data */
 };
 
 #define IGRP_UPDATE    1
@@ -24,13 +20,13 @@ struct igrphdr {
 /* IGRP routing entry */
 
 struct igrprte {
-       u_char igr_net[3];      /* 3 significant octets of IP address */
-       u_char igr_dly[3];      /* delay in tens of microseconds */
-       u_char igr_bw[3];       /* bandwidth in units of 1 kb/s */
-       u_char igr_mtu[2];      /* MTU in octets */
-       u_char igr_rel;         /* percent packets successfully tx/rx */
-       u_char igr_ld;          /* percent of channel occupied */
-       u_char igr_hct;         /* hop count */
+       u_int8_t igr_net[3];    /* 3 significant octets of IP address */
+       u_int8_t igr_dly[3];    /* delay in tens of microseconds */
+       u_int8_t igr_bw[3];     /* bandwidth in units of 1 kb/s */
+       u_int8_t igr_mtu[2];    /* MTU in octets */
+       u_int8_t igr_rel;       /* percent packets successfully tx/rx */
+       u_int8_t igr_ld;        /* percent of channel occupied */
+       u_int8_t igr_hct;       /* hop count */
 };
 
 #define IGRP_RTE_SIZE  14      /* don't believe sizeof ! */
index 4232d7b899286266d2b06539f47ab5ccde45b3f1..b2cdb2141df6bedb954700152db0156ef5c4afe4 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.11 1999-11-21 09:36:53 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.12 2000-04-28 11:01:49 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -107,8 +107,8 @@ igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
        next = EXTRACT_16BITS(&hdr->ig_nx);
 
        (void)printf(" %s V%d edit=%d AS=%d (%d/%d/%d)",
-           tok2str(op2str, "op-#%d", hdr->ig_op),
-           hdr->ig_v,
+           tok2str(op2str, "op-#%d", IGRP_OP(hdr->ig_vop)),
+           IGRP_V(hdr->ig_vop),
            hdr->ig_ed,
            EXTRACT_16BITS(&hdr->ig_as),
            nint,