summaryrefslogtreecommitdiff
path: root/print-cip.c
diff options
context:
space:
mode:
authoritojun <itojun>2000-04-28 11:34:12 +0000
committeritojun <itojun>2000-04-28 11:34:12 +0000
commitc8592c474264d1d87338ba05ba9f65b83176c3c2 (patch)
tree00af197bcc7cd23b33b5161a712df4014db11279 /print-cip.c
parentc7c9cc43fc6854f84848e7f833265cb9ca5a7e87 (diff)
downloadtcpdump-c8592c474264d1d87338ba05ba9f65b83176c3c2.tar.gz
-Wall -Werror clean. fix uninitialized variables.
Diffstat (limited to 'print-cip.c')
-rw-r--r--print-cip.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/print-cip.c b/print-cip.c
index 1a00cd8a..b2b6d16b 100644
--- a/print-cip.c
+++ b/print-cip.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.3 2000-01-09 09:59:15 assar Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.4 2000-04-28 11:34:12 itojun Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -54,38 +54,38 @@ static const char rcsid[] =
const u_char *packetp;
const u_char *snapend;
-#define RFC1483LLC_LEN 8
+#define RFC1483LLC_LEN 8
static unsigned char rfcllc[] = {
- 0xaa, /* DSAP: non-ISO */
- 0xaa, /* SSAP: non-ISO */
- 0x03, /* Ctrl: Unnumbered Information Command PDU */
- 0x00, /* OUI: EtherType */
- 0x00,
- 0x00 };
+ 0xaa, /* DSAP: non-ISO */
+ 0xaa, /* SSAP: non-ISO */
+ 0x03, /* Ctrl: Unnumbered Information Command PDU */
+ 0x00, /* OUI: EtherType */
+ 0x00,
+ 0x00 };
static inline void
cip_print(register const u_char *bp, int length)
{
- int i;
-
- if (memcmp(rfcllc, bp, sizeof(rfcllc))) {
- if (qflag) {
- for(i=0;i<RFC1483LLC_LEN;i++)
- (void)printf("%2.2x ",bp[i]);
- } else {
- for(i=0;i<RFC1483LLC_LEN-2;i++)
- (void)printf("%2.2x ",bp[i]);
- etherproto_string(((u_short*)bp)[3]);
- }
- } else {
- if (qflag)
- (void)printf("(null encapsulation)");
- else {
- (void)printf("(null encap)");
- etherproto_string(ETHERTYPE_IP);
- }
- }
+ int i;
+
+ if (memcmp(rfcllc, bp, sizeof(rfcllc))) {
+ if (qflag) {
+ for (i = 0;i < RFC1483LLC_LEN; i++)
+ (void)printf("%2.2x ",bp[i]);
+ } else {
+ for (i = 0;i < RFC1483LLC_LEN - 2; i++)
+ (void)printf("%2.2x ",bp[i]);
+ etherproto_string(((u_short*)bp)[3]);
+ }
+ } else {
+ if (qflag)
+ (void)printf("(null encapsulation)");
+ else {
+ (void)printf("(null encap)");
+ etherproto_string(ETHERTYPE_IP);
+ }
+ }
}
/*
@@ -111,7 +111,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
}
if (eflag)
- cip_print(p, length);
+ cip_print(p, length);
/*
* Some printers want to get back at the ethernet addresses,
@@ -122,13 +122,15 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
snapend = p + caplen;
if (memcmp(rfcllc, p, sizeof(rfcllc))==0) {
- length -= RFC1483LLC_LEN;
- caplen -= RFC1483LLC_LEN;
- bp = (u_short*)p;
- p += RFC1483LLC_LEN;
- ether_type = ntohs(bp[3]);
- } else
- ether_type = ETHERTYPE_IP;
+ length -= RFC1483LLC_LEN;
+ caplen -= RFC1483LLC_LEN;
+ bp = (u_short *)p;
+ p += RFC1483LLC_LEN;
+ ether_type = ntohs(bp[3]);
+ } else {
+ ether_type = ETHERTYPE_IP;
+ bp = (u_short *)p;
+ }
/*
* Is it (gag) an 802.3 encapsulation?