#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.12 2000-01-25 09:23:10 itojun Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.13 2000-04-28 11:34:12 itojun Exp $";
#endif
#include <sys/param.h>
tlen = p[0];
if (tlen) {
printf(" nexthop");
- if (af == AFNUM_INET)
- advance = 4;
-#ifdef INET6
- else if (af == AFNUM_INET6)
- advance = 16;
-#endif
-
- for (i = 0; i < tlen; i += advance) {
- if (af == AFNUM_INET)
+ i = 0;
+ while (i < tlen) {
+ switch (af) {
+ case AFNUM_INET:
printf(" %s", getname(p + 1 + i));
+ i += sizeof(struct in_addr);
+ break;
#ifdef INET6
- else if (af == AFNUM_INET6)
+ case AFNUM_INET6:
printf(" %s", getname6(p + 1 + i));
+ i += sizeof(struct in6_addr);
+ break;
#endif
+ default:
+ printf(" (unknown af)");
+ i = tlen; /*exit loop*/
+ break;
+ }
}
printf(",");
}
printf(" NLRI");
while (len - (p - dat) > 0) {
- if (af == AFNUM_INET)
+ switch (af) {
+ case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
+ printf(" %s", buf);
+ break;
#ifdef INET6
- else if (af == AFNUM_INET6)
+ case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
+ printf(" %s", buf);
+ break;
#endif
- printf(" %s", buf);
+ default:
+ printf(" (unknown af)");
+ advance = 0;
+ p = dat + len;
+ break;
+ }
p += advance;
}
printf(" Withdraw");
while (len - (p - dat) > 0) {
- if (af == AFNUM_INET)
+ switch (af) {
+ case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
+ printf(" %s", buf);
+ break;
#ifdef INET6
- else if (af == AFNUM_INET6)
+ case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
+ printf(" %s", buf);
+ break;
#endif
- printf(" %s", buf);
+ default:
+ printf(" (unknown af)");
+ advance = 0;
+ p = dat + len;
+ break;
+ }
p += advance;
}
#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
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);
+ }
+ }
}
/*
}
if (eflag)
- cip_print(p, length);
+ cip_print(p, length);
/*
* Some printers want to get back at the ethernet addresses,
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?
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.64 2000-04-27 11:09:08 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.65 2000-04-28 11:34:13 itojun Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
sizeof(th->addr)))
break;
- if (!th->nxt || flags & TH_SYN) {
+ if (!th->nxt || (flags & TH_SYN)) {
/* didn't find it or new conversation */
if (th->nxt == NULL) {
th->nxt = (struct tcp_seq_hash *)
th->ack = seq, th->seq = ack - 1;
else
th->seq = seq, th->ack = ack - 1;
- } else {
-
- thseq = th->seq;
- thack = th->ack;
+ } else {
if (rev)
seq -= th->ack, ack -= th->seq;
else
seq -= th->seq, ack -= th->ack;
}
+
+ thseq = th->seq;
+ thack = th->ack;
+ } else {
+ /*fool gcc*/
+ thseq = thack = threv = 0;
}
hlen = tp->th_off * 4;
if (hlen > length) {