summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netdissect.h2
-rw-r--r--print-dhcp6.c2
-rw-r--r--print-dvmrp.c15
-rw-r--r--print-esp.c10
-rw-r--r--print-forces.c4
-rw-r--r--print-ip.c4
-rw-r--r--print-ip6.c20
-rw-r--r--print-ip6opts.c8
-rw-r--r--print-isakmp.c2
-rw-r--r--print-rsvp.c52
10 files changed, 59 insertions, 60 deletions
diff --git a/netdissect.h b/netdissect.h
index b093e0e6..ec64cfe4 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -506,7 +506,7 @@ extern void dvmrp_print(netdissect_options *, const u_char *, u_int);
extern void eap_print(netdissect_options *, const u_char *, u_int);
extern void egp_print(netdissect_options *, const u_char *, u_int);
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
-extern int esp_print(netdissect_options *, const u_char *, const int, const u_char *, int *, int *);
+extern int esp_print(netdissect_options *, const u_char *, const int, const u_char *, u_int *, u_int *);
extern u_int ether_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *);
extern int ethertype_print(netdissect_options *, u_short, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
diff --git a/print-dhcp6.c b/print-dhcp6.c
index 80449497..92ca980c 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -665,7 +665,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " by-clientID"));
break;
default:
- ND_PRINT((ndo, " type_%d", (int)dh6_lq_query_type));
+ ND_PRINT((ndo, " type_%u", dh6_lq_query_type));
break;
}
ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[1])));
diff --git a/print-dvmrp.c b/print-dvmrp.c
index cab00a55..eec5056a 100644
--- a/print-dvmrp.c
+++ b/print-dvmrp.c
@@ -58,19 +58,18 @@
static int print_probe(netdissect_options *, const u_char *, const u_char *, u_int);
static int print_report(netdissect_options *, const u_char *, const u_char *, u_int);
static int print_neighbors(netdissect_options *, const u_char *, const u_char *, u_int);
-static int print_neighbors2(netdissect_options *, const u_char *, const u_char *, u_int);
+static int print_neighbors2(netdissect_options *, const u_char *, const u_char *, u_int, uint32_t);
static int print_prune(netdissect_options *, const u_char *);
static int print_graft(netdissect_options *, const u_char *);
static int print_graft_ack(netdissect_options *, const u_char *);
-static uint32_t target_level;
-
void
dvmrp_print(netdissect_options *ndo,
register const u_char *bp, register u_int len)
{
register const u_char *ep;
register u_char type;
+ uint32_t target_level;
ep = (const u_char *)ndo->ndo_snapend;
if (bp >= ep)
@@ -126,7 +125,7 @@ dvmrp_print(netdissect_options *ndo,
target_level = (bp[0] << 24) | (bp[1] << 16) |
(bp[2] << 8) | bp[3];
bp += 4;
- if (print_neighbors2(ndo, bp, ep, len) < 0)
+ if (print_neighbors2(ndo, bp, ep, len, target_level) < 0)
goto trunc;
break;
@@ -288,15 +287,15 @@ trunc:
static int
print_neighbors2(netdissect_options *ndo,
register const u_char *bp, register const u_char *ep,
- register u_int len)
+ register u_int len, uint32_t target_level)
{
const u_char *laddr;
register u_char metric, thresh, flags;
register int ncount;
- ND_PRINT((ndo, " (v %d.%d):",
- (int)target_level & 0xff,
- (int)(target_level >> 8) & 0xff));
+ ND_PRINT((ndo, " (v %u.%u):",
+ target_level & 0xff,
+ (target_level >> 8) & 0xff));
while (len > 0 && bp < ep) {
ND_TCHECK2(bp[0], 8);
diff --git a/print-esp.c b/print-esp.c
index 59d109d4..d19b36da 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -636,12 +636,12 @@ esp_print(netdissect_options *ndo,
_U_
#endif
,
- int *nhdr
+ u_int *nhdr
#ifndef HAVE_LIBCRYPTO
_U_
#endif
,
- int *padlen
+ u_int *padlen
#ifndef HAVE_LIBCRYPTO
_U_
#endif
@@ -807,14 +807,14 @@ esp_print(netdissect_options *ndo,
advance = sizeof(struct newesp);
/* sanity check for pad length */
- if (ep - bp < *(ep - 2))
+ if (ep - bp < EXTRACT_8BITS(ep - 2))
goto fail;
if (padlen)
- *padlen = *(ep - 2) + 2;
+ *padlen = EXTRACT_8BITS(ep - 2) + 2;
if (nhdr)
- *nhdr = *(ep - 1);
+ *nhdr = EXTRACT_8BITS(ep - 1);
ND_PRINT((ndo, ": "));
return advance;
diff --git a/print-forces.c b/print-forces.c
index b74227e6..bfc49e9f 100644
--- a/print-forces.c
+++ b/print-forces.c
@@ -387,14 +387,14 @@ struct forces_tlv {
#define GET_TOP_TLV(fhdr) ((const struct forces_tlv *)((fhdr) + sizeof (struct forcesh)))
#define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len))
#define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len))
-#define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0))
+#define TLV_RDAT_LEN(tlv) (EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0)
#define TLV_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0)))
#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)), \
(const struct forces_tlv*)(((const char*)(tlv)) \
+ F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length))))
#define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len))
#define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len))
-#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
+#define ILV_RDAT_LEN(ilv) (EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0)
#define ILV_DATA(ilvp) ((const void*)(((const char*)(ilvp)) + ILV_SET_LEN(0)))
#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)), \
(const struct forces_ilv *)(((const char*)(ilv)) \
diff --git a/print-ip.c b/print-ip.c
index 519cd793..8adf3fc2 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -359,7 +359,7 @@ again:
case IPPROTO_ESP:
{
- int enh, padlen;
+ u_int enh, padlen;
ipds->advance = esp_print(ndo, ipds->cp, ipds->len,
(const u_char *)ipds->ip,
&enh, &padlen);
@@ -598,7 +598,7 @@ ip_print(netdissect_options *ndo,
ipds->off = EXTRACT_BE_16BITS(&ipds->ip->ip_off);
if (ndo->ndo_vflag) {
- ND_PRINT((ndo, "(tos 0x%x", (int)ipds->ip->ip_tos));
+ ND_PRINT((ndo, "(tos 0x%x", ipds->ip->ip_tos));
/* ECN bits */
switch (ipds->ip->ip_tos & 0x03) {
diff --git a/print-ip6.c b/print-ip6.c
index 862dfb2c..fc296b81 100644
--- a/print-ip6.c
+++ b/print-ip6.c
@@ -48,7 +48,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
const struct ip6_hdr *ip6)
{
const u_char *cp;
- int advance;
+ u_int advance;
u_int nh;
const void *dst_addr;
const struct ip6_rthdr *dp;
@@ -77,7 +77,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
* the first 8 octets.
*/
ND_TCHECK2(*cp, 2);
- advance = (int)((*(cp + 1) + 1) << 3);
+ advance = (EXTRACT_8BITS(cp + 1) + 1) << 3;
nh = *cp;
break;
@@ -219,7 +219,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
const u_char *ipend;
register const u_char *cp;
register u_int payload_len;
- int nh;
+ u_int nh;
int fragmented = 0;
u_int flow;
@@ -297,19 +297,19 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
advance = hbhopt_print(ndo, cp);
if (advance < 0)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
break;
case IPPROTO_DSTOPTS:
advance = dstopt_print(ndo, cp);
if (advance < 0)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
break;
case IPPROTO_FRAGMENT:
advance = frag6_print(ndo, cp, (const u_char *)ip6);
if (advance < 0 || ndo->ndo_snapend <= cp + advance)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
fragmented = 1;
break;
@@ -326,14 +326,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
advance = mobility_print(ndo, cp, (const u_char *)ip6);
if (advance < 0)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
return;
case IPPROTO_ROUTING:
ND_TCHECK(*cp);
advance = rt6_print(ndo, cp, (const u_char *)ip6);
if (advance < 0)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
break;
case IPPROTO_SCTP:
sctp_print(ndo, cp, (const u_char *)ip6, len);
@@ -354,11 +354,11 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
advance = ah_print(ndo, cp);
if (advance < 0)
return;
- nh = *cp;
+ nh = EXTRACT_8BITS(cp);
break;
case IPPROTO_ESP:
{
- int enh, padlen;
+ u_int enh, padlen;
advance = esp_print(ndo, cp, len, (const u_char *)ip6, &enh, &padlen);
if (advance < 0)
return;
diff --git a/print-ip6opts.c b/print-ip6opts.c
index ff1d1246..c4edd4b6 100644
--- a/print-ip6opts.c
+++ b/print-ip6opts.c
@@ -174,10 +174,10 @@ int
hbhopt_print(netdissect_options *ndo, register const u_char *bp)
{
const struct ip6_hbh *dp = (const struct ip6_hbh *)bp;
- int hbhlen = 0;
+ u_int hbhlen = 0;
ND_TCHECK(dp->ip6h_len);
- hbhlen = (int)((dp->ip6h_len + 1) << 3);
+ hbhlen = (dp->ip6h_len + 1) << 3;
ND_TCHECK2(*dp, hbhlen);
ND_PRINT((ndo, "HBH "));
if (ndo->ndo_vflag)
@@ -194,10 +194,10 @@ int
dstopt_print(netdissect_options *ndo, register const u_char *bp)
{
const struct ip6_dest *dp = (const struct ip6_dest *)bp;
- int dstoptlen = 0;
+ u_int dstoptlen = 0;
ND_TCHECK(dp->ip6d_len);
- dstoptlen = (int)((dp->ip6d_len + 1) << 3);
+ dstoptlen = (dp->ip6d_len + 1) << 3;
ND_TCHECK2(*dp, dstoptlen);
ND_PRINT((ndo, "DSTOPT "));
if (ndo->ndo_vflag) {
diff --git a/print-isakmp.c b/print-isakmp.c
index a3eb0bea..52f7e558 100644
--- a/print-isakmp.c
+++ b/print-isakmp.c
@@ -3115,7 +3115,7 @@ isakmp_rfc3948_print(netdissect_options *ndo,
/* must be an ESP packet */
{
- int nh, enh, padlen;
+ u_int nh, enh, padlen;
int advance;
ND_PRINT((ndo, "UDP-encap: "));
diff --git a/print-rsvp.c b/print-rsvp.c
index 5a652d4d..ad518aad 100644
--- a/print-rsvp.c
+++ b/print-rsvp.c
@@ -738,7 +738,7 @@ rsvp_obj_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
indent,
ipaddr_string(ndo, obj_tptr),
- *(obj_tptr + sizeof(struct in_addr))));
+ EXTRACT_8BITS(obj_tptr + sizeof(struct in_addr))));
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
EXTRACT_8BITS((obj_tptr + 5)),
@@ -752,7 +752,7 @@ rsvp_obj_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
indent,
ip6addr_string(ndo, obj_tptr),
- *(obj_tptr + sizeof(struct in6_addr))));
+ EXTRACT_8BITS(obj_tptr + sizeof(struct in6_addr))));
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
EXTRACT_8BITS((obj_tptr + sizeof(struct in6_addr) + 1)),
@@ -910,7 +910,7 @@ rsvp_obj_print(netdissect_options *ndo,
tok2str(rsvp_resstyle_values,
"Unknown",
EXTRACT_BE_24BITS(obj_tptr + 1)),
- *(obj_tptr)));
+ EXTRACT_8BITS(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
@@ -1005,7 +1005,7 @@ rsvp_obj_print(netdissect_options *ndo,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
EXTRACT_BE_16BITS(obj_tptr + 2))));
- ND_PRINT((ndo, ",%s merge capability",((*(obj_tptr + 4)) & 0x80) ? "no" : "" ));
+ ND_PRINT((ndo, ",%s merge capability",((EXTRACT_8BITS(obj_tptr + 4)) & 0x80) ? "no" : "" ));
ND_PRINT((ndo, "%s Minimum VPI/VCI: %u/%u",
indent,
(EXTRACT_BE_16BITS(obj_tptr + 4))&0xfff,
@@ -1042,13 +1042,13 @@ rsvp_obj_print(netdissect_options *ndo,
tok2str(gmpls_encoding_values,
"Unknown",
EXTRACT_8BITS(obj_tptr)),
- *obj_tptr));
+ EXTRACT_8BITS(obj_tptr)));
ND_PRINT((ndo, "%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
indent,
tok2str(gmpls_switch_cap_values,
"Unknown",
EXTRACT_8BITS((obj_tptr + 1))),
- *(obj_tptr+1),
+ EXTRACT_8BITS(obj_tptr+1),
tok2str(gmpls_payload_values,
"Unknown",
EXTRACT_BE_16BITS(obj_tptr + 2)),
@@ -1115,7 +1115,7 @@ rsvp_obj_print(netdissect_options *ndo,
bittok2str(rsvp_obj_rro_label_flag_values,
"none",
EXTRACT_8BITS((obj_tptr + 2))),
- *(obj_tptr+2),
+ EXTRACT_8BITS(obj_tptr+2),
tok2str(rsvp_ctype_values,
"Unknown",
EXTRACT_8BITS((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)),
@@ -1176,15 +1176,15 @@ rsvp_obj_print(netdissect_options *ndo,
return-1;
ND_PRINT((ndo, "%s Session Name: ", indent));
for (i = 0; i < namelen; i++)
- safeputchar(ndo, *(obj_tptr + 4 + i));
+ safeputchar(ndo, EXTRACT_8BITS(obj_tptr + 4 + i));
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)",
indent,
- (int)*obj_tptr,
- (int)*(obj_tptr+1),
+ EXTRACT_8BITS(obj_tptr),
+ EXTRACT_8BITS(obj_tptr+1),
bittok2str(rsvp_session_attribute_flag_values,
"none",
EXTRACT_8BITS((obj_tptr + 2))),
- *(obj_tptr + 2)));
+ EXTRACT_8BITS(obj_tptr + 2)));
obj_tlen-=4+EXTRACT_8BITS((obj_tptr + 3));
obj_tptr+=4+EXTRACT_8BITS((obj_tptr + 3));
break;
@@ -1379,8 +1379,8 @@ rsvp_obj_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s Service Type: %s (%u), break bit %s set, Service length: %u",
indent,
tok2str(rsvp_intserv_service_type_values,"unknown",EXTRACT_8BITS((obj_tptr))),
- *(obj_tptr),
- (*(obj_tptr+1)&0x80) ? "" : "not",
+ EXTRACT_8BITS(obj_tptr),
+ (EXTRACT_8BITS(obj_tptr+1)&0x80) ? "" : "not",
intserv_serv_tlen));
obj_tptr+=4; /* get to the start of the parameter list */
@@ -1497,10 +1497,10 @@ rsvp_obj_print(netdissect_options *ndo,
bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
- (int)obj_ptr.rsvp_obj_frr->setup_prio,
- (int)obj_ptr.rsvp_obj_frr->hold_prio,
- (int)obj_ptr.rsvp_obj_frr->hop_limit,
- bw.f * 8 / 1000000));
+ obj_ptr.rsvp_obj_frr->setup_prio,
+ obj_ptr.rsvp_obj_frr->hold_prio,
+ obj_ptr.rsvp_obj_frr->hop_limit,
+ bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
indent,
EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
@@ -1516,10 +1516,10 @@ rsvp_obj_print(netdissect_options *ndo,
bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
- (int)obj_ptr.rsvp_obj_frr->setup_prio,
- (int)obj_ptr.rsvp_obj_frr->hold_prio,
- (int)obj_ptr.rsvp_obj_frr->hop_limit,
- bw.f * 8 / 1000000));
+ obj_ptr.rsvp_obj_frr->setup_prio,
+ obj_ptr.rsvp_obj_frr->hold_prio,
+ obj_ptr.rsvp_obj_frr->hop_limit,
+ bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
indent,
EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
@@ -1576,7 +1576,7 @@ rsvp_obj_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ipaddr_string(ndo, obj_tptr),
- *(obj_tptr+4),
+ EXTRACT_8BITS(obj_tptr+4),
indent,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code));
@@ -1608,7 +1608,7 @@ rsvp_obj_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ip6addr_string(ndo, obj_tptr),
- *(obj_tptr+16),
+ EXTRACT_8BITS(obj_tptr+16),
indent,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code));
@@ -1648,12 +1648,12 @@ rsvp_obj_print(netdissect_options *ndo,
indent,
tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_8BITS(obj_tptr)),
EXTRACT_8BITS(obj_tptr),
- *(obj_tptr + 1)));
+ EXTRACT_8BITS(obj_tptr + 1)));
if (obj_tlen < EXTRACT_8BITS((obj_tptr + 1)))
return-1;
- if (*(obj_tptr+1) < 2)
+ if (EXTRACT_8BITS(obj_tptr+1) < 2)
return -1;
- print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", *(obj_tptr + 1) - 2);
+ print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", EXTRACT_8BITS(obj_tptr + 1) - 2);
obj_tlen-=EXTRACT_8BITS(obj_tptr + 1);
obj_tptr+=EXTRACT_8BITS(obj_tptr + 1);
}