summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpack.c16
-rw-r--r--cpack.h10
-rw-r--r--in_cksum.c6
-rw-r--r--netdissect.h4
-rw-r--r--parsenfsfh.c6
-rw-r--r--print-802_11.c10
-rw-r--r--print-aodv.c6
-rw-r--r--print-ap1394.c6
-rw-r--r--print-atalk.c2
-rw-r--r--print-dccp.c18
-rw-r--r--print-decnet.c48
-rw-r--r--print-dhcp6.c62
-rw-r--r--print-domain.c2
-rw-r--r--print-egp.c4
-rw-r--r--print-enc.c2
-rw-r--r--print-esp.c24
-rw-r--r--print-ether.c6
-rw-r--r--print-forces.c72
-rw-r--r--print-fr.c4
-rw-r--r--print-geneve.c2
-rw-r--r--print-hsrp.c2
-rw-r--r--print-icmp.c20
-rw-r--r--print-icmp6.c111
-rw-r--r--print-igrp.c16
-rw-r--r--print-ip.c6
-rw-r--r--print-ip6opts.c4
-rw-r--r--print-ipcomp.c4
-rw-r--r--print-ipnet.c6
-rw-r--r--print-ipx.c10
-rw-r--r--print-isakmp.c224
-rw-r--r--print-juniper.c6
-rw-r--r--print-krb.c4
-rw-r--r--print-l2tp.c66
-rw-r--r--print-lane.c4
-rw-r--r--print-llc.c8
-rw-r--r--print-lwres.c28
-rw-r--r--print-mobile.c2
-rw-r--r--print-mobility.c2
-rw-r--r--print-mptcp.c20
-rw-r--r--print-msnlb.c2
-rw-r--r--print-nfs.c60
-rw-r--r--print-ntp.c4
-rw-r--r--print-null.c2
-rw-r--r--print-olsr.c30
-rw-r--r--print-ospf.c40
-rw-r--r--print-ospf6.c58
-rw-r--r--print-pgm.c48
-rw-r--r--print-pim.c8
-rw-r--r--print-pktap.c6
-rw-r--r--print-ppi.c6
-rw-r--r--print-pptp.c32
-rw-r--r--print-radius.c36
-rw-r--r--print-rip.c28
-rw-r--r--print-ripng.c2
-rw-r--r--print-rpki-rtr.c16
-rw-r--r--print-rt6.c8
-rw-r--r--print-rx.c50
-rw-r--r--print-sctp.c4
-rw-r--r--print-sflow.c2
-rw-r--r--print-sl.c16
-rw-r--r--print-slow.c2
-rw-r--r--print-snmp.c42
-rw-r--r--print-stp.c2
-rw-r--r--print-sunrpc.c8
-rw-r--r--print-symantec.c8
-rw-r--r--print-tcp.c44
-rw-r--r--print-tftp.c2
-rw-r--r--print-timed.c4
-rw-r--r--print-tipc.c8
-rw-r--r--print-udp.c80
-rw-r--r--print-vjc.c2
-rw-r--r--print-vrrp.c2
-rw-r--r--print-vtp.c2
-rw-r--r--print-wb.c28
-rw-r--r--print-zephyr.c52
-rw-r--r--smb.h2
76 files changed, 802 insertions, 797 deletions
diff --git a/cpack.c b/cpack.c
index 88028a3d..0611a071 100644
--- a/cpack.c
+++ b/cpack.c
@@ -38,8 +38,8 @@
#include "cpack.h"
#include "extract.h"
-uint8_t *
-cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment)
+const uint8_t *
+cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment)
{
size_t misalignment = (size_t)(p - buf) % alignment;
@@ -53,10 +53,10 @@ cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment)
* wordsize bytes remain in the buffer after the boundary. Otherwise,
* return a pointer to the boundary.
*/
-uint8_t *
+const uint8_t *
cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
{
- uint8_t *next;
+ const uint8_t *next;
/* Ensure alignment. */
next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
@@ -80,7 +80,7 @@ cpack_advance(struct cpack_state *cs, const size_t toskip)
}
int
-cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen)
+cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen)
{
memset(cs, 0, sizeof(*cs));
@@ -95,7 +95,7 @@ cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen)
int
cpack_uint64(struct cpack_state *cs, uint64_t *u)
{
- uint8_t *next;
+ const uint8_t *next;
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
@@ -111,7 +111,7 @@ cpack_uint64(struct cpack_state *cs, uint64_t *u)
int
cpack_uint32(struct cpack_state *cs, uint32_t *u)
{
- uint8_t *next;
+ const uint8_t *next;
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
@@ -127,7 +127,7 @@ cpack_uint32(struct cpack_state *cs, uint32_t *u)
int
cpack_uint16(struct cpack_state *cs, uint16_t *u)
{
- uint8_t *next;
+ const uint8_t *next;
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
diff --git a/cpack.h b/cpack.h
index a7eb6d61..3072e0c3 100644
--- a/cpack.h
+++ b/cpack.h
@@ -31,20 +31,20 @@
#define _CPACK_H
struct cpack_state {
- uint8_t *c_buf;
- uint8_t *c_next;
+ const uint8_t *c_buf;
+ const uint8_t *c_next;
size_t c_len;
};
-int cpack_init(struct cpack_state *, uint8_t *, size_t);
+int cpack_init(struct cpack_state *, const uint8_t *, size_t);
int cpack_uint8(struct cpack_state *, uint8_t *);
int cpack_uint16(struct cpack_state *, uint16_t *);
int cpack_uint32(struct cpack_state *, uint32_t *);
int cpack_uint64(struct cpack_state *, uint64_t *);
-uint8_t *cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment);
-uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
+const uint8_t *cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment);
+const uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
#define cpack_int8(__s, __p) cpack_uint8((__s), (uint8_t*)(__p))
#define cpack_int16(__s, __p) cpack_uint16((__s), (uint16_t*)(__p))
diff --git a/in_cksum.c b/in_cksum.c
index efbc38e0..0f19befc 100644
--- a/in_cksum.c
+++ b/in_cksum.c
@@ -73,7 +73,7 @@ in_cksum(const struct cksum_vec *vec, int veclen)
for (; veclen != 0; vec++, veclen--) {
if (vec->len == 0)
continue;
- w = (const uint16_t *)(void *)vec->ptr;
+ w = (const uint16_t *)(const void *)vec->ptr;
if (mlen == -1) {
/*
* The first byte of this chunk is the continuation
@@ -85,7 +85,7 @@ in_cksum(const struct cksum_vec *vec, int veclen)
*/
s_util.c[1] = *(const uint8_t *)w;
sum += s_util.s;
- w = (const uint16_t *)(void *)((const uint8_t *)w + 1);
+ w = (const uint16_t *)(const void *)((const uint8_t *)w + 1);
mlen = vec->len - 1;
} else
mlen = vec->len;
@@ -96,7 +96,7 @@ in_cksum(const struct cksum_vec *vec, int veclen)
REDUCE;
sum <<= 8;
s_util.c[0] = *(const uint8_t *)w;
- w = (const uint16_t *)(void *)((const uint8_t *)w + 1);
+ w = (const uint16_t *)(const void *)((const uint8_t *)w + 1);
mlen--;
byte_swapped = 1;
}
diff --git a/netdissect.h b/netdissect.h
index 159dde68..c377b622 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -538,7 +538,7 @@ extern u_int juniper_ppp_print(netdissect_options *, const struct pcap_pkthdr *,
extern u_int juniper_frelay_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern u_int juniper_chdlc_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(netdissect_options *, const u_char *, u_int);
-extern void rx_print(netdissect_options *, register const u_char *, int, int, int, u_char *);
+extern void rx_print(netdissect_options *, register const u_char *, int, int, int, const u_char *);
extern void nfsreply_print(netdissect_options *, const u_char *, u_int, const u_char *);
extern void nfsreply_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
extern void nfsreq_print_noaddr(netdissect_options *, const u_char *, u_int, const u_char *);
@@ -623,7 +623,7 @@ extern void esp_print_decodesecret(netdissect_options *ndo);
extern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
int initiator,
u_char spii[8], u_char spir[8],
- u_char *buf, u_char *end);
+ const u_char *buf, const u_char *end);
extern void geonet_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *geo_pck, u_int len);
diff --git a/parsenfsfh.c b/parsenfsfh.c
index 4d14f3d6..2d3a3840 100644
--- a/parsenfsfh.c
+++ b/parsenfsfh.c
@@ -360,13 +360,13 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
if (sizeof(*fsidp) > 14)
memset((char *)fsidp, 0, sizeof(*fsidp));
/* just use the whole thing */
- memcpy((char *)fsidp, (char *)fh, 14);
+ memcpy((char *)fsidp, (const char *)fh, 14);
}
else {
uint32_t tempa[4]; /* at least 16 bytes, maybe more */
memset((char *)tempa, 0, sizeof(tempa));
- memcpy((char *)tempa, (char *)fh, 14); /* ensure alignment */
+ memcpy((char *)tempa, (const char *)fh, 14); /* ensure alignment */
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
fsidp->fsid_code = 0;
@@ -377,7 +377,7 @@ Parse_fh(register const unsigned char *fh, int len _U_, my_fsid *fsidp,
/* Caller must save (and null-terminate?) this value */
if (fsnamep)
- *fsnamep = (char *)&(fhp[1]);
+ *fsnamep = (const char *)&(fhp[1]);
if (osnamep)
*osnamep = "VMS";
diff --git a/print-802_11.c b/print-802_11.c
index 2b4463ec..2b4688de 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -2834,10 +2834,10 @@ ieee802_11_radio_print(netdissect_options *ndo,
(EXTRACT_LE_32BITS(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0
struct cpack_state cpacker;
- struct ieee80211_radiotap_header *hdr;
+ const struct ieee80211_radiotap_header *hdr;
uint32_t present, next_present;
uint32_t presentflags = 0;
- uint32_t *presentp, *last_presentp;
+ const uint32_t *presentp, *last_presentp;
enum ieee80211_radiotap_type bit;
int bit0;
u_int len;
@@ -2851,7 +2851,7 @@ ieee802_11_radio_print(netdissect_options *ndo,
return caplen;
}
- hdr = (struct ieee80211_radiotap_header *)p;
+ hdr = (const struct ieee80211_radiotap_header *)p;
len = EXTRACT_LE_16BITS(&hdr->it_len);
@@ -2859,11 +2859,11 @@ ieee802_11_radio_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s", tstr));
return caplen;
}
- cpack_init(&cpacker, (uint8_t *)hdr, len); /* align against header start */
+ cpack_init(&cpacker, (const uint8_t *)hdr, len); /* align against header start */
cpack_advance(&cpacker, sizeof(*hdr)); /* includes the 1st bitmap */
for (last_presentp = &hdr->it_present;
IS_EXTENDED(last_presentp) &&
- (u_char*)(last_presentp + 1) <= p + len;
+ (const u_char*)(last_presentp + 1) <= p + len;
last_presentp++)
cpack_advance(&cpacker, sizeof(hdr->it_present)); /* more bitmaps */
diff --git a/print-aodv.c b/print-aodv.c
index a29fef50..ab31b034 100644
--- a/print-aodv.c
+++ b/print-aodv.c
@@ -274,7 +274,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
ap->rerr_dc, length));
- dp = (struct rerr_unreach *)(dat + sizeof(*ap));
+ dp = (const struct rerr_unreach *)(dat + sizeof(*ap));
i = length - sizeof(*ap);
for (dc = ap->rerr_dc; dc != 0; dc--) {
ND_TCHECK(*dp);
@@ -384,7 +384,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int length)
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
ap->rerr_dc, length));
- dp6 = (struct rerr_unreach6 *)(void *)(ap + 1);
+ dp6 = (const struct rerr_unreach6 *)(const void *)(ap + 1);
i = length - sizeof(*ap);
for (dc = ap->rerr_dc; dc != 0; dc--) {
ND_TCHECK(*dp6);
@@ -497,7 +497,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat _U_, u_int leng
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
ap->rerr_flags & RERR_NODELETE ? "[D]" : "",
ap->rerr_dc, length));
- dp6 = (struct rerr_unreach6_draft_01 *)(void *)(ap + 1);
+ dp6 = (const struct rerr_unreach6_draft_01 *)(const void *)(ap + 1);
i = length - sizeof(*ap);
for (dc = ap->rerr_dc; dc != 0; dc--) {
ND_TCHECK(*dp6);
diff --git a/print-ap1394.c b/print-ap1394.c
index 8adf94f4..13526465 100644
--- a/print-ap1394.c
+++ b/print-ap1394.c
@@ -82,7 +82,7 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
{
u_int length = h->len;
u_int caplen = h->caplen;
- struct firewire_header *fp;
+ const struct firewire_header *fp;
u_short ether_type;
if (caplen < FIREWIRE_HDRLEN) {
@@ -95,14 +95,14 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
length -= FIREWIRE_HDRLEN;
caplen -= FIREWIRE_HDRLEN;
- fp = (struct firewire_header *)p;
+ fp = (const struct firewire_header *)p;
p += FIREWIRE_HDRLEN;
ether_type = EXTRACT_16BITS(&fp->firewire_type);
if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
/* ether_type not known, print raw packet */
if (!ndo->ndo_eflag)
- ap1394_hdr_print(ndo, (u_char *)fp, length + FIREWIRE_HDRLEN);
+ ap1394_hdr_print(ndo, (const u_char *)fp, length + FIREWIRE_HDRLEN);
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
diff --git a/print-atalk.c b/print-atalk.c
index 0a235c82..c5eb7800 100644
--- a/print-atalk.c
+++ b/print-atalk.c
@@ -379,7 +379,7 @@ nbp_print(netdissect_options *ndo,
register u_char snode, register u_char skt)
{
register const struct atNBPtuple *tp =
- (const struct atNBPtuple *)((u_char *)np + nbpHeaderSize);
+ (const struct atNBPtuple *)((const u_char *)np + nbpHeaderSize);
int i;
const u_char *ep;
diff --git a/print-dccp.c b/print-dccp.c
index 979f6d34..09cf72b2 100644
--- a/print-dccp.c
+++ b/print-dccp.c
@@ -200,14 +200,14 @@ static inline u_int dccp_csum_coverage(const struct dccp_hdr* dh, u_int len)
static int dccp_cksum(netdissect_options *ndo, const struct ip *ip,
const struct dccp_hdr *dh, u_int len)
{
- return nextproto4_cksum(ndo, ip, (const uint8_t *)(void *)dh, len,
+ return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)dh, len,
dccp_csum_coverage(dh, len), IPPROTO_DCCP);
}
#ifdef INET6
static int dccp6_cksum(const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_int len)
{
- return nextproto6_cksum(ip6, (const uint8_t *)(void *)dh, len,
+ return nextproto6_cksum(ip6, (const uint8_t *)(const void *)dh, len,
dccp_csum_coverage(dh, len), IPPROTO_DCCP);
}
#endif
@@ -282,7 +282,7 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
dh = (const struct dccp_hdr *)bp;
- ip = (struct ip *)data2;
+ ip = (const struct ip *)data2;
#ifdef INET6
if (IP_V(ip) == 6)
ip6 = (const struct ip6_hdr *)data2;
@@ -369,8 +369,8 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
dccph_type = DCCPH_TYPE(dh);
switch (dccph_type) {
case DCCP_PKT_REQUEST: {
- struct dccp_hdr_request *dhr =
- (struct dccp_hdr_request *)(bp + fixed_hdrlen);
+ const struct dccp_hdr_request *dhr =
+ (const struct dccp_hdr_request *)(bp + fixed_hdrlen);
fixed_hdrlen += 4;
if (len < fixed_hdrlen) {
ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
@@ -385,8 +385,8 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
break;
}
case DCCP_PKT_RESPONSE: {
- struct dccp_hdr_response *dhr =
- (struct dccp_hdr_response *)(bp + fixed_hdrlen);
+ const struct dccp_hdr_response *dhr =
+ (const struct dccp_hdr_response *)(bp + fixed_hdrlen);
fixed_hdrlen += 12;
if (len < fixed_hdrlen) {
ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
@@ -446,8 +446,8 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
break;
case DCCP_PKT_RESET: {
- struct dccp_hdr_reset *dhr =
- (struct dccp_hdr_reset *)(bp + fixed_hdrlen);
+ const struct dccp_hdr_reset *dhr =
+ (const struct dccp_hdr_reset *)(bp + fixed_hdrlen);
fixed_hdrlen += 12;
if (len < fixed_hdrlen) {
ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
diff --git a/print-decnet.c b/print-decnet.c
index f32b511e..1eb9d949 100644
--- a/print-decnet.c
+++ b/print-decnet.c
@@ -585,7 +585,7 @@ decnet_print(netdissect_options *ndo,
break;
default:
ND_PRINT((ndo, "unknown message flags under mask"));
- ND_DEFAULTPRINT((u_char *)ap, min(length, caplen));
+ ND_DEFAULTPRINT((const u_char *)ap, min(length, caplen));
return;
}
@@ -616,11 +616,11 @@ print_decnet_ctlmsg(netdissect_options *ndo,
u_int caplen)
{
int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
- register union controlmsg *cmp = (union controlmsg *)rhp;
+ register const union controlmsg *cmp = (const union controlmsg *)rhp;
int src, dst, info, blksize, eco, ueco, hello, other, vers;
etheraddr srcea, rtea;
int priority;
- char *rhpx = (char *)rhp;
+ const char *rhpx = (const char *)rhp;
int ret;
switch (mflags & RMF_CTLMASK) {
@@ -691,7 +691,7 @@ print_decnet_ctlmsg(netdissect_options *ndo,
vers = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_vers);
eco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_eco);
ueco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_ueco);
- memcpy((char *)&srcea, (char *)&(cmp->cm_rhello.rh_src),
+ memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src),
sizeof(srcea));
src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr);
info = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_info);
@@ -714,13 +714,13 @@ print_decnet_ctlmsg(netdissect_options *ndo,
vers = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_vers);
eco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_eco);
ueco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_ueco);
- memcpy((char *)&srcea, (char *)&(cmp->cm_ehello.eh_src),
+ memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src),
sizeof(srcea));
src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr);
info = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_info);
blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize);
/*seed*/
- memcpy((char *)&rtea, (char *)&(cmp->cm_ehello.eh_router),
+ memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router),
sizeof(rtea));
dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr);
hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello);
@@ -735,7 +735,7 @@ print_decnet_ctlmsg(netdissect_options *ndo,
default:
ND_PRINT((ndo, "unknown control message"));
- ND_DEFAULTPRINT((u_char *)rhp, min(length, caplen));
+ ND_DEFAULTPRINT((const u_char *)rhp, min(length, caplen));
ret = 1;
break;
}
@@ -854,7 +854,7 @@ static int
print_nsp(netdissect_options *ndo,
const u_char *nspp, u_int nsplen)
{
- const struct nsphdr *nsphp = (struct nsphdr *)nspp;
+ const struct nsphdr *nsphp = (const struct nsphdr *)nspp;
int dst, src, flags;
if (nsplen < sizeof(struct nsphdr))
@@ -873,10 +873,10 @@ print_nsp(netdissect_options *ndo,
case MFS_BOM+MFS_EOM:
ND_PRINT((ndo, "data %d>%d ", src, dst));
{
- struct seghdr *shp = (struct seghdr *)nspp;
+ const struct seghdr *shp = (const struct seghdr *)nspp;
int ack;
#ifdef PRINT_NSPDATA
- u_char *dp;
+ const u_char *dp;
#endif
u_int data_off = sizeof(struct minseghdr);
@@ -919,10 +919,10 @@ print_nsp(netdissect_options *ndo,
case MFS_ILS+MFS_INT:
ND_PRINT((ndo, "intr "));
{
- struct seghdr *shp = (struct seghdr *)nspp;
+ const struct seghdr *shp = (const struct seghdr *)nspp;
int ack;
#ifdef PRINT_NSPDATA
- u_char *dp;
+ const u_char *dp;
#endif
u_int data_off = sizeof(struct minseghdr);
@@ -965,9 +965,9 @@ print_nsp(netdissect_options *ndo,
case MFS_ILS:
ND_PRINT((ndo, "link-service %d>%d ", src, dst));
{
- struct seghdr *shp = (struct seghdr *)nspp;
- struct lsmsg *lsmp =
- (struct lsmsg *)&(nspp[sizeof(struct seghdr)]);
+ const struct seghdr *shp = (const struct seghdr *)nspp;
+ const struct lsmsg *lsmp =
+ (const struct lsmsg *)&(nspp[sizeof(struct seghdr)]);
int ack;
int lsflags, fcval;
@@ -1031,7 +1031,7 @@ print_nsp(netdissect_options *ndo,
case MFS_DACK:
ND_PRINT((ndo, "data-ack %d>%d ", src, dst));
{
- struct ackmsg *amp = (struct ackmsg *)nspp;
+ const struct ackmsg *amp = (const struct ackmsg *)nspp;
int ack;
if (nsplen < sizeof(struct ackmsg))
@@ -1056,7 +1056,7 @@ print_nsp(netdissect_options *ndo,
case MFS_IACK:
ND_PRINT((ndo, "ils-ack %d>%d ", src, dst));
{
- struct ackmsg *amp = (struct ackmsg *)nspp;
+ const struct ackmsg *amp = (const struct ackmsg *)nspp;
int ack;
if (nsplen < sizeof(struct ackmsg))
@@ -1097,10 +1097,10 @@ print_nsp(netdissect_options *ndo,
ND_PRINT((ndo, "retrans-conn-initiate "));
ND_PRINT((ndo, "%d>%d ", src, dst));
{
- struct cimsg *cimp = (struct cimsg *)nspp;
+ const struct cimsg *cimp = (const struct cimsg *)nspp;
int services, info, segsize;
#ifdef PRINT_NSPDATA
- u_char *dp;
+ const u_char *dp;
#endif
if (nsplen < sizeof(struct cimsg))
@@ -1150,11 +1150,11 @@ print_nsp(netdissect_options *ndo,
case MFS_CC:
ND_PRINT((ndo, "conn-confirm %d>%d ", src, dst));
{
- struct ccmsg *ccmp = (struct ccmsg *)nspp;
+ const struct ccmsg *ccmp = (const struct ccmsg *)nspp;
int services, info;
u_int segsize, optlen;
#ifdef PRINT_NSPDATA
- u_char *dp;
+ const u_char *dp;
#endif
if (nsplen < sizeof(struct ccmsg))
@@ -1208,11 +1208,11 @@ print_nsp(netdissect_options *ndo,
case MFS_DI:
ND_PRINT((ndo, "disconn-initiate %d>%d ", src, dst));
{
- struct dimsg *dimp = (struct dimsg *)nspp;
+ const struct dimsg *dimp = (const struct dimsg *)nspp;
int reason;
u_int optlen;
#ifdef PRINT_NSPDATA
- u_char *dp;
+ const u_char *dp;
#endif
if (nsplen < sizeof(struct dimsg))
@@ -1237,7 +1237,7 @@ print_nsp(netdissect_options *ndo,
case MFS_DC:
ND_PRINT((ndo, "disconn-confirm %d>%d ", src, dst));
{
- struct dcmsg *dcmp = (struct dcmsg *)nspp;
+ const struct dcmsg *dcmp = (const struct dcmsg *)nspp;
int reason;
ND_TCHECK(*dcmp);
diff --git a/print-dhcp6.c b/print-dhcp6.c
index ff55917a..3e7aa803 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -292,7 +292,7 @@ dhcp6opt_print(netdissect_options *ndo,
while (cp < ep) {
if (ep < cp + sizeof(*dh6o))
goto trunc;
- dh6o = (struct dhcp6opt *)cp;
+ dh6o = (const struct dhcp6opt *)cp;
ND_TCHECK(*dh6o);
optlen = EXTRACT_16BITS(&dh6o->dh6opt_len);
if (ep < cp + sizeof(*dh6o) + optlen)
@@ -307,7 +307,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
switch (EXTRACT_16BITS(tp)) {
case 1:
if (optlen >= 2 + 6) {
@@ -359,7 +359,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0])));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_32BITS(&tp[16]),
@@ -376,7 +376,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 2) {
ND_PRINT((ndo, " %s",
tok2str(dh6opt_str, "opt_%u", EXTRACT_16BITS(&tp[i]))));
@@ -388,7 +388,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %d)", *tp));
break;
case DH6OPT_ELAPSED_TIME:
@@ -396,12 +396,12 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %d)", EXTRACT_16BITS(tp)));
break;
case DH6OPT_RELAY_MSG:
ND_PRINT((ndo, " ("));
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
dhcp6_print(ndo, tp, optlen);
ND_PRINT((ndo, ")"));
break;
@@ -410,7 +410,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
auth_proto = *tp;
switch (auth_proto) {
case DH6OPT_AUTHPROTO_DELAYED:
@@ -505,14 +505,14 @@ dhcp6opt_print(netdissect_options *ndo,
* Since we cannot predict the encoding, print hex dump
* at most 10 characters.
*/
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " "));
for (i = 0; i < optlen && i < 10; i++)
ND_PRINT((ndo, "%02x", tp[i]));
ND_PRINT((ndo, "...)"));
break;
case DH6OPT_RECONF_MSG:
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
switch (*tp) {
case DH6_RENEW:
ND_PRINT((ndo, " for renew)"));
@@ -540,14 +540,14 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 16)
ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[i])));
ND_PRINT((ndo, ")"));
break;
case DH6OPT_SIP_SERVER_D:
case DH6OPT_DOMAIN_LIST:
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
while (tp < cp + sizeof(*dh6o) + optlen) {
ND_PRINT((ndo, " "));
if ((tp = ns_nprint(ndo, tp, cp + sizeof(*dh6o) + optlen)) == NULL)
@@ -560,7 +560,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_16BITS(&tp[0]))));
break;
case DH6OPT_IA_NA:
@@ -569,7 +569,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " IAID:%u T1:%u T2:%u",
EXTRACT_32BITS(&tp[0]),
EXTRACT_32BITS(&tp[4]),
@@ -585,7 +585,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " IAID:%u", EXTRACT_32BITS(tp)));
if (optlen > 4) {
/* there are sub-options */
@@ -598,7 +598,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8]));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_32BITS(&tp[0]),
@@ -615,7 +615,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %d)", EXTRACT_32BITS(tp)));
break;
case DH6OPT_REMOTE_ID:
@@ -623,7 +623,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %d ", EXTRACT_32BITS(tp)));
/*
* Print hex dump first 10 characters.
@@ -637,7 +637,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
switch (*tp) {
case 1:
ND_PRINT((ndo, " by-address"));
@@ -657,7 +657,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, ")"));
break;
case DH6OPT_CLIENT_DATA:
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
if (optlen > 0) {
/* there are encapsulated options */
dhcp6opt_print(ndo, tp, tp + optlen);
@@ -669,7 +669,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s ", ip6addr_string(ndo, &tp[0])));
/*
* Print hex dump first 10 characters.
@@ -683,7 +683,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
while (tp < cp + sizeof(*dh6o) + optlen - 4) {
subopt_code = EXTRACT_16BITS(tp);
tp += 2;
@@ -719,7 +719,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?)"));
break;
}
- tp = (u_char *)(dh6o + 1);
+ tp = (const u_char *)(dh6o + 1);
remain_len = optlen;
ND_PRINT((ndo, " "));
/* Encoding is described in section 3.1 of RFC 1035 */
@@ -757,20 +757,20 @@ void
dhcp6_print(netdissect_options *ndo,
const u_char *cp, u_int length)
{
- struct dhcp6 *dh6;
- struct dhcp6_relay *dh6relay;
+ const struct dhcp6 *dh6;
+ const struct dhcp6_relay *dh6relay;
const u_char *ep;
- u_char *extp;
+ const u_char *extp;
const char *name;
ND_PRINT((ndo, "dhcp6"));
- ep = (u_char *)ndo->ndo_snapend;
+ ep = (const u_char *)ndo->ndo_snapend;
if (cp + length < ep)
ep = cp + length;
- dh6 = (struct dhcp6 *)cp;
- dh6relay = (struct dhcp6_relay *)cp;
+ dh6 = (const struct dhcp6 *)cp;
+ dh6relay = (const struct dhcp6_relay *)cp;
ND_TCHECK(dh6->dh6_xid);
name = tok2str(dh6_msgtype_str, "msgtype-%u", dh6->dh6_msgtype);
@@ -785,7 +785,7 @@ dhcp6_print(netdissect_options *ndo,
if (dh6->dh6_msgtype != DH6_RELAY_FORW &&
dh6->dh6_msgtype != DH6_RELAY_REPLY) {
ND_PRINT((ndo, "xid=%x", EXTRACT_32BITS(&dh6->dh6_xid) & DH6_XIDMASK));
- extp = (u_char *)(dh6 + 1);
+ extp = (const u_char *)(dh6 + 1);
dhcp6opt_print(ndo, extp, ep);
} else { /* relay messages */
struct in6_addr addr6;
@@ -798,7 +798,7 @@ dhcp6_print(netdissect_options *ndo,
memcpy(&addr6, dh6relay->dh6relay_peeraddr, sizeof (addr6));
ND_PRINT((ndo, " peeraddr=%s", ip6addr_string(ndo, &addr6)));
- dhcp6opt_print(ndo, (u_char *)(dh6relay + 1), ep);
+ dhcp6opt_print(ndo, (const u_char *)(dh6relay + 1), ep);
}
/*(*/
ND_PRINT((ndo, ")"));
diff --git a/print-domain.c b/print-domain.c
index 3fcd9016..3f9c7065 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -665,7 +665,7 @@ ns_print(netdissect_options *ndo,
DNS_CD(np) ? "%" : ""));
/* any weirdness? */
- b2 = EXTRACT_16BITS(((u_short *)np)+1);
+ b2 = EXTRACT_16BITS(((const u_short *)np)+1);
if (b2 & 0x6cf)
ND_PRINT((ndo, " [b2&3=0x%x]", b2));
diff --git a/print-egp.c b/print-egp.c
index 8e4abc65..e15f688b 100644
--- a/print-egp.c
+++ b/print-egp.c
@@ -151,7 +151,7 @@ egpnrprint(netdissect_options *ndo,
net = 0;
netlen = 0;
}
- cp = (uint8_t *)(egp + 1);
+ cp = (const uint8_t *)(egp + 1);
t_gateways = egp->egp_intgw + egp->egp_extgw;
for (gateways = 0; gateways < t_gateways; ++gateways) {
@@ -214,7 +214,7 @@ egp_print(netdissect_options *ndo,
register int code;
register int type;
- egp = (struct egp_packet *)bp;
+ egp = (const struct egp_packet *)bp;
if (!ND_TTEST2(*egp, length)) {
ND_PRINT((ndo, "[|egp]"));
return;
diff --git a/print-enc.c b/print-enc.c
index 84dc01ba..445bc4a9 100644
--- a/print-enc.c
+++ b/print-enc.c
@@ -97,7 +97,7 @@ enc_if_print(netdissect_options *ndo,
goto out;
}
- hdr = (struct enchdr *)p;
+ hdr = (const struct enchdr *)p;
flags = hdr->flags;
if (flags == 0)
ND_PRINT((ndo, "(unprotected): "));
diff --git a/print-esp.c b/print-esp.c
index d4101cef..3086928e 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -125,10 +125,10 @@ USES_APPLE_DEPRECATED_API
int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
int initiator,
u_char spii[8], u_char spir[8],
- u_char *buf, u_char *end)
+ const u_char *buf, const u_char *end)
{
struct sa_list *sa;
- u_char *iv;
+ const u_char *iv;
int len;
EVP_CIPHER_CTX ctx;
@@ -563,21 +563,21 @@ esp_print(netdissect_options *ndo,
register const struct newesp *esp;
register const u_char *ep;
#ifdef HAVE_LIBCRYPTO
- struct ip *ip;
+ const struct ip *ip;
struct sa_list *sa = NULL;
#ifdef INET6
- struct ip6_hdr *ip6 = NULL;
+ const struct ip6_hdr *ip6 = NULL;
#endif
int advance;
int len;
u_char *secret;
int ivlen = 0;
- u_char *ivoff;
- u_char *p;
+ const u_char *ivoff;
+ const u_char *p;
EVP_CIPHER_CTX ctx;
#endif
- esp = (struct newesp *)bp;
+ esp = (const struct newesp *)bp;
#ifdef HAVE_LIBCRYPTO
secret = NULL;
@@ -592,7 +592,7 @@ esp_print(netdissect_options *ndo,
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
- if ((u_char *)(esp + 1) >= ep) {
+ if ((const u_char *)(esp + 1) >= ep) {
ND_PRINT((ndo, "[|ESP]"));
goto fail;
}
@@ -614,11 +614,11 @@ esp_print(netdissect_options *ndo,
if (ndo->ndo_sa_list_head == NULL)
goto fail;
- ip = (struct ip *)bp2;
+ ip = (const struct ip *)bp2;
switch (IP_V(ip)) {
#ifdef INET6
case 6:
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
/* we do not attempt to decrypt jumbograms */
if (!EXTRACT_16BITS(&ip6->ip6_plen))
goto fail;
@@ -674,7 +674,7 @@ esp_print(netdissect_options *ndo,
ep = bp2 + len;
}
- ivoff = (u_char *)(esp + 1) + 0;
+ ivoff = (const u_char *)(esp + 1) + 0;
ivlen = sa->ivlen;
secret = sa->secret;
ep = ep - sa->authlen;
@@ -688,7 +688,7 @@ esp_print(netdissect_options *ndo,
EVP_CipherInit(&ctx, NULL, NULL, p, 0);
EVP_Cipher(&ctx, p + ivlen, p + ivlen, ep - (p + ivlen));
EVP_CIPHER_CTX_cleanup(&ctx);
- advance = ivoff - (u_char *)esp + ivlen;
+ advance = ivoff - (const u_char *)esp + ivlen;
} else
advance = sizeof(struct newesp);
diff --git a/print-ether.c b/print-ether.c
index 83cc4e5f..ddf6a530 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -128,7 +128,7 @@ ether_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int caplen,
void (*print_encap_header)(netdissect_options *ndo, const u_char *), const u_char *encap_header_arg)
{
- struct ether_header *ep;
+ const struct ether_header *ep;
u_int orig_length;
u_short ether_type;
u_int hdrlen;
@@ -152,7 +152,7 @@ ether_print(netdissect_options *ndo,
length -= ETHER_HDRLEN;
caplen -= ETHER_HDRLEN;
- ep = (struct ether_header *)p;
+ ep = (const struct ether_header *)p;
p += ETHER_HDRLEN;
hdrlen = ETHER_HDRLEN;
@@ -227,7 +227,7 @@ recurse:
if (!ndo->ndo_eflag) {
if (print_encap_header != NULL)
(*print_encap_header)(ndo, encap_header_arg);
- ether_hdr_print(ndo, (u_char *)ep, orig_length);
+ ether_hdr_print(ndo, (const u_char *)ep, orig_length);
}
if (!ndo->ndo_suppress_default_print)
diff --git a/print-forces.c b/print-forces.c
index 6626e31f..111e83d5 100644
--- a/print-forces.c
+++ b/print-forces.c
@@ -385,20 +385,20 @@ struct forces_tlv {
};
#define F_ALN_LEN(len) ( ((len)+ForCES_ALNL-1) & ~(ForCES_ALNL-1) )
-#define GET_TOP_TLV(fhdr) ((struct forces_tlv *)((fhdr) + sizeof (struct forcesh)))
+#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_DATA(tlvp) ((void*)(((char*)(tlvp)) + 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_16BITS(&(tlv)->length)), \
- (struct forces_tlv*)(((char*)(tlv)) \
+ (const struct forces_tlv*)(((const char*)(tlv)) \
+ F_ALN_LEN(EXTRACT_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_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
-#define ILV_DATA(ilvp) ((void*)(((char*)(ilvp)) + 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_32BITS(&(ilv)->length)), \
- (struct forces_ilv *)(((char*)(ilv)) \
+ (const struct forces_ilv *)(((const char*)(ilv)) \
+ F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length))))
#define INVALID_RLEN 1
#define INVALID_STLN 2
@@ -645,9 +645,9 @@ prestlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk _U_, int indent)
{
- const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
- register const u_char *tdp = (u_char *) TLV_DATA(tlv);
- struct res_val *r = (struct res_val *)tdp;
+ const struct forces_tlv *tlv = (const struct forces_tlv *)pptr;
+ register const u_char *tdp = (const u_char *) TLV_DATA(tlv);
+ const struct res_val *r = (const struct res_val *)tdp;
u_int dlen;
/*
@@ -683,9 +683,9 @@ fdatatlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk _U_, int indent)
{
- const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (const struct forces_tlv *)pptr;
u_int rlen;
- register const u_char *tdp = (u_char *) TLV_DATA(tlv);
+ register const u_char *tdp = (const u_char *) TLV_DATA(tlv);
uint16_t type;
/*
@@ -719,7 +719,7 @@ sdatailv_print(netdissect_options *ndo,
uint16_t op_msk _U_, int indent)
{
u_int rlen;
- const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (const struct forces_ilv *)pptr;
int invilv;
if (len < ILV_HDRL) {
@@ -733,7 +733,7 @@ sdatailv_print(netdissect_options *ndo,
ND_PRINT((ndo, "Jamal - outstanding length <%d>\n", rlen));
#endif
char *ib = indent_pr(indent, 1);
- register const u_char *tdp = (u_char *) ILV_DATA(ilv);
+ register const u_char *tdp = (const u_char *) ILV_DATA(ilv);
ND_TCHECK(*ilv);
invilv = ilv_valid(ilv, rlen);
if (invilv) {
@@ -764,9 +764,9 @@ sdatatlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk, int indent)
{
- const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (const struct forces_tlv *)pptr;
u_int rlen;
- register const u_char *tdp = (u_char *) TLV_DATA(tlv);
+ register const u_char *tdp = (const u_char *) TLV_DATA(tlv);
uint16_t type;
/*
@@ -793,10 +793,10 @@ pkeyitlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk, int indent)
{
- const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
- register const u_char *tdp = (u_char *) TLV_DATA(tlv);
+ const struct forces_tlv *tlv = (const struct forces_tlv *)pptr;
+ register const u_char *tdp = (const u_char *) TLV_DATA(tlv);
register const u_char *dp = tdp + 4;
- const struct forces_tlv *kdtlv = (struct forces_tlv *)dp;
+ const struct forces_tlv *kdtlv = (const struct forces_tlv *)dp;
uint32_t id;
char *ib = indent_pr(indent, 0);
uint16_t type, tll;
@@ -821,7 +821,7 @@ pkeyitlv_print(netdissect_options *ndo,
* go past the end of the containing TLV).
*/
tll = EXTRACT_16BITS(&kdtlv->length);
- dp = (u_char *) TLV_DATA(kdtlv);
+ dp = (const u_char *) TLV_DATA(kdtlv);
return fdatatlv_print(ndo, dp, tll, op_msk, indent);
trunc:
@@ -880,7 +880,7 @@ pdatacnt_print(netdissect_options *ndo,
}
if (op_msk & B_KEYIN) {
- struct forces_tlv *keytlv;
+ const struct forces_tlv *keytlv;
uint16_t tll;
if (len < PTH_DESC_SIZE) {
@@ -892,7 +892,7 @@ pdatacnt_print(netdissect_options *ndo,
/* skip keyid */
pptr += 4;
len -= 4;
- keytlv = (struct forces_tlv *)pptr;
+ keytlv = (const struct forces_tlv *)pptr;
/* skip header */
pptr += sizeof(struct forces_tlv);
len -= sizeof(struct forces_tlv);
@@ -915,7 +915,7 @@ pdatacnt_print(netdissect_options *ndo,
}
if (len) {
- const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr;
uint16_t type;
uint16_t tll;
int pad = 0;
@@ -991,7 +991,7 @@ pdata_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk, int indent)
{
- const struct pathdata_h *pdh = (struct pathdata_h *)pptr;
+ const struct pathdata_h *pdh = (const struct pathdata_h *)pptr;
char *ib = indent_pr(indent, 0);
u_int minsize = 0;
int more_pd = 0;
@@ -1055,7 +1055,7 @@ genoptlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk, int indent)
{
- const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr;
uint16_t type;
int tll;
u_int invtlv;
@@ -1073,7 +1073,7 @@ genoptlv_print(netdissect_options *ndo,
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- register const u_char *dp = (u_char *) TLV_DATA(pdtlv);
+ register const u_char *dp = (const u_char *) TLV_DATA(pdtlv);
if (!ttlv_valid(type)) {
ND_PRINT((ndo, "%s TLV type 0x%x len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), type,
@@ -1101,7 +1101,7 @@ recpdoptlv_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk, int indent)
{
- const struct forces_tlv *pdtlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *pdtlv = (const struct forces_tlv *)pptr;
int tll;
u_int invtlv;
uint16_t type;
@@ -1122,7 +1122,7 @@ recpdoptlv_print(netdissect_options *ndo,
*/
ib = indent_pr(indent, 0);
type = EXTRACT_16BITS(&pdtlv->type);
- dp = (u_char *) TLV_DATA(pdtlv);
+ dp = (const u_char *) TLV_DATA(pdtlv);
tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL;
if (ndo->ndo_vflag >= 3)
@@ -1170,7 +1170,7 @@ otlv_print(netdissect_options *ndo,
const struct forces_tlv *otlv, uint16_t op_msk _U_, int indent)
{
int rc = 0;
- register const u_char *dp = (u_char *) TLV_DATA(otlv);
+ register const u_char *dp = (const u_char *) TLV_DATA(otlv);
uint16_t type;
int tll;
char *ib = indent_pr(indent, 0);
@@ -1348,7 +1348,7 @@ print_metailv(netdissect_options *ndo,
u_int rlen;
char *ib = indent_pr(indent, 0);
/* XXX: check header length */
- const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (const struct forces_ilv *)pptr;
/*
* print_metatlv() has ensured that len (what remains in the
@@ -1377,7 +1377,7 @@ print_metatlv(netdissect_options *ndo,
u_int dlen;
char *ib = indent_pr(indent, 0);
u_int rlen;
- const struct forces_ilv *ilv = (struct forces_ilv *)pptr;
+ const struct forces_ilv *ilv = (const struct forces_ilv *)pptr;
int invilv;
/*
@@ -1399,7 +1399,7 @@ print_metatlv(netdissect_options *ndo,
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- print_metailv(ndo, (u_char *) ilv, 0, indent + 1);
+ print_metailv(ndo, (const u_char *) ilv, 0, indent + 1);
ilv = GO_NXT_ILV(ilv, rlen);
}
@@ -1438,7 +1438,7 @@ redirect_print(netdissect_options *ndo,
register const u_char * pptr, register u_int len,
uint16_t op_msk _U_, int indent)
{
- const struct forces_tlv *tlv = (struct forces_tlv *)pptr;
+ const struct forces_tlv *tlv = (const struct forces_tlv *)pptr;
u_int dlen;
u_int rlen;
u_int invtlv;
@@ -1470,10 +1470,10 @@ redirect_print(netdissect_options *ndo,
* go past the end of the containing TLV).
*/
if (EXTRACT_16BITS(&tlv->type) == F_TLV_METD) {
- print_metatlv(ndo, (u_char *) TLV_DATA(tlv),
+ print_metatlv(ndo, (const u_char *) TLV_DATA(tlv),
EXTRACT_16BITS(&tlv->length), 0, indent);
} else if ((EXTRACT_16BITS(&tlv->type) == F_TLV_REDD)) {
- print_reddata(ndo, (u_char *) TLV_DATA(tlv),
+ print_reddata(ndo, (const u_char *) TLV_DATA(tlv),
EXTRACT_16BITS(&tlv->length), 0, indent);
} else {
ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n",
@@ -1540,7 +1540,7 @@ lfbselect_print(netdissect_options *ndo,
EXTRACT_32BITS(&lfbs->instance)));
}
- otlv = (struct forces_tlv *)(lfbs + 1);
+ otlv = (const struct forces_tlv *)(lfbs + 1);
indent += 1;
while (rlen != 0) {
@@ -1562,7 +1562,7 @@ lfbselect_print(netdissect_options *ndo,
ND_PRINT((ndo,
"\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
EXTRACT_16BITS(&otlv->type), EXTRACT_16BITS(&otlv->length)));
- invoptlv_print(ndo, (u_char *)otlv, rlen, 0, indent);
+ invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent);
}
otlv = GO_NXT_TLV(otlv, rlen);
}
@@ -1644,7 +1644,7 @@ forces_type_print(netdissect_options *ndo,
EXTRACT_16BITS(&tltlv->length),
EXTRACT_16BITS(&tltlv->length) - TLV_HDRL));
- rc = tops->print(ndo, (u_char *) TLV_DATA(tltlv),
+ rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv),
EXTRACT_16BITS(&tltlv->length), tops->op_msk, 9);
if (rc < 0) {
return -1;
diff --git a/print-fr.c b/print-fr.c
index 17321b14..2e04cbdc 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -765,7 +765,7 @@ q933_print(netdissect_options *ndo,
const u_char *p, u_int length)
{
const u_char *ptemp = p;
- struct ie_tlv_header_t *ie_p;
+ const struct ie_tlv_header_t *ie_p;
int olen;
int is_ansi = 0;
u_int codeset;
@@ -813,7 +813,7 @@ q933_print(netdissect_options *ndo,
/* Loop through the rest of IE */
while (length > sizeof(struct ie_tlv_header_t)) {
- ie_p = (struct ie_tlv_header_t *)ptemp;
+ ie_p = (const struct ie_tlv_header_t *)ptemp;
if (length < sizeof(struct ie_tlv_header_t) ||
length < sizeof(struct ie_tlv_header_t) + ie_p->ie_len) {
if (ndo->ndo_vflag) { /* not bark if there is just a trailer */
diff --git a/print-geneve.c b/print-geneve.c
index 56b9f2b5..cf6d9d1e 100644
--- a/print-geneve.c
+++ b/print-geneve.c
@@ -111,7 +111,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len)
}
if (ndo->ndo_vflag > 1 && opt_len > 4) {
- uint32_t *print_data = (uint32_t *)(bp + 4);
+ const uint32_t *print_data = (const uint32_t *)(bp + 4);
int i;
ND_PRINT((ndo, " data"));
diff --git a/print-hsrp.c b/print-hsrp.c
index 35272b94..6dc43de1 100644
--- a/print-hsrp.c
+++ b/print-hsrp.c
@@ -93,7 +93,7 @@ struct hsrp {
void
hsrp_print(netdissect_options *ndo, register const uint8_t *bp, register u_int len)
{
- struct hsrp *hp = (struct hsrp *) bp;
+ const struct hsrp *hp = (const struct hsrp *) bp;
ND_TCHECK(hp->hsrp_version);
ND_PRINT((ndo, "HSRPv%d", hp->hsrp_version));
diff --git a/print-icmp.c b/print-icmp.c
index e7039876..1c92d032 100644
--- a/print-icmp.c
+++ b/print-icmp.c
@@ -343,9 +343,9 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
char buf[MAXHOSTNAMELEN + 100];
struct cksum_vec vec[1];
- dp = (struct icmp *)bp;
- ext_dp = (struct icmp_ext_t *)bp;
- ip = (struct ip *)bp2;
+ dp = (const struct icmp *)bp;
+ ext_dp = (const struct icmp_ext_t *)bp;
+ ip = (const struct ip *)bp2;
str = buf;
ND_TCHECK(dp->icmp_code);
@@ -377,7 +377,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
ND_TCHECK(dp->icmp_ip.ip_p);
oip = &dp->icmp_ip;
hlen = IP_HL(oip) * 4;
- ouh = (struct udphdr *)(((u_char *)oip) + hlen);
+ ouh = (const struct udphdr *)(((const u_char *)oip) + hlen);
ND_TCHECK(ouh->uh_dport);
dport = EXTRACT_16BITS(&ouh->uh_dport);
switch (oip->ip_p) {
@@ -408,7 +408,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
case ICMP_UNREACH_NEEDFRAG:
{
register const struct mtu_discovery *mp;
- mp = (struct mtu_discovery *)(u_char *)&dp->icmp_void;
+ mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void;
mtu = EXTRACT_16BITS(&mp->nexthopmtu);
if (mtu) {
(void)snprintf(buf, sizeof(buf),
@@ -449,7 +449,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
(void)snprintf(buf, sizeof(buf), "router advertisement");
cp = buf + strlen(buf);
- ihp = (struct ih_rdiscovery *)&dp->icmp_void;
+ ihp = (const struct ih_rdiscovery *)&dp->icmp_void;
ND_TCHECK(*ihp);
(void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf));
cp = buf + strlen(buf);
@@ -558,7 +558,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
uint16_t sum, icmp_sum;
struct cksum_vec vec[1];
if (ND_TTEST2(*bp, plen)) {
- vec[0].ptr = (const uint8_t *)(void *)dp;
+ vec[0].ptr = (const uint8_t *)(const void *)dp;
vec[0].len = plen;
sum = in_cksum(vec, 1);
if (sum != 0) {
@@ -577,7 +577,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
if (ndo->ndo_vflag >= 1 && ICMP_ERRTYPE(dp->icmp_type)) {
bp += 8;
ND_PRINT((ndo, "\n\t"));
- ip = (struct ip *)bp;
+ ip = (const struct ip *)bp;
ndo->ndo_snaplen = ndo->ndo_snapend - bp;
snapend_save = ndo->ndo_snapend;
ip_print(ndo, bp, EXTRACT_16BITS(&ip->ip_len));
@@ -626,11 +626,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
hlen));
hlen -= 4; /* subtract common header size */
- obj_tptr = (uint8_t *)ext_dp->icmp_ext_data;
+ obj_tptr = (const uint8_t *)ext_dp->icmp_ext_data;
while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
- icmp_mpls_ext_object_header = (struct icmp_mpls_ext_object_header_t *)obj_tptr;
+ icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
ND_TCHECK(*icmp_mpls_ext_object_header);
obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length);
obj_class_num = icmp_mpls_ext_object_header->class_num;
diff --git a/print-icmp6.c b/print-icmp6.c
index 279ca575..4584f5a4 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -624,7 +624,7 @@ print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l)
static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
u_int len)
{
- return nextproto6_cksum(ip6, (const uint8_t *)(void *)icp, len, len,
+ return nextproto6_cksum(ip6, (const uint8_t *)(const void *)icp, len, len,
IPPROTO_ICMPV6);
}
@@ -677,7 +677,7 @@ rpl_dio_printopt(netdissect_options *ndo,
ND_TCHECK(opt->rpl_dio_len);
while((opt->rpl_dio_type == RPL_OPT_PAD0 &&
- (u_char *)opt < ndo->ndo_snapend) ||
+ (const u_char *)opt < ndo->ndo_snapend) ||
ND_TTEST2(*opt,(opt->rpl_dio_len+2))) {
unsigned int optlen = opt->rpl_dio_len+2;
@@ -693,11 +693,11 @@ rpl_dio_printopt(netdissect_options *ndo,
if(paylen > length) paylen = length;
hex_print(ndo,
" ",
- ((uint8_t *)opt) + RPL_DIO_GENOPTION_LEN, /* content of DIO option */
+ ((const uint8_t *)opt) + RPL_DIO_GENOPTION_LEN, /* content of DIO option */
paylen);
}
}
- opt = (struct rpl_dio_genoption *)(((char *)opt) + optlen);
+ opt = (const struct rpl_dio_genoption *)(((const char *)opt) + optlen);
length -= optlen;
}
return;
@@ -710,7 +710,7 @@ static void
rpl_dio_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
- const struct nd_rpl_dio *dio = (struct nd_rpl_dio *)bp;
+ const struct nd_rpl_dio *dio = (const struct nd_rpl_dio *)bp;
char dagid_str[65];
ND_TCHECK(*dio);
@@ -726,7 +726,7 @@ rpl_dio_print(netdissect_options *ndo,
RPL_DIO_PRF(dio->rpl_mopprf)));
if(ndo->ndo_vflag > 1) {
- struct rpl_dio_genoption *opt = (struct rpl_dio_genoption *)&dio[1];
+ const struct rpl_dio_genoption *opt = (const struct rpl_dio_genoption *)&dio[1];
rpl_dio_printopt(ndo, opt, length);
}
return;
@@ -739,7 +739,7 @@ static void
rpl_dao_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
- const struct nd_rpl_dao *dao = (struct nd_rpl_dao *)bp;
+ const struct nd_rpl_dao *dao = (const struct nd_rpl_dao *)bp;
char dagid_str[65];
ND_TCHECK(*dao);
@@ -767,7 +767,7 @@ rpl_dao_print(netdissect_options *ndo,
dao->rpl_flags));
if(ndo->ndo_vflag > 1) {
- const struct rpl_dio_genoption *opt = (struct rpl_dio_genoption *)bp;
+ const struct rpl_dio_genoption *opt = (const struct rpl_dio_genoption *)bp;
rpl_dio_printopt(ndo, opt, length);
}
return;
@@ -785,7 +785,7 @@ static void
rpl_daoack_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
- const struct nd_rpl_daoack *daoack = (struct nd_rpl_daoack *)bp;
+ const struct nd_rpl_daoack *daoack = (const struct nd_rpl_daoack *)bp;
char dagid_str[65];
ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN);
@@ -812,7 +812,7 @@ rpl_daoack_print(netdissect_options *ndo,
/* no officially defined options for DAOACK, but print any we find */
if(ndo->ndo_vflag > 1) {
- const struct rpl_dio_genoption *opt = (struct rpl_dio_genoption *)bp;
+ const struct rpl_dio_genoption *opt = (const struct rpl_dio_genoption *)bp;
rpl_dio_printopt(ndo, opt, length);
}
return;
@@ -896,9 +896,9 @@ icmp6_print(netdissect_options *ndo,
const u_char *ep;
u_int prot;
- dp = (struct icmp6_hdr *)bp;
- ip = (struct ip6_hdr *)bp2;
- oip = (struct ip6_hdr *)(dp + 1);
+ dp = (const struct icmp6_hdr *)bp;
+ ip = (const struct ip6_hdr *)bp2;
+ oip = (const struct ip6_hdr *)(dp + 1);
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
@@ -948,7 +948,7 @@ icmp6_print(netdissect_options *ndo,
ip6addr_string(ndo, &oip->ip6_src)));
break;
case ICMP6_DST_UNREACH_NOPORT:
- if ((ouh = get_upperlayer(ndo, (u_char *)oip, &prot))
+ if ((ouh = get_upperlayer(ndo, (const u_char *)oip, &prot))
== NULL)
goto trunc;
@@ -1047,9 +1047,9 @@ icmp6_print(netdissect_options *ndo,
case ND_ROUTER_ADVERT:
#define RTADVLEN 16
if (ndo->ndo_vflag) {
- struct nd_router_advert *p;
+ const struct nd_router_advert *p;
- p = (struct nd_router_advert *)dp;
+ p = (const struct nd_router_advert *)dp;
ND_TCHECK(p->nd_ra_retransmit);
ND_PRINT((ndo,"\n\thop limit %u, Flags [%s]" \
", pref %s, router lifetime %us, reachable time %us, retrans time %us",
@@ -1066,8 +1066,8 @@ icmp6_print(netdissect_options *ndo,
break;
case ND_NEIGHBOR_SOLICIT:
{
- struct nd_neighbor_solicit *p;
- p = (struct nd_neighbor_solicit *)dp;
+ const struct nd_neighbor_solicit *p;
+ p = (const struct nd_neighbor_solicit *)dp;
ND_TCHECK(p->nd_ns_target);
ND_PRINT((ndo,", who has %s", ip6addr_string(ndo, &p->nd_ns_target)));
if (ndo->ndo_vflag) {
@@ -1079,9 +1079,9 @@ icmp6_print(netdissect_options *ndo,
break;
case ND_NEIGHBOR_ADVERT:
{
- struct nd_neighbor_advert *p;
+ const struct nd_neighbor_advert *p;
- p = (struct nd_neighbor_advert *)dp;
+ p = (const struct nd_neighbor_advert *)dp;
ND_TCHECK(p->nd_na_target);
ND_PRINT((ndo,", tgt is %s",
ip6addr_string(ndo, &p->nd_na_target)));
@@ -1098,7 +1098,7 @@ icmp6_print(netdissect_options *ndo,
}
break;
case ND_REDIRECT:
-#define RDR(i) ((struct nd_redirect *)(i))
+#define RDR(i) ((const struct nd_redirect *)(i))
ND_TCHECK(RDR(dp)->nd_rd_dst);
ND_PRINT((ndo,", %s", getname6(ndo, (const u_char *)&RDR(dp)->nd_rd_dst)));
ND_TCHECK(RDR(dp)->nd_rd_target);
@@ -1132,14 +1132,14 @@ icmp6_print(netdissect_options *ndo,
break;
case ICMP6_HADISCOV_REPLY:
if (ndo->ndo_vflag) {
- struct in6_addr *in6;
- u_char *cp;
+ const struct in6_addr *in6;
+ const u_char *cp;
ND_TCHECK(dp->icmp6_data16[0]);
ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
- cp = (u_char *)dp + length;
- in6 = (struct in6_addr *)(dp + 1);
- for (; (u_char *)in6 < cp; in6++) {
+ cp = (const u_char *)dp + length;
+ in6 = (const struct in6_addr *)(dp + 1);
+ for (; (const u_char *)in6 < cp; in6++) {
ND_TCHECK(*in6);
ND_PRINT((ndo,", %s", ip6addr_string(ndo, in6)));
}
@@ -1181,7 +1181,7 @@ static const struct udphdr *
get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
{
const u_char *ep;
- const struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
+ const struct ip6_hdr *ip6 = (const struct ip6_hdr *)bp;
const struct udphdr *uh;
const struct ip6_hbh *hbh;
const struct ip6_frag *fragh;
@@ -1204,7 +1204,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
switch(nh) {
case IPPROTO_UDP:
case IPPROTO_TCP:
- uh = (struct udphdr *)bp;
+ uh = (const struct udphdr *)bp;
if (ND_TTEST(uh->uh_dport)) {
*prot = nh;
return(uh);
@@ -1216,7 +1216,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
case IPPROTO_HOPOPTS:
case IPPROTO_DSTOPTS:
case IPPROTO_ROUTING:
- hbh = (struct ip6_hbh *)bp;
+ hbh = (const struct ip6_hbh *)bp;
if (!ND_TTEST(hbh->ip6h_len))
return(NULL);
nh = hbh->ip6h_nxt;
@@ -1224,7 +1224,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
break;
case IPPROTO_FRAGMENT: /* this should be odd, but try anyway */
- fragh = (struct ip6_frag *)bp;
+ fragh = (const struct ip6_frag *)bp;
if (!ND_TTEST(fragh->ip6f_offlg))
return(NULL);
/* fragments with non-zero offset are meaningless */
@@ -1235,7 +1235,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
break;
case IPPROTO_AH:
- ah = (struct ah *)bp;
+ ah = (const struct ah *)bp;
if (!ND_TTEST(ah->ah_len))
return(NULL);
nh = ah->ah_nxt;
@@ -1263,18 +1263,19 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
const struct nd_opt_homeagent_info *oph;
const struct nd_opt_route_info *opri;
const u_char *cp, *ep, *domp;
- struct in6_addr in6, *in6p;
+ struct in6_addr in6;
+ const struct in6_addr *in6p;
size_t l;
u_int i;
-#define ECHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) return
+#define ECHECK(var) if ((const u_char *)&(var) > ep - sizeof(var)) return
cp = bp;
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
while (cp < ep) {
- op = (struct nd_opt_hdr *)cp;
+ op = (const struct nd_opt_hdr *)cp;
ECHECK(op->nd_opt_len);
if (resid <= 0)
@@ -1300,7 +1301,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
print_lladdr(ndo, cp + 2, l);
break;
case ND_OPT_PREFIX_INFORMATION:
- opp = (struct nd_opt_prefix_info *)op;
+ opp = (const struct nd_opt_prefix_info *)op;
ND_TCHECK(opp->nd_opt_pi_prefix);
ND_PRINT((ndo,"%s/%u%s, Flags [%s], valid time %s",
ip6addr_string(ndo, &opp->nd_opt_pi_prefix),
@@ -1315,14 +1316,14 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
/* xxx */
break;
case ND_OPT_MTU:
- opm = (struct nd_opt_mtu *)op;
+ opm = (const struct nd_opt_mtu *)op;
ND_TCHECK(opm->nd_opt_mtu_mtu);
ND_PRINT((ndo," %u%s",
EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
(op->nd_opt_len != 1) ? "bad option length" : "" ));
break;
case ND_OPT_RDNSS:
- oprd = (struct nd_opt_rdnss *)op;
+ oprd = (const struct nd_opt_rdnss *)op;
l = (op->nd_opt_len - 1) / 2;
ND_PRINT((ndo," lifetime %us,",
EXTRACT_32BITS(&oprd->nd_opt_rdnss_lifetime)));
@@ -1333,7 +1334,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
}
break;
case ND_OPT_DNSSL:
- opds = (struct nd_opt_dnssl *)op;
+ opds = (const struct nd_opt_dnssl *)op;
ND_PRINT((ndo," lifetime %us, domain(s):",
EXTRACT_32BITS(&opds->nd_opt_dnssl_lifetime)));
domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
@@ -1345,22 +1346,22 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
}
break;
case ND_OPT_ADVINTERVAL:
- opa = (struct nd_opt_advinterval *)op;
+ opa = (const struct nd_opt_advinterval *)op;
ND_TCHECK(opa->nd_opt_adv_interval);
ND_PRINT((ndo," %ums", EXTRACT_32BITS(&opa->nd_opt_adv_interval)));
break;
case ND_OPT_HOMEAGENT_INFO:
- oph = (struct nd_opt_homeagent_info *)op;
+ oph = (const struct nd_opt_homeagent_info *)op;
ND_TCHECK(oph->nd_opt_hai_lifetime);
ND_PRINT((ndo," preference %u, lifetime %u",
EXTRACT_16BITS(&oph->nd_opt_hai_preference),
EXTRACT_16BITS(&oph->nd_opt_hai_lifetime)));
break;
case ND_OPT_ROUTE_INFO:
- opri = (struct nd_opt_route_info *)op;
+ opri = (const struct nd_opt_route_info *)op;
ND_TCHECK(opri->nd_opt_rti_lifetime);
memset(&in6, 0, sizeof(in6));
- in6p = (struct in6_addr *)(opri + 1);
+ in6p = (const struct in6_addr *)(opri + 1);
switch (op->nd_opt_len) {
case 1:
break;
@@ -1406,13 +1407,13 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
static void
mld6_print(netdissect_options *ndo, const u_char *bp)
{
- const struct mld6_hdr *mp = (struct mld6_hdr *)bp;
+ const struct mld6_hdr *mp = (const struct mld6_hdr *)bp;
const u_char *ep;
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
- if ((u_char *)mp + sizeof(*mp) > ep)
+ if ((const u_char *)mp + sizeof(*mp) > ep)
return;
ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay)));
@@ -1422,7 +1423,7 @@ mld6_print(netdissect_options *ndo, const u_char *bp)
static void
mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
{
- struct icmp6_hdr *icp = (struct icmp6_hdr *) bp;
+ const struct icmp6_hdr *icp = (const struct icmp6_hdr *) bp;
u_int group, nsrcs, ngroups;
u_int i, j;
@@ -1480,7 +1481,7 @@ trunc:
static void
mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
{
- struct icmp6_hdr *icp = (struct icmp6_hdr *) bp;
+ const struct icmp6_hdr *icp = (const struct icmp6_hdr *) bp;
u_int mrc;
int mrt, qqi;
u_int nsrcs;
@@ -1590,8 +1591,8 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
if (ep < bp)
return;
- dp = (struct icmp6_hdr *)bp;
- ni6 = (struct icmp6_nodeinfo *)bp;
+ dp = (const struct icmp6_hdr *)bp;
+ ni6 = (const struct icmp6_nodeinfo *)bp;
siz = ep - bp;
switch (ni6->ni_type) {
@@ -1604,7 +1605,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
ND_PRINT((ndo," node information query"));
ND_TCHECK2(*dp, sizeof(*ni6));
- ni6 = (struct icmp6_nodeinfo *)dp;
+ ni6 = (const struct icmp6_nodeinfo *)dp;
ND_PRINT((ndo," (")); /*)*/
switch (EXTRACT_16BITS(&ni6->ni_qtype)) {
case NI_QTYPE_NOOP:
@@ -1715,7 +1716,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
needcomma = 0;
- ni6 = (struct icmp6_nodeinfo *)dp;
+ ni6 = (const struct icmp6_nodeinfo *)dp;
ND_PRINT((ndo," node information reply"));
ND_PRINT((ndo," (")); /*)*/
switch (ni6->ni_code) {
@@ -1832,14 +1833,14 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
{
const struct icmp6_router_renum *rr6;
const char *cp;
- struct rr_pco_match *match;
- struct rr_pco_use *use;
+ const struct rr_pco_match *match;
+ const struct rr_pco_use *use;
char hbuf[NI_MAXHOST];
int n;
if (ep < bp)
return;
- rr6 = (struct icmp6_router_renum *)bp;
+ rr6 = (const struct icmp6_router_renum *)bp;
cp = (const char *)(rr6 + 1);
ND_TCHECK(rr6->rr_reserved);
@@ -1880,7 +1881,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
}
if (rr6->rr_code == ICMP6_ROUTER_RENUMBERING_COMMAND) {
- match = (struct rr_pco_match *)cp;
+ match = (const struct rr_pco_match *)cp;
cp = (const char *)(match + 1);
ND_TCHECK(match->rpm_prefix);
@@ -1914,7 +1915,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
goto trunc;
n /= 4;
while (n-- > 0) {
- use = (struct rr_pco_use *)cp;
+ use = (const struct rr_pco_use *)cp;
cp = (const char *)(use + 1);
ND_TCHECK(use->rpu_prefix);
diff --git a/print-igrp.c b/print-igrp.c
index 7f4f1302..9b59dc5a 100644
--- a/print-igrp.c
+++ b/print-igrp.c
@@ -64,7 +64,7 @@ struct igrprte {
#define IGRP_RTE_SIZE 14 /* don't believe sizeof ! */
static void
-igrp_entry_print(netdissect_options *ndo, register struct igrprte *igr,
+igrp_entry_print(netdissect_options *ndo, register const struct igrprte *igr,
register int is_interior, register int is_exterior)
{
register u_int delay, bandwidth;
@@ -102,12 +102,12 @@ static const struct tok op2str[] = {
void
igrp_print(netdissect_options *ndo, register const u_char *bp, u_int length)
{
- register struct igrphdr *hdr;
- register u_char *cp;
+ register const struct igrphdr *hdr;
+ register const u_char *cp;
u_int nint, nsys, next;
- hdr = (struct igrphdr *)bp;
- cp = (u_char *)(hdr + 1);
+ hdr = (const struct igrphdr *)bp;
+ cp = (const u_char *)(hdr + 1);
ND_PRINT((ndo, "igrp:"));
/* Header */
@@ -129,15 +129,15 @@ igrp_print(netdissect_options *ndo, register const u_char *bp, u_int length)
while (length >= IGRP_RTE_SIZE) {
if (nint > 0) {
ND_TCHECK2(*cp, IGRP_RTE_SIZE);
- igrp_entry_print(ndo, (struct igrprte *)cp, 1, 0);
+ igrp_entry_print(ndo, (const struct igrprte *)cp, 1, 0);
--nint;
} else if (nsys > 0) {
ND_TCHECK2(*cp, IGRP_RTE_SIZE);
- igrp_entry_print(ndo, (struct igrprte *)cp, 0, 0);
+ igrp_entry_print(ndo, (const struct igrprte *)cp, 0, 0);
--nsys;
} else if (next > 0) {
ND_TCHECK2(*cp, IGRP_RTE_SIZE);
- igrp_entry_print(ndo, (struct igrprte *)cp, 0, 1);
+ igrp_entry_print(ndo, (const struct igrprte *)cp, 0, 1);
--next;
} else {
ND_PRINT((ndo, " [extra bytes %d]", length));
diff --git a/print-ip.c b/print-ip.c
index dddb5965..bdead1fa 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -614,12 +614,12 @@ ip_print(netdissect_options *ndo,
if ((hlen - sizeof(struct ip)) > 0) {
ND_PRINT((ndo, ", options ("));
- ip_optprint(ndo, (u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
+ ip_optprint(ndo, (const u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
ND_PRINT((ndo, ")"));
}
- if (!ndo->ndo_Kflag && (u_char *)ipds->ip + hlen <= ndo->ndo_snapend) {
- vec[0].ptr = (const uint8_t *)(void *)ipds->ip;
+ if (!ndo->ndo_Kflag && (const u_char *)ipds->ip + hlen <= ndo->ndo_snapend) {
+ vec[0].ptr = (const uint8_t *)(const void *)ipds->ip;
vec[0].len = hlen;
sum = in_cksum(vec, 1);
if (sum != 0) {
diff --git a/print-ip6opts.c b/print-ip6opts.c
index 355c37a5..b1af8f86 100644
--- a/print-ip6opts.c
+++ b/print-ip6opts.c
@@ -172,7 +172,7 @@ trunc:
int
hbhopt_print(netdissect_options *ndo, register const u_char *bp)
{
- const struct ip6_hbh *dp = (struct ip6_hbh *)bp;
+ const struct ip6_hbh *dp = (const struct ip6_hbh *)bp;
int hbhlen = 0;
ND_TCHECK(dp->ip6h_len);
@@ -192,7 +192,7 @@ hbhopt_print(netdissect_options *ndo, register const u_char *bp)
int
dstopt_print(netdissect_options *ndo, register const u_char *bp)
{
- const struct ip6_dest *dp = (struct ip6_dest *)bp;
+ const struct ip6_dest *dp = (const struct ip6_dest *)bp;
int dstoptlen = 0;
ND_TCHECK(dp->ip6d_len);
diff --git a/print-ipcomp.c b/print-ipcomp.c
index 2504bfd9..633de9be 100644
--- a/print-ipcomp.c
+++ b/print-ipcomp.c
@@ -48,13 +48,13 @@ ipcomp_print(netdissect_options *ndo, register const u_char *bp, int *nhdr _U_)
int advance;
#endif
- ipcomp = (struct ipcomp *)bp;
+ ipcomp = (const struct ipcomp *)bp;
cpi = EXTRACT_16BITS(&ipcomp->comp_cpi);
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
- if ((u_char *)(ipcomp + 1) >= ep - sizeof(struct ipcomp)) {
+ if ((const u_char *)(ipcomp + 1) >= ep - sizeof(struct ipcomp)) {
ND_PRINT((ndo, "[|IPCOMP]"));
goto fail;
}
diff --git a/print-ipnet.c b/print-ipnet.c
index 6abc5c80..20ebbfd3 100644
--- a/print-ipnet.c
+++ b/print-ipnet.c
@@ -54,7 +54,7 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
static void
ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
- ipnet_hdr_t *hdr;
+ const ipnet_hdr_t *hdr;
if (caplen < sizeof(ipnet_hdr_t)) {
ND_PRINT((ndo, "[|ipnet]"));
@@ -66,7 +66,7 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
length -= sizeof(ipnet_hdr_t);
caplen -= sizeof(ipnet_hdr_t);
- hdr = (ipnet_hdr_t *)p;
+ hdr = (const ipnet_hdr_t *)p;
p += sizeof(ipnet_hdr_t);
switch (hdr->iph_family) {
@@ -81,7 +81,7 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
default:
if (!ndo->ndo_eflag)
- ipnet_hdr_print(ndo, (u_char *)hdr,
+ ipnet_hdr_print(ndo, (const u_char *)hdr,
length + sizeof(ipnet_hdr_t));
if (!ndo->ndo_suppress_default_print)
diff --git a/print-ipx.c b/print-ipx.c
index 12ec7dcf..b24bbd2b 100644
--- a/print-ipx.c
+++ b/print-ipx.c
@@ -88,7 +88,7 @@ ipx_print(netdissect_options *ndo, const u_char *p, u_int length)
ND_TCHECK(ipx->length);
length = EXTRACT_16BITS(&ipx->length);
- ipx_decode(ndo, ipx, (u_char *)ipx + ipxSize, length - ipxSize);
+ ipx_decode(ndo, ipx, p + ipxSize, length - ipxSize);
return;
trunc:
ND_PRINT((ndo, "[|ipx %d]", length));
@@ -116,10 +116,10 @@ ipx_decode(netdissect_options *ndo, const struct ipxHdr *ipx, const u_char *data
ND_PRINT((ndo, "ipx-ncp %d", length));
break;
case IPX_SKT_SAP:
- ipx_sap_print(ndo, (u_short *)datap, length);
+ ipx_sap_print(ndo, (const u_short *)datap, length);
break;
case IPX_SKT_RIP:
- ipx_rip_print(ndo, (u_short *)datap, length);
+ ipx_rip_print(ndo, (const u_short *)datap, length);
break;
case IPX_SKT_NETBIOS:
ND_PRINT((ndo, "ipx-netbios %d", length));
@@ -177,13 +177,13 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length)
for (i = 0; i < 8 && length > 0; i++) {
ND_TCHECK(ipx[0]);
ND_PRINT((ndo, " %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0])))));
- if (fn_printzp(ndo, (u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
+ if (fn_printzp(ndo, (const u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
ND_PRINT((ndo, "'"));
goto trunc;
}
ND_TCHECK2(ipx[25], 10);
ND_PRINT((ndo, "' addr %s",
- ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27])));
+ ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (const u_char *)&ipx[27])));
ipx += 32;
length -= 64;
}
diff --git a/print-isakmp.c b/print-isakmp.c
index 5267ad24..96e89c3d 100644
--- a/print-isakmp.c
+++ b/print-isakmp.c
@@ -741,7 +741,7 @@ static const char *etypestr[] = {
#define ETYPESTR(x) STR_OR_ID(x, etypestr)
#define CHECKLEN(p, np) \
- if (ep < (u_char *)(p)) { \
+ if (ep < (const u_char *)(p)) { \
ND_PRINT((ndo," [|%s]", NPSTR(np))); \
goto done; \
}
@@ -752,7 +752,7 @@ static const char *etypestr[] = {
? npfunc[(x)] : NULL)
static int
-iszero(u_char *p, size_t l)
+iszero(const u_char *p, size_t l)
{
while (l--) {
if (*p++)
@@ -780,9 +780,9 @@ static void
cookie_record(cookie_t *in, const u_char *bp2)
{
int i;
- struct ip *ip;
+ const struct ip *ip;
#ifdef INET6
- struct ip6_hdr *ip6;
+ const struct ip6_hdr *ip6;
#endif
i = cookie_find(in);
@@ -791,7 +791,7 @@ cookie_record(cookie_t *in, const u_char *bp2)
return;
}
- ip = (struct ip *)bp2;
+ ip = (const struct ip *)bp2;
switch (IP_V(ip)) {
case 4:
cookiecache[ninitiator].version = 4;
@@ -800,7 +800,7 @@ cookie_record(cookie_t *in, const u_char *bp2)
break;
#ifdef INET6
case 6:
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
cookiecache[ninitiator].version = 6;
UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in6, &ip6->ip6_src, sizeof(struct in6_addr));
UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6, &ip6->ip6_dst, sizeof(struct in6_addr));
@@ -818,12 +818,12 @@ cookie_record(cookie_t *in, const u_char *bp2)
static int
cookie_sidecheck(int i, const u_char *bp2, int initiator)
{
- struct ip *ip;
+ const struct ip *ip;
#ifdef INET6
- struct ip6_hdr *ip6;
+ const struct ip6_hdr *ip6;
#endif
- ip = (struct ip *)bp2;
+ ip = (const struct ip *)bp2;
switch (IP_V(ip)) {
case 4:
if (cookiecache[i].version != 4)
@@ -840,7 +840,7 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
case 6:
if (cookiecache[i].version != 6)
return 0;
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
if (initiator) {
if (UNALIGNED_MEMCMP(&ip6->ip6_src, &cookiecache[i].iaddr.in6, sizeof(struct in6_addr)) == 0)
return 1;
@@ -858,18 +858,18 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
}
static void
-hexprint(netdissect_options *ndo, caddr_t loc, size_t len)
+hexprint(netdissect_options *ndo, const uint8_t *loc, size_t len)
{
- u_char *p;
+ const uint8_t *p;
size_t i;
- p = (u_char *)loc;
+ p = loc;
for (i = 0; i < len; i++)
ND_PRINT((ndo,"%02x", p[i] & 0xff));
}
static int
-rawprint(netdissect_options *ndo, caddr_t loc, size_t len)
+rawprint(netdissect_options *ndo, const uint8_t *loc, size_t len)
{
ND_TCHECK2(*loc, len);
@@ -901,10 +901,10 @@ static int ike_show_somedata(netdissect_options *ndo,
}
ND_PRINT((ndo," data=("));
- if(!rawprint(ndo, (caddr_t)(cp), len)) goto trunc;
+ if(!rawprint(ndo, (const uint8_t *)(cp), len)) goto trunc;
ND_PRINT((ndo, "..."));
if(elen) {
- if(!rawprint(ndo, (caddr_t)(end), elen)) goto trunc;
+ if(!rawprint(ndo, (const uint8_t *)(end), elen)) goto trunc;
}
ND_PRINT((ndo,")"));
return 1;
@@ -948,10 +948,10 @@ ikev1_attrmap_print(netdissect_options *ndo,
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
ND_PRINT((ndo,"%s", map[t].value[v]));
else
- rawprint(ndo, (caddr_t)&p[2], 2);
+ rawprint(ndo, (const uint8_t *)&p[2], 2);
} else {
ND_PRINT((ndo,"len=%d value=", EXTRACT_16BITS(&p[2])));
- rawprint(ndo, (caddr_t)&p[4], EXTRACT_16BITS(&p[2]));
+ rawprint(ndo, (const uint8_t *)&p[4], EXTRACT_16BITS(&p[2]));
}
ND_PRINT((ndo,")"));
return p + totlen;
@@ -978,10 +978,10 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep)
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
t = p[2];
- rawprint(ndo, (caddr_t)&p[2], 2);
+ rawprint(ndo, (const uint8_t *)&p[2], 2);
} else {
ND_PRINT((ndo,"len=%d value=", EXTRACT_16BITS(&p[2])));
- rawprint(ndo, (caddr_t)&p[4], EXTRACT_16BITS(&p[2]));
+ rawprint(ndo, (const uint8_t *)&p[4], EXTRACT_16BITS(&p[2]));
}
ND_PRINT((ndo,")"));
return p + totlen;
@@ -1002,7 +1002,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_SA)));
- p = (struct ikev1_pl_sa *)ext;
+ p = (const struct ikev1_pl_sa *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&sa, ext, sizeof(sa));
doi = ntohl(sa.doi);
@@ -1010,7 +1010,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
if (doi != 1) {
ND_PRINT((ndo," doi=%d", doi));
ND_PRINT((ndo," situation=%u", (uint32_t)ntohl(sa.sit)));
- return (u_char *)(p + 1);
+ return (const u_char *)(p + 1);
}
ND_PRINT((ndo," doi=ipsec"));
@@ -1027,7 +1027,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
if (sit & 0x04)
ND_PRINT((ndo,"%sintegrity", t ? "+" : ""));
- np = (u_char *)ext + sizeof(sa);
+ np = (const u_char *)ext + sizeof(sa);
if (sit != 0x01) {
ND_TCHECK2(*(ext + 1), sizeof(ident));
UNALIGNED_MEMCPY(&ident, ext + 1, sizeof(ident));
@@ -1035,7 +1035,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
np += sizeof(ident);
}
- ext = (struct isakmp_gen *)np;
+ ext = (const struct isakmp_gen *)np;
ND_TCHECK(*ext);
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_P, ext, ep, phase, doi, proto0,
@@ -1059,18 +1059,18 @@ ikev1_p_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_P)));
- p = (struct ikev1_pl_p *)ext;
+ p = (const struct ikev1_pl_p *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&prop, ext, sizeof(prop));
ND_PRINT((ndo," #%d protoid=%s transform=%d",
prop.p_no, PROTOIDSTR(prop.prot_id), prop.num_t));
if (prop.spi_size) {
ND_PRINT((ndo," spi="));
- if (!rawprint(ndo, (caddr_t)(p + 1), prop.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)(p + 1), prop.spi_size))
goto trunc;
}
- ext = (struct isakmp_gen *)((u_char *)(p + 1) + prop.spi_size);
+ ext = (const struct isakmp_gen *)((const u_char *)(p + 1) + prop.spi_size);
ND_TCHECK(*ext);
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
@@ -1226,7 +1226,7 @@ ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_T)));
- p = (struct ikev1_pl_t *)ext;
+ p = (const struct ikev1_pl_t *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&t, ext, sizeof(t));
@@ -1262,8 +1262,8 @@ ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," #%d id=%s ", t.t_no, idstr));
else
ND_PRINT((ndo," #%d id=%d ", t.t_no, t.t_id));
- cp = (u_char *)(p + 1);
- ep2 = (u_char *)p + item_len;
+ cp = (const u_char *)(p + 1);
+ ep2 = (const u_char *)p + item_len;
while (cp < ep && cp < ep2) {
if (map && nmap) {
cp = ikev1_attrmap_print(ndo, cp, (ep < ep2) ? ep : ep2,
@@ -1294,10 +1294,10 @@ ikev1_ke_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," key len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_KE)));
return NULL;
@@ -1325,11 +1325,11 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_ID)));
- p = (struct ikev1_pl_id *)ext;
+ p = (const struct ikev1_pl_id *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&id, ext, sizeof(id));
if (sizeof(*p) < item_len) {
- data = (u_char *)(p + 1);
+ data = (const u_char *)(p + 1);
len = item_len - sizeof(*p);
} else {
data = NULL;
@@ -1358,7 +1358,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
struct ipsecdoi_id id;
struct protoent *pe;
- p = (struct ipsecdoi_id *)ext;
+ p = (const struct ipsecdoi_id *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&id, ext, sizeof(id));
ND_PRINT((ndo," idtype=%s", STR_OR_ID(id.type, ipsecidtypestr)));
@@ -1420,7 +1420,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
if (len < 20)
ND_PRINT((ndo," len=%d [bad: < 20]", len));
else {
- mask = (u_char *)(data + sizeof(struct in6_addr));
+ mask = (const u_char *)(data + sizeof(struct in6_addr));
/*XXX*/
ND_PRINT((ndo," len=%d %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len,
ip6addr_string(ndo, data),
@@ -1467,11 +1467,11 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," len=%d", len));
if (2 < ndo->ndo_vflag) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)data, len))
+ if (!rawprint(ndo, (const uint8_t *)data, len))
goto trunc;
}
}
- return (u_char *)ext + item_len;
+ return (const u_char *)ext + item_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_ID)));
return NULL;
@@ -1494,17 +1494,17 @@ ikev1_cert_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_CERT)));
- p = (struct ikev1_pl_cert *)ext;
+ p = (const struct ikev1_pl_cert *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&cert, ext, sizeof(cert));
ND_PRINT((ndo," len=%d", item_len - 4));
ND_PRINT((ndo," type=%s", STR_OR_ID((cert.encode), certstr)));
if (2 < ndo->ndo_vflag && 4 < item_len) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), item_len - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), item_len - 4))
goto trunc;
}
- return (u_char *)ext + item_len;
+ return (const u_char *)ext + item_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_CERT)));
return NULL;
@@ -1526,17 +1526,17 @@ ikev1_cr_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_CR)));
- p = (struct ikev1_pl_cert *)ext;
+ p = (const struct ikev1_pl_cert *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&cert, ext, sizeof(cert));
ND_PRINT((ndo," len=%d", item_len - 4));
ND_PRINT((ndo," type=%s", STR_OR_ID((cert.encode), certstr)));
if (2 < ndo->ndo_vflag && 4 < item_len) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), item_len - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), item_len - 4))
goto trunc;
}
- return (u_char *)ext + item_len;
+ return (const u_char *)ext + item_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_CR)));
return NULL;
@@ -1557,10 +1557,10 @@ ikev1_hash_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_HASH)));
return NULL;
@@ -1581,10 +1581,10 @@ ikev1_sig_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_SIG)));
return NULL;
@@ -1607,14 +1607,14 @@ ikev1_nonce_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," n len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
} else if (1 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!ike_show_somedata(ndo, (u_char *)(caddr_t)(ext + 1), ep))
+ if (!ike_show_somedata(ndo, (const u_char *)(const uint8_t *)(ext + 1), ep))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_NONCE)));
return NULL;
@@ -1626,9 +1626,10 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
const u_char *ep, uint32_t phase, uint32_t doi0 _U_,
uint32_t proto0 _U_, int depth)
{
- struct ikev1_pl_n *p, n;
+ const struct ikev1_pl_n *p;
+ struct ikev1_pl_n n;
const u_char *cp;
- u_char *ep2;
+ const u_char *ep2;
uint32_t doi;
uint32_t proto;
static const char *notify_error_str[] = {
@@ -1679,7 +1680,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_N)));
- p = (struct ikev1_pl_n *)ext;
+ p = (const struct ikev1_pl_n *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&n, ext, sizeof(n));
doi = ntohl(n.doi);
@@ -1697,10 +1698,10 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," type=%s", numstr(ntohs(n.type))));
if (n.spi_size) {
ND_PRINT((ndo," spi="));
- if (!rawprint(ndo, (caddr_t)(p + 1), n.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)(p + 1), n.spi_size))
goto trunc;
}
- return (u_char *)(p + 1) + n.spi_size;
+ return (const u_char *)(p + 1) + n.spi_size;
}
ND_PRINT((ndo," doi=ipsec"));
@@ -1717,12 +1718,12 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," type=%s", numstr(ntohs(n.type))));
if (n.spi_size) {
ND_PRINT((ndo," spi="));
- if (!rawprint(ndo, (caddr_t)(p + 1), n.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)(p + 1), n.spi_size))
goto trunc;
}
- cp = (u_char *)(p + 1) + n.spi_size;
- ep2 = (u_char *)p + item_len;
+ cp = (const u_char *)(p + 1) + n.spi_size;
+ ep2 = (const u_char *)p + item_len;
if (cp < ep) {
ND_PRINT((ndo," orig=("));
@@ -1743,7 +1744,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
break;
case ISAKMP_NTYPE_NO_PROPOSAL_CHOSEN:
if (ikev1_sub_print(ndo, ISAKMP_NPTYPE_SA,
- (struct isakmp_gen *)cp, ep, phase, doi, proto,
+ (const struct isakmp_gen *)cp, ep, phase, doi, proto,
depth) == NULL)
return NULL;
break;
@@ -1755,7 +1756,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
}
ND_PRINT((ndo,")"));
}
- return (u_char *)ext + item_len;
+ return (const u_char *)ext + item_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_N)));
return NULL;
@@ -1776,7 +1777,7 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_D)));
- p = (struct ikev1_pl_d *)ext;
+ p = (const struct ikev1_pl_d *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&d, ext, sizeof(d));
doi = ntohl(d.doi);
@@ -1791,11 +1792,11 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," spilen=%u", d.spi_size));
ND_PRINT((ndo," nspi=%u", ntohs(d.num_spi)));
ND_PRINT((ndo," spi="));
- q = (uint8_t *)(p + 1);
+ q = (const uint8_t *)(p + 1);
for (i = 0; i < ntohs(d.num_spi); i++) {
if (i != 0)
ND_PRINT((ndo,","));
- if (!rawprint(ndo, (caddr_t)q, d.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)q, d.spi_size))
goto trunc;
q += d.spi_size;
}
@@ -1821,10 +1822,10 @@ ikev1_vid_print(netdissect_options *ndo, u_char tpay _U_,
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_VID)));
return NULL;
@@ -1855,10 +1856,10 @@ ikev2_gen_print(netdissect_options *ndo, u_char tpay,
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -1879,7 +1880,7 @@ ikev2_t_print(netdissect_options *ndo, u_char tpay _U_, int pcount,
size_t nmap;
const u_char *ep2;
- p = (struct ikev2_t *)ext;
+ p = (const struct ikev2_t *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&t, ext, sizeof(t));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_T), t.h.critical);
@@ -1925,8 +1926,8 @@ ikev2_t_print(netdissect_options *ndo, u_char tpay _U_, int pcount,
ND_PRINT((ndo," #%u type=%s id=%u ", pcount,
STR_OR_ID(t.t_type, ikev2_t_type_map),
t.t_id));
- cp = (u_char *)(p + 1);
- ep2 = (u_char *)p + item_len;
+ cp = (const u_char *)(p + 1);
+ ep2 = (const u_char *)p + item_len;
while (cp < ep && cp < ep2) {
if (map && nmap) {
cp = ikev1_attrmap_print(ndo, cp, (ep < ep2) ? ep : ep2,
@@ -1952,7 +1953,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
struct ikev2_p prop;
const u_char *cp;
- p = (struct ikev2_p *)ext;
+ p = (const struct ikev2_p *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&prop, ext, sizeof(prop));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), prop.h.critical);
@@ -1962,11 +1963,11 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
prop.num_t, ntohs(prop.h.len)));
if (prop.spi_size) {
ND_PRINT((ndo," spi="));
- if (!rawprint(ndo, (caddr_t)(p + 1), prop.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)(p + 1), prop.spi_size))
goto trunc;
}
- ext = (struct isakmp_gen *)((u_char *)(p + 1) + prop.spi_size);
+ ext = (const struct isakmp_gen *)((const u_char *)(p + 1) + prop.spi_size);
ND_TCHECK(*ext);
cp = ikev2_sub_print(ndo, NULL, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
@@ -2000,7 +2001,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
ext1+1, ep,
0, 0, 0, depth);
- return (u_char *)ext1 + osa_length;
+ return (const u_char *)ext1 + osa_length;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2014,9 +2015,9 @@ ikev2_ke_print(netdissect_options *ndo, u_char tpay,
uint32_t proto _U_, int depth _U_)
{
struct ikev2_ke ke;
- struct ikev2_ke *k;
+ const struct ikev2_ke *k;
- k = (struct ikev2_ke *)ext;
+ k = (const struct ikev2_ke *)ext;
ND_TCHECK(*ext);
UNALIGNED_MEMCPY(&ke, ext, sizeof(ke));
ikev2_pay_print(ndo, NPSTR(tpay), ke.h.critical);
@@ -2026,10 +2027,10 @@ ikev2_ke_print(netdissect_options *ndo, u_char tpay,
if (2 < ndo->ndo_vflag && 8 < ntohs(ke.h.len)) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(k + 1), ntohs(ke.h.len) - 8))
+ if (!rawprint(ndo, (const uint8_t *)(k + 1), ntohs(ke.h.len) - 8))
goto trunc;
}
- return (u_char *)ext + ntohs(ke.h.len);
+ return (const u_char *)ext + ntohs(ke.h.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2045,7 +2046,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
struct ikev2_id id;
int id_len, idtype_len, i;
unsigned int dumpascii, dumphex;
- unsigned char *typedata;
+ const unsigned char *typedata;
ND_TCHECK(*ext);
UNALIGNED_MEMCPY(&id, ext, sizeof(id));
@@ -2056,14 +2057,14 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
ND_PRINT((ndo," len=%d", id_len - 4));
if (2 < ndo->ndo_vflag && 4 < id_len) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), id_len - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), id_len - 4))
goto trunc;
}
idtype_len =id_len - sizeof(struct ikev2_id);
dumpascii = 0;
dumphex = 0;
- typedata = (unsigned char *)(ext)+sizeof(struct ikev2_id);
+ typedata = (const unsigned char *)(ext)+sizeof(struct ikev2_id);
switch(id.type) {
case ID_IPV4_ADDR:
@@ -2107,11 +2108,11 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
}
}
if(dumphex) {
- if (!rawprint(ndo, (caddr_t)typedata, idtype_len))
+ if (!rawprint(ndo, (const uint8_t *)typedata, idtype_len))
goto trunc;
}
- return (u_char *)ext + id_len;
+ return (const u_char *)ext + id_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2147,7 +2148,7 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay,
struct ikev2_auth a;
const char *v2_auth[]={ "invalid", "rsasig",
"shared-secret", "dsssig" };
- u_char *authdata = (u_char*)ext + sizeof(a);
+ const u_char *authdata = (const u_char*)ext + sizeof(a);
unsigned int len;
ND_TCHECK(*ext);
@@ -2160,14 +2161,14 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay,
if (1 < ndo->ndo_vflag && 4 < len) {
ND_PRINT((ndo," authdata=("));
- if (!rawprint(ndo, (caddr_t)authdata, len - sizeof(a)))
+ if (!rawprint(ndo, (const uint8_t *)authdata, len - sizeof(a)))
goto trunc;
ND_PRINT((ndo,") "));
} else if(ndo->ndo_vflag && 4 < len) {
if(!ike_show_somedata(ndo, authdata, ep)) goto trunc;
}
- return (u_char *)ext + len;
+ return (const u_char *)ext + len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2189,14 +2190,14 @@ ikev2_nonce_print(netdissect_options *ndo, u_char tpay,
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (1 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," nonce=("));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
ND_PRINT((ndo,") "));
} else if(ndo->ndo_vflag && 4 < ntohs(e.len)) {
if(!ike_show_somedata(ndo, (const u_char *)(ext+1), ep)) goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2210,13 +2211,14 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
uint32_t phase _U_, uint32_t doi _U_,
uint32_t proto _U_, int depth _U_)
{
- struct ikev2_n *p, n;
+ const struct ikev2_n *p;
+ struct ikev2_n n;
const u_char *cp;
u_char showspi, showdata, showsomedata;
const char *notify_name;
uint32_t type;
- p = (struct ikev2_n *)ext;
+ p = (const const struct ikev2_n *)ext;
ND_TCHECK(*p);
UNALIGNED_MEMCPY(&n, ext, sizeof(n));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_N), n.h.critical);
@@ -2383,11 +2385,11 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
if (showspi && n.spi_size) {
ND_PRINT((ndo," spi="));
- if (!rawprint(ndo, (caddr_t)(p + 1), n.spi_size))
+ if (!rawprint(ndo, (const uint8_t *)(p + 1), n.spi_size))
goto trunc;
}
- cp = (u_char *)(p + 1) + n.spi_size;
+ cp = (const u_char *)(p + 1) + n.spi_size;
if(3 < ndo->ndo_vflag) {
showdata = 1;
@@ -2395,7 +2397,7 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
if ((showdata || (showsomedata && ep-cp < 30)) && cp < ep) {
ND_PRINT((ndo," data=("));
- if (!rawprint(ndo, (caddr_t)(cp), ep - cp))
+ if (!rawprint(ndo, (const uint8_t *)(cp), ep - cp))
goto trunc;
ND_PRINT((ndo,")"));
@@ -2404,7 +2406,7 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
if(!ike_show_somedata(ndo, cp, ep)) goto trunc;
}
- return (u_char *)ext + item_len;
+ return (const u_char *)ext + item_len;
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_N)));
return NULL;
@@ -2445,10 +2447,10 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
}
if (2 < ndo->ndo_vflag && 4 < len) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.len) - 4))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
- return (u_char *)ext + ntohs(e.len);
+ return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
@@ -2491,7 +2493,7 @@ ikev2_e_print(netdissect_options *ndo,
int depth)
{
struct isakmp_gen e;
- u_char *dat;
+ const u_char *dat;
volatile int dlen;
ND_TCHECK(*ext);
@@ -2503,11 +2505,11 @@ ikev2_e_print(netdissect_options *ndo,
ND_PRINT((ndo," len=%d", dlen));
if (2 < ndo->ndo_vflag && 4 < dlen) {
ND_PRINT((ndo," "));
- if (!rawprint(ndo, (caddr_t)(ext + 1), dlen))
+ if (!rawprint(ndo, (const uint8_t *)(ext + 1), dlen))
goto trunc;
}
- dat = (u_char *)(ext+1);
+ dat = (const u_char *)(ext+1);
ND_TCHECK2(*dat, dlen);
#ifdef HAVE_LIBCRYPTO
@@ -2565,7 +2567,7 @@ ike_sub0_print(netdissect_options *ndo,
struct isakmp_gen e;
u_int item_len;
- cp = (u_char *)ext;
+ cp = (const u_char *)ext;
ND_TCHECK(*ext);
UNALIGNED_MEMCPY(&e, ext, sizeof(e));
@@ -2629,7 +2631,7 @@ ikev1_sub_print(netdissect_options *ndo,
}
np = e.np;
- ext = (struct isakmp_gen *)cp;
+ ext = (const struct isakmp_gen *)cp;
}
return cp;
trunc:
@@ -2667,7 +2669,7 @@ ikev1_print(netdissect_options *ndo,
i = cookie_find(&base->i_ck);
if (i < 0) {
- if (iszero((u_char *)&base->r_ck, sizeof(base->r_ck))) {
+ if (iszero((const u_char *)&base->r_ck, sizeof(base->r_ck))) {
/* the first packet */
ND_PRINT((ndo," I"));
if (bp2)
@@ -2706,7 +2708,7 @@ ikev1_print(netdissect_options *ndo,
CHECKLEN(p + 1, base->np);
np = base->np;
- ext = (struct isakmp_gen *)(p + 1);
+ ext = (const struct isakmp_gen *)(p + 1);
ikev1_sub_print(ndo, np, ext, ep, phase, 0, 0, 0);
}
@@ -2729,7 +2731,7 @@ ikev2_sub0_print(netdissect_options *ndo, struct isakmp *base,
struct isakmp_gen e;
u_int item_len;
- cp = (u_char *)ext;
+ cp = (const u_char *)ext;
ND_TCHECK(*ext);
UNALIGNED_MEMCPY(&e, ext, sizeof(e));
@@ -2807,7 +2809,7 @@ ikev2_sub_print(netdissect_options *ndo,
}
np = e.np;
- ext = (struct isakmp_gen *)cp;
+ ext = (const struct isakmp_gen *)cp;
}
return cp;
trunc:
@@ -2860,7 +2862,7 @@ ikev2_print(netdissect_options *ndo,
CHECKLEN(p + 1, base->np)
np = base->np;
- ext = (struct isakmp_gen *)(p + 1);
+ ext = (const struct isakmp_gen *)(p + 1);
ikev2_sub_print(ndo, base, np, ext, ep, phase, 0, 0, 0);
}
@@ -2894,7 +2896,7 @@ isakmp_print(netdissect_options *ndo,
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
- if ((struct isakmp *)ep < p + 1) {
+ if ((const struct isakmp *)ep < p + 1) {
ND_PRINT((ndo,"[|isakmp]"));
return;
}
@@ -2913,14 +2915,14 @@ isakmp_print(netdissect_options *ndo,
if (ndo->ndo_vflag) {
ND_PRINT((ndo," msgid "));
- hexprint(ndo, (caddr_t)&base.msgid, sizeof(base.msgid));
+ hexprint(ndo, (const uint8_t *)&base.msgid, sizeof(base.msgid));
}
if (1 < ndo->ndo_vflag) {
ND_PRINT((ndo," cookie "));
- hexprint(ndo, (caddr_t)&base.i_ck, sizeof(base.i_ck));
+ hexprint(ndo, (const uint8_t *)&base.i_ck, sizeof(base.i_ck));
ND_PRINT((ndo,"->"));
- hexprint(ndo, (caddr_t)&base.r_ck, sizeof(base.r_ck));
+ hexprint(ndo, (const uint8_t *)&base.r_ck, sizeof(base.r_ck));
}
ND_PRINT((ndo,":"));
diff --git a/print-juniper.c b/print-juniper.c
index 6ae5b6d8..d5fd79d0 100644
--- a/print-juniper.c
+++ b/print-juniper.c
@@ -513,7 +513,7 @@ juniper_es_print(netdissect_options *ndo,
return l2info.header_len;
p+=l2info.header_len;
- ih = (struct juniper_ipsec_header *)p;
+ ih = (const struct juniper_ipsec_header *)p;
switch (ih->type) {
case JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE:
@@ -582,7 +582,7 @@ juniper_monitor_print(netdissect_options *ndo,
return l2info.header_len;
p+=l2info.header_len;
- mh = (struct juniper_monitor_header *)p;
+ mh = (const struct juniper_monitor_header *)p;
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u, iif %u, pkt-type %u: ",
@@ -616,7 +616,7 @@ juniper_services_print(netdissect_options *ndo,
return l2info.header_len;
p+=l2info.header_len;
- sh = (struct juniper_services_header *)p;
+ sh = (const struct juniper_services_header *)p;
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
diff --git a/print-krb.c b/print-krb.c
index 3b4798c6..b57c12d8 100644
--- a/print-krb.c
+++ b/print-krb.c
@@ -155,7 +155,7 @@ krb4_print(netdissect_options *ndo,
#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp))
- kp = (struct krb *)cp;
+ kp = (const struct krb *)cp;
if ((&kp->type) >= ndo->ndo_snapend) {
ND_PRINT((ndo, "%s", tstr));
@@ -226,7 +226,7 @@ krb_print(netdissect_options *ndo,
{
register const struct krb *kp;
- kp = (struct krb *)dat;
+ kp = (const struct krb *)dat;
if (dat >= ndo->ndo_snapend) {
ND_PRINT((ndo, "%s", tstr));
diff --git a/print-l2tp.c b/print-l2tp.c
index 4ebc35ee..514eb2c5 100644
--- a/print-l2tp.c
+++ b/print-l2tp.c
@@ -297,7 +297,7 @@ print_32bits_val(netdissect_options *ndo, const uint32_t *dat)
static void
l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat)
{
- uint16_t *ptr = (uint16_t*)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u",
EXTRACT_16BITS(ptr))));
@@ -306,7 +306,7 @@ l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr))); ptr++; /* Result Code */
if (length > 2) { /* Error Code (opt) */
@@ -314,7 +314,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length)
}
if (length > 4) { /* Error Message (opt) */
ND_PRINT((ndo, " "));
- print_string(ndo, (u_char *)ptr, length - 4);
+ print_string(ndo, (const u_char *)ptr, length - 4);
}
}
@@ -328,7 +328,7 @@ l2tp_proto_ver_print(netdissect_options *ndo, const uint16_t *dat)
static void
l2tp_framing_cap_print(netdissect_options *ndo, const u_char *dat)
{
- uint32_t *ptr = (uint32_t *)dat;
+ const uint32_t *ptr = (const uint32_t *)dat;
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
@@ -341,7 +341,7 @@ l2tp_framing_cap_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_bearer_cap_print(netdissect_options *ndo, const u_char *dat)
{
- uint32_t *ptr = (uint32_t *)dat;
+ const uint32_t *ptr = (const uint32_t *)dat;
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
@@ -354,7 +354,7 @@ l2tp_bearer_cap_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_q931_cc_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
- print_16bits_val(ndo, (uint16_t *)dat);
+ print_16bits_val(ndo, (const uint16_t *)dat);
ND_PRINT((ndo, ", %02x", dat[2]));
if (length > 3) {
ND_PRINT((ndo, " "));
@@ -365,7 +365,7 @@ l2tp_q931_cc_print(netdissect_options *ndo, const u_char *dat, u_int length)
static void
l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)
{
- uint32_t *ptr = (uint32_t *)dat;
+ const uint32_t *ptr = (const uint32_t *)dat;
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
@@ -378,7 +378,7 @@ l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_framing_type_print(netdissect_options *ndo, const u_char *dat)
{
- uint32_t *ptr = (uint32_t *)dat;
+ const uint32_t *ptr = (const uint32_t *)dat;
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
@@ -397,7 +397,7 @@ l2tp_packet_proc_delay_print(netdissect_options *ndo)
static void
l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str,
"AuthType-#%u", EXTRACT_16BITS(ptr))));
@@ -406,7 +406,7 @@ l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_proxy_auth_id_print(netdissect_options *ndo, const u_char *dat)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK));
}
@@ -414,7 +414,7 @@ l2tp_proxy_auth_id_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_call_errors_print(netdissect_options *ndo, const u_char *dat)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
uint16_t val_h, val_l;
ptr++; /* skip "Reserved" */
@@ -447,7 +447,7 @@ l2tp_call_errors_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_accm_print(netdissect_options *ndo, const u_char *dat)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
uint16_t val_h, val_l;
ptr++; /* skip "Reserved" */
@@ -464,12 +464,12 @@ l2tp_accm_print(netdissect_options *ndo, const u_char *dat)
static void
l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
- uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%04x, ", EXTRACT_16BITS(ptr))); ptr++; /* Disconnect Code */
ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(ptr))); ptr++; /* Control Protocol Number */
ND_PRINT((ndo, "%s", tok2str(l2tp_cc_direction2str,
- "Direction-#%u", *((u_char *)ptr++))));
+ "Direction-#%u", *((const u_char *)ptr++))));
if (length > 5) {
ND_PRINT((ndo, " "));
@@ -481,7 +481,7 @@ static void
l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
{
u_int len;
- const uint16_t *ptr = (uint16_t *)dat;
+ const uint16_t *ptr = (const uint16_t *)dat;
uint16_t attr_type;
int hidden = FALSE;
@@ -522,7 +522,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_16BITS(ptr))); ptr++;
ND_PRINT((ndo, "ATTR%04x", EXTRACT_16BITS(ptr))); ptr++;
ND_PRINT((ndo, "("));
- print_octets(ndo, (u_char *)ptr, len-6);
+ print_octets(ndo, (const u_char *)ptr, len-6);
ND_PRINT((ndo, ")"));
} else {
/* IETF-defined Attributes */
@@ -535,22 +535,22 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
} else {
switch (attr_type) {
case L2TP_AVP_MSGTYPE:
- l2tp_msgtype_print(ndo, (u_char *)ptr);
+ l2tp_msgtype_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_RESULT_CODE:
- l2tp_result_code_print(ndo, (u_char *)ptr, len-6);
+ l2tp_result_code_print(ndo, (const u_char *)ptr, len-6);
break;
case L2TP_AVP_PROTO_VER:
l2tp_proto_ver_print(ndo, ptr);
break;
case L2TP_AVP_FRAMING_CAP:
- l2tp_framing_cap_print(ndo, (u_char *)ptr);
+ l2tp_framing_cap_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_BEARER_CAP:
- l2tp_bearer_cap_print(ndo, (u_char *)ptr);
+ l2tp_bearer_cap_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_TIE_BREAKER:
- print_octets(ndo, (u_char *)ptr, 8);
+ print_octets(ndo, (const u_char *)ptr, 8);
break;
case L2TP_AVP_FIRM_VER:
case L2TP_AVP_ASSND_TUN_ID:
@@ -565,7 +565,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
case L2TP_AVP_SUB_ADDRESS:
case L2TP_AVP_PROXY_AUTH_NAME:
case L2TP_AVP_PRIVATE_GRP_ID:
- print_string(ndo, (u_char *)ptr, len-6);
+ print_string(ndo, (const u_char *)ptr, len-6);
break;
case L2TP_AVP_CHALLENGE:
case L2TP_AVP_INI_RECV_LCP:
@@ -574,13 +574,13 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
case L2TP_AVP_PROXY_AUTH_CHAL:
case L2TP_AVP_PROXY_AUTH_RESP:
case L2TP_AVP_RANDOM_VECTOR:
- print_octets(ndo, (u_char *)ptr, len-6);
+ print_octets(ndo, (const u_char *)ptr, len-6);
break;
case L2TP_AVP_Q931_CC:
- l2tp_q931_cc_print(ndo, (u_char *)ptr, len-6);
+ l2tp_q931_cc_print(ndo, (const u_char *)ptr, len-6);
break;
case L2TP_AVP_CHALLENGE_RESP:
- print_octets(ndo, (u_char *)ptr, 16);
+ print_octets(ndo, (const u_char *)ptr, 16);
break;
case L2TP_AVP_CALL_SER_NUM:
case L2TP_AVP_MINIMUM_BPS:
@@ -588,33 +588,33 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
case L2TP_AVP_TX_CONN_SPEED:
case L2TP_AVP_PHY_CHANNEL_ID:
case L2TP_AVP_RX_CONN_SPEED:
- print_32bits_val(ndo, (uint32_t *)ptr);
+ print_32bits_val(ndo, (const uint32_t *)ptr);
break;
case L2TP_AVP_BEARER_TYPE:
- l2tp_bearer_type_print(ndo, (u_char *)ptr);
+ l2tp_bearer_type_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_FRAMING_TYPE:
- l2tp_framing_type_print(ndo, (u_char *)ptr);
+ l2tp_framing_type_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_PACKET_PROC_DELAY:
l2tp_packet_proc_delay_print(ndo);
break;
case L2TP_AVP_PROXY_AUTH_TYPE:
- l2tp_proxy_auth_type_print(ndo, (u_char *)ptr);
+ l2tp_proxy_auth_type_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_PROXY_AUTH_ID:
- l2tp_proxy_auth_id_print(ndo, (u_char *)ptr);
+ l2tp_proxy_auth_id_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_CALL_ERRORS:
- l2tp_call_errors_print(ndo, (u_char *)ptr);
+ l2tp_call_errors_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_ACCM:
- l2tp_accm_print(ndo, (u_char *)ptr);
+ l2tp_accm_print(ndo, (const u_char *)ptr);
break;
case L2TP_AVP_SEQ_REQUIRED:
break; /* No Attribute Value */
case L2TP_AVP_PPP_DISCON_CC:
- l2tp_ppp_discon_cc_print(ndo, (u_char *)ptr, len-6);
+ l2tp_ppp_discon_cc_print(ndo, (const u_char *)ptr, len-6);
break;
default:
break;
diff --git a/print-lane.c b/print-lane.c
index 1f10fab1..edf5451c 100644
--- a/print-lane.c
+++ b/print-lane.c
@@ -81,14 +81,14 @@ lane_hdr_print(netdissect_options *ndo, const u_char *bp)
void
lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
- struct lane_controlhdr *lec;
+ const struct lane_controlhdr *lec;
if (caplen < sizeof(struct lane_controlhdr)) {
ND_PRINT((ndo, "[|lane]"));
return;
}
- lec = (struct lane_controlhdr *)p;
+ lec = (const struct lane_controlhdr *)p;
if (EXTRACT_16BITS(&lec->lec_header) == 0xff00) {
/*
* LE Control.
diff --git a/print-llc.c b/print-llc.c
index 1398e996..c86618b8 100644
--- a/print-llc.c
+++ b/print-llc.c
@@ -155,12 +155,12 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
if (caplen < 3) {
ND_PRINT((ndo, "[|llc]"));
- ND_DEFAULTPRINT((u_char *)p, caplen);
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
return (caplen);
}
if (length < 3) {
ND_PRINT((ndo, "[|llc]"));
- ND_DEFAULTPRINT((u_char *)p, caplen);
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
return (length);
}
@@ -187,12 +187,12 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
*/
if (caplen < 4) {
ND_PRINT((ndo, "[|llc]"));
- ND_DEFAULTPRINT((u_char *)p, caplen);
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
return (caplen);
}
if (length < 4) {
ND_PRINT((ndo, "[|llc]"));
- ND_DEFAULTPRINT((u_char *)p, caplen);
+ ND_DEFAULTPRINT((const u_char *)p, caplen);
return (length);
}
diff --git a/print-lwres.c b/print-lwres.c
index c7f04685..90a6866a 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -249,7 +249,7 @@ lwres_printbinlen(netdissect_options *ndo,
static int
lwres_printaddr(netdissect_options *ndo,
- lwres_addr_t *ap)
+ const lwres_addr_t *ap)
{
uint16_t l;
const char *p;
@@ -342,9 +342,9 @@ lwres_print(netdissect_options *ndo,
/*
* queries
*/
- lwres_gabnrequest_t *gabn;
- lwres_gnbarequest_t *gnba;
- lwres_grbnrequest_t *grbn;
+ const lwres_gabnrequest_t *gabn;
+ const lwres_gnbarequest_t *gnba;
+ const lwres_grbnrequest_t *grbn;
uint32_t l;
gabn = NULL;
@@ -355,7 +355,7 @@ lwres_print(netdissect_options *ndo,
case LWRES_OPCODE_NOOP:
break;
case LWRES_OPCODE_GETADDRSBYNAME:
- gabn = (lwres_gabnrequest_t *)(np + 1);
+ gabn = (const lwres_gabnrequest_t *)(np + 1);
ND_TCHECK(gabn->namelen);
/* XXX gabn points to packed struct */
s = (const char *)&gabn->namelen +
@@ -389,7 +389,7 @@ lwres_print(netdissect_options *ndo,
s += advance;
break;
case LWRES_OPCODE_GETNAMEBYADDR:
- gnba = (lwres_gnbarequest_t *)(np + 1);
+ gnba = (const lwres_gnbarequest_t *)(np + 1);
ND_TCHECK(gnba->addr);
/* BIND910: not used */
@@ -407,7 +407,7 @@ lwres_print(netdissect_options *ndo,
break;
case LWRES_OPCODE_GETRDATABYNAME:
/* XXX no trace, not tested */
- grbn = (lwres_grbnrequest_t *)(np + 1);
+ grbn = (const lwres_grbnrequest_t *)(np + 1);
ND_TCHECK(grbn->namelen);
/* BIND910: not used */
@@ -441,9 +441,9 @@ lwres_print(netdissect_options *ndo,
/*
* responses
*/
- lwres_gabnresponse_t *gabn;
- lwres_gnbaresponse_t *gnba;
- lwres_grbnresponse_t *grbn;
+ const lwres_gabnresponse_t *gabn;
+ const lwres_gnbaresponse_t *gnba;
+ const lwres_grbnresponse_t *grbn;
uint32_t l, na;
uint32_t i;
@@ -455,7 +455,7 @@ lwres_print(netdissect_options *ndo,
case LWRES_OPCODE_NOOP:
break;
case LWRES_OPCODE_GETADDRSBYNAME:
- gabn = (lwres_gabnresponse_t *)(np + 1);
+ gabn = (const lwres_gabnresponse_t *)(np + 1);
ND_TCHECK(gabn->realnamelen);
/* XXX gabn points to packed struct */
s = (const char *)&gabn->realnamelen +
@@ -488,14 +488,14 @@ lwres_print(netdissect_options *ndo,
/* addrs */
na = EXTRACT_16BITS(&gabn->naddrs);
for (i = 0; i < na; i++) {
- advance = lwres_printaddr(ndo, (lwres_addr_t *)s);
+ advance = lwres_printaddr(ndo, (const lwres_addr_t *)s);
if (advance < 0)
goto trunc;
s += advance;
}
break;
case LWRES_OPCODE_GETNAMEBYADDR:
- gnba = (lwres_gnbaresponse_t *)(np + 1);
+ gnba = (const lwres_gnbaresponse_t *)(np + 1);
ND_TCHECK(gnba->realnamelen);
/* XXX gnba points to packed struct */
s = (const char *)&gnba->realnamelen +
@@ -526,7 +526,7 @@ lwres_print(netdissect_options *ndo,
break;
case LWRES_OPCODE_GETRDATABYNAME:
/* XXX no trace, not tested */
- grbn = (lwres_grbnresponse_t *)(np + 1);
+ grbn = (const lwres_grbnresponse_t *)(np + 1);
ND_TCHECK(grbn->nsigs);
/* BIND910: not used */
diff --git a/print-mobile.c b/print-mobile.c
index b61d0f5d..c06b84af 100644
--- a/print-mobile.c
+++ b/print-mobile.c
@@ -93,7 +93,7 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length)
ND_PRINT((ndo, "> %s ", ipaddr_string(ndo, &mob->odst)));
ND_PRINT((ndo, "(oproto=%d)", proto>>8));
}
- vec[0].ptr = (const uint8_t *)(void *)mob;
+ vec[0].ptr = (const uint8_t *)(const void *)mob;
vec[0].len = osp ? 12 : 8;
if (in_cksum(vec, 1)!=0) {
ND_PRINT((ndo, " (bad checksum %d)", crc));
diff --git a/print-mobility.c b/print-mobility.c
index 787d0409..d08984d1 100644
--- a/print-mobility.c
+++ b/print-mobility.c
@@ -198,7 +198,7 @@ mobility_print(netdissect_options *ndo,
unsigned mhlen, hlen;
uint8_t type;
- mh = (struct ip6_mobility *)bp;
+ mh = (const struct ip6_mobility *)bp;
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
diff --git a/print-mptcp.c b/print-mptcp.c
index 947ffc4f..a37a59d9 100644
--- a/print-mptcp.c
+++ b/print-mptcp.c
@@ -172,7 +172,7 @@ static int
mp_capable_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
- struct mp_capable *mpc = (struct mp_capable *) opt;
+ const struct mp_capable *mpc = (const struct mp_capable *) opt;
if (!(opt_len == 12 && flags & TH_SYN) &&
!(opt_len == 20 && (flags & (TH_SYN | TH_ACK)) == TH_ACK))
@@ -196,7 +196,7 @@ static int
mp_join_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
- struct mp_join *mpj = (struct mp_join *) opt;
+ const struct mp_join *mpj = (const struct mp_join *) opt;
if (!(opt_len == 12 && flags & TH_SYN) &&
!(opt_len == 16 && (flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK)) &&
@@ -232,7 +232,7 @@ mp_join_print(netdissect_options *ndo,
return 1;
}
-static u_int mp_dss_len(struct mp_dss *m, int csum)
+static u_int mp_dss_len(const struct mp_dss *m, int csum)
{
u_int len;
@@ -264,7 +264,7 @@ static int
mp_dss_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
- struct mp_dss *mdss = (struct mp_dss *) opt;
+ const struct mp_dss *mdss = (const struct mp_dss *) opt;
if ((opt_len != mp_dss_len(mdss, 1) &&
opt_len != mp_dss_len(mdss, 0)) || flags & TH_SYN)
@@ -309,7 +309,7 @@ static int
add_addr_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags _U_)
{
- struct mp_add_addr *add_addr = (struct mp_add_addr *) opt;
+ const struct mp_add_addr *add_addr = (const struct mp_add_addr *) opt;
u_int ipver = MP_ADD_ADDR_IPVER(add_addr->sub_ipver);
if (!((opt_len == 8 || opt_len == 10) && ipver == 4) &&
@@ -341,8 +341,8 @@ static int
remove_addr_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags _U_)
{
- struct mp_remove_addr *remove_addr = (struct mp_remove_addr *) opt;
- uint8_t *addr_id = &remove_addr->addrs_id;
+ const struct mp_remove_addr *remove_addr = (const struct mp_remove_addr *) opt;
+ const uint8_t *addr_id = &remove_addr->addrs_id;
if (opt_len < 4)
return 0;
@@ -358,7 +358,7 @@ static int
mp_prio_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags _U_)
{
- struct mp_prio *mpp = (struct mp_prio *) opt;
+ const struct mp_prio *mpp = (const struct mp_prio *) opt;
if (opt_len != 3 && opt_len != 4)
return 0;
@@ -414,13 +414,13 @@ int
mptcp_print(netdissect_options *ndo,
const u_char *cp, u_int len, u_char flags)
{
- struct mptcp_option *opt;
+ const struct mptcp_option *opt;
u_int subtype;
if (len < 3)
return 0;
- opt = (struct mptcp_option *) cp;
+ opt = (const struct mptcp_option *) cp;
subtype = min(MPTCP_OPT_SUBTYPE(opt->sub_etc), MPTCP_SUB_FCLOSE + 1);
ND_PRINT((ndo, " %s", mptcp_options[subtype].name));
diff --git a/print-msnlb.c b/print-msnlb.c
index 84089210..2721246d 100644
--- a/print-msnlb.c
+++ b/print-msnlb.c
@@ -50,7 +50,7 @@ msnlb_print(netdissect_options *ndo, const u_char *bp)
{
const struct msnlb_heartbeat_pkt *hb;
- hb = (struct msnlb_heartbeat_pkt *)bp;
+ hb = (const struct msnlb_heartbeat_pkt *)bp;
ND_TCHECK(*hb);
ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,",
diff --git a/print-nfs.c b/print-nfs.c
index e5f081a4..50334d10 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -202,9 +202,9 @@ static void
print_nfsaddr(netdissect_options *ndo,
const u_char *bp, const char *s, const char *d)
{
- struct ip *ip;
+ const struct ip *ip;
#ifdef INET6
- struct ip6_hdr *ip6;
+ const struct ip6_hdr *ip6;
char srcaddr[INET6_ADDRSTRLEN], dstaddr[INET6_ADDRSTRLEN];
#else
#ifndef INET_ADDRSTRLEN
@@ -214,15 +214,15 @@ print_nfsaddr(netdissect_options *ndo,
#endif
srcaddr[0] = dstaddr[0] = '\0';
- switch (IP_V((struct ip *)bp)) {
+ switch (IP_V((const struct ip *)bp)) {
case 4:
- ip = (struct ip *)bp;
+ ip = (const struct ip *)bp;
strlcpy(srcaddr, ipaddr_string(ndo, &ip->ip_src), sizeof(srcaddr));
strlcpy(dstaddr, ipaddr_string(ndo, &ip->ip_dst), sizeof(dstaddr));
break;
#ifdef INET6
case 6:
- ip6 = (struct ip6_hdr *)bp;
+ ip6 = (const struct ip6_hdr *)bp;
strlcpy(srcaddr, ip6addr_string(ndo, &ip6->ip6_src),
sizeof(srcaddr));
strlcpy(dstaddr, ip6addr_string(ndo, &ip6->ip6_dst),
@@ -433,7 +433,7 @@ parsereq(netdissect_options *ndo,
/*
* find the start of the req data (if we captured it)
*/
- dp = (uint32_t *)&rp->rm_call.cb_cred;
+ dp = (const uint32_t *)&rp->rm_call.cb_cred;
ND_TCHECK(dp[1]);
len = EXTRACT_32BITS(&dp[1]);
if (len < length) {
@@ -495,7 +495,7 @@ parsefn(netdissect_options *ndo,
ND_TCHECK2(*dp, ((len + 3) & ~3));
- cp = (u_char *)dp;
+ cp = (const u_char *)dp;
/* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
dp += ((len + 3) & ~3) / sizeof(*dp);
ND_PRINT((ndo, "\""));
@@ -878,21 +878,21 @@ static int
xid_map_enter(netdissect_options *ndo,
const struct sunrpc_msg *rp, const u_char *bp)
{
- struct ip *ip = NULL;
+ const struct ip *ip = NULL;
#ifdef INET6
- struct ip6_hdr *ip6 = NULL;
+ const struct ip6_hdr *ip6 = NULL;
#endif
struct xid_map_entry *xmep;
if (!ND_TTEST(rp->rm_call.cb_vers))
return (0);
- switch (IP_V((struct ip *)bp)) {
+ switch (IP_V((const struct ip *)bp)) {
case 4:
- ip = (struct ip *)bp;
+ ip = (const struct ip *)bp;
break;
#ifdef INET6
case 6:
- ip6 = (struct ip6_hdr *)bp;
+ ip6 = (const struct ip6_hdr *)bp;
break;
#endif
default:
@@ -933,9 +933,9 @@ xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
int i;
struct xid_map_entry *xmep;
uint32_t xid = rp->rm_xid;
- struct ip *ip = (struct ip *)bp;
+ const struct ip *ip = (const struct ip *)bp;
#ifdef INET6
- struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
+ const struct ip6_hdr *ip6 = (const struct ip6_hdr *)bp;
#endif
int cmp;
@@ -1038,7 +1038,7 @@ parserep(netdissect_options *ndo,
}
/* successful return */
ND_TCHECK2(*dp, sizeof(astat));
- return ((uint32_t *) (sizeof(astat) + ((char *)dp)));
+ return ((const uint32_t *) (sizeof(astat) + ((const char *)dp)));
trunc:
return (0);
}
@@ -1083,7 +1083,7 @@ parsefattr(netdissect_options *ndo,
if (v3) {
ND_TCHECK(fap->fa3_size);
ND_PRINT((ndo, " sz %" PRIu64,
- EXTRACT_64BITS((uint32_t *)&fap->fa3_size)));
+ EXTRACT_64BITS((const uint32_t *)&fap->fa3_size)));
} else {
ND_TCHECK(fap->fa2_size);
ND_PRINT((ndo, " sz %d", EXTRACT_32BITS(&fap->fa2_size)));
@@ -1098,9 +1098,9 @@ parsefattr(netdissect_options *ndo,
EXTRACT_32BITS(&fap->fa3_rdev.specdata1),
EXTRACT_32BITS(&fap->fa3_rdev.specdata2)));
ND_PRINT((ndo, " fsid %" PRIx64,
- EXTRACT_64BITS((uint32_t *)&fap->fa3_fsid)));
+ EXTRACT_64BITS((const uint32_t *)&fap->fa3_fsid)));
ND_PRINT((ndo, " fileid %" PRIx64,
- EXTRACT_64BITS((uint32_t *)&fap->fa3_fileid)));
+ EXTRACT_64BITS((const uint32_t *)&fap->fa3_fileid)));
ND_PRINT((ndo, " a/m/ctime %u.%06u",
EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec),
EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec)));
@@ -1128,7 +1128,7 @@ parsefattr(netdissect_options *ndo,
EXTRACT_32BITS(&fap->fa2_ctime.nfsv2_usec)));
}
}
- return ((const uint32_t *)((unsigned char *)dp +
+ return ((const uint32_t *)((const unsigned char *)dp +
(v3 ? NFSX_V3FATTR : NFSX_V2FATTR)));
trunc:
return (NULL);
@@ -1213,14 +1213,14 @@ parsestatfs(netdissect_options *ndo,
if (v3) {
ND_PRINT((ndo, " tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64,
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_tbytes),
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_fbytes),
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_abytes)));
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tbytes),
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_fbytes),
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_abytes)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u",
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_tfiles),
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_ffiles),
- EXTRACT_64BITS((uint32_t *)&sfsp->sf_afiles),
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tfiles),
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_ffiles),
+ EXTRACT_64BITS((const uint32_t *)&sfsp->sf_afiles),
EXTRACT_32BITS(&sfsp->sf_invarsec)));
}
} else {
@@ -1398,7 +1398,7 @@ static int
parsefsinfo(netdissect_options *ndo,
const uint32_t *dp)
{
- struct nfsv3_fsinfo *sfp;
+ const struct nfsv3_fsinfo *sfp;
int er;
if (!(dp = parsestatus(ndo, dp, &er)))
@@ -1410,7 +1410,7 @@ parsefsinfo(netdissect_options *ndo,
if (er)
return (1);
- sfp = (struct nfsv3_fsinfo *)dp;
+ sfp = (const struct nfsv3_fsinfo *)dp;
ND_TCHECK(*sfp);
ND_PRINT((ndo, " rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
EXTRACT_32BITS(&sfp->fs_rtmax),
@@ -1422,7 +1422,7 @@ parsefsinfo(netdissect_options *ndo,
ND_PRINT((ndo, " rtmult %u wtmult %u maxfsz %" PRIu64,
EXTRACT_32BITS(&sfp->fs_rtmult),
EXTRACT_32BITS(&sfp->fs_wtmult),
- EXTRACT_64BITS((uint32_t *)&sfp->fs_maxfilesize)));
+ EXTRACT_64BITS((const uint32_t *)&sfp->fs_maxfilesize)));
ND_PRINT((ndo, " delta %u.%06u ",
EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec),
EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec)));
@@ -1437,7 +1437,7 @@ parsepathconf(netdissect_options *ndo,
const uint32_t *dp)
{
int er;
- struct nfsv3_pathconf *spp;
+ const struct nfsv3_pathconf *spp;
if (!(dp = parsestatus(ndo, dp, &er)))
return (0);
@@ -1448,7 +1448,7 @@ parsepathconf(netdissect_options *ndo,
if (er)
return (1);
- spp = (struct nfsv3_pathconf *)dp;
+ spp = (const struct nfsv3_pathconf *)dp;
ND_TCHECK(*spp);
ND_PRINT((ndo, " linkmax %u namemax %u %s %s %s %s",
diff --git a/print-ntp.c b/print-ntp.c
index c3ea82b6..eed98f7e 100644
--- a/print-ntp.c
+++ b/print-ntp.c
@@ -206,7 +206,7 @@ ntp_print(netdissect_options *ndo,
register const struct ntpdata *bp;
int mode, version, leapind;
- bp = (struct ntpdata *)cp;
+ bp = (const struct ntpdata *)cp;
ND_TCHECK(bp->status);
@@ -260,7 +260,7 @@ ntp_print(netdissect_options *ndo,
break;
case PRIM_REF:
- if (fn_printn(ndo, (u_char *)&(bp->refid), 4, ndo->ndo_snapend))
+ if (fn_printn(ndo, (const u_char *)&(bp->refid), 4, ndo->ndo_snapend))
goto trunc;
break;
diff --git a/print-null.c b/print-null.c
index 8801e7b7..b6fdf9f8 100644
--- a/print-null.c
+++ b/print-null.c
@@ -82,7 +82,7 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
return (NULL_HDRLEN);
}
- memcpy((char *)&family, (char *)p, sizeof(family));
+ memcpy((char *)&family, (const char *)p, sizeof(family));
/*
* This isn't necessarily in our host byte order; if this is
diff --git a/print-olsr.c b/print-olsr.c
index 73727313..9b92a0b7 100644
--- a/print-olsr.c
+++ b/print-olsr.c
@@ -181,11 +181,11 @@ static int
olsr_print_lq_neighbor4(netdissect_options *ndo,
const u_char *msg_data, u_int hello_len)
{
- struct olsr_lq_neighbor4 *lq_neighbor;
+ const struct olsr_lq_neighbor4 *lq_neighbor;
while (hello_len >= sizeof(struct olsr_lq_neighbor4)) {
- lq_neighbor = (struct olsr_lq_neighbor4 *)msg_data;
+ lq_neighbor = (const struct olsr_lq_neighbor4 *)msg_data;
if (!ND_TTEST(*lq_neighbor))
return (-1);
@@ -206,11 +206,11 @@ static int
olsr_print_lq_neighbor6(netdissect_options *ndo,
const u_char *msg_data, u_int hello_len)
{
- struct olsr_lq_neighbor6 *lq_neighbor;
+ const struct olsr_lq_neighbor6 *lq_neighbor;
while (hello_len >= sizeof(struct olsr_lq_neighbor6)) {
- lq_neighbor = (struct olsr_lq_neighbor6 *)msg_data;
+ lq_neighbor = (const struct olsr_lq_neighbor6 *)msg_data;
if (!ND_TTEST(*lq_neighbor))
return (-1);
@@ -283,7 +283,7 @@ olsr_print(netdissect_options *ndo,
ND_TCHECK2(*tptr, sizeof(struct olsr_common));
- ptr.common = (struct olsr_common *)tptr;
+ ptr.common = (const struct olsr_common *)tptr;
length = min(length, EXTRACT_16BITS(ptr.common->packet_len));
ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u",
@@ -303,8 +303,8 @@ olsr_print(netdissect_options *ndo,
while (tptr < (pptr+length)) {
union
{
- struct olsr_msg4 *v4;
- struct olsr_msg6 *v6;
+ const struct olsr_msg4 *v4;
+ const struct olsr_msg6 *v6;
} msgptr;
int msg_len_valid = 0;
@@ -313,7 +313,7 @@ olsr_print(netdissect_options *ndo,
#if INET6
if (is_ipv6)
{
- msgptr.v6 = (struct olsr_msg6 *) tptr;
+ msgptr.v6 = (const struct olsr_msg6 *) tptr;
msg_type = msgptr.v6->msg_type;
msg_len = EXTRACT_16BITS(msgptr.v6->msg_len);
if ((msg_len >= sizeof (struct olsr_msg6))
@@ -344,7 +344,7 @@ olsr_print(netdissect_options *ndo,
else /* (!is_ipv6) */
#endif /* INET6 */
{
- msgptr.v4 = (struct olsr_msg4 *) tptr;
+ msgptr.v4 = (const struct olsr_msg4 *) tptr;
msg_type = msgptr.v4->msg_type;
msg_len = EXTRACT_16BITS(msgptr.v4->msg_len);
if ((msg_len >= sizeof (struct olsr_msg4))
@@ -380,7 +380,7 @@ olsr_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK2(*msg_data, sizeof(struct olsr_hello));
- ptr.hello = (struct olsr_hello *)msg_data;
+ ptr.hello = (const struct olsr_hello *)msg_data;
ND_PRINT((ndo, "\n\t hello-time %.3lfs, MPR willingness %u",
ME_TO_DOUBLE(ptr.hello->htime), ptr.hello->will));
msg_data += sizeof(struct olsr_hello);
@@ -394,7 +394,7 @@ olsr_print(netdissect_options *ndo,
*/
ND_TCHECK2(*msg_data, sizeof(struct olsr_hello_link));
- ptr.hello_link = (struct olsr_hello_link *)msg_data;
+ ptr.hello_link = (const struct olsr_hello_link *)msg_data;
hello_len = EXTRACT_16BITS(ptr.hello_link->len);
link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code);
@@ -445,7 +445,7 @@ olsr_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK2(*msg_data, sizeof(struct olsr_tc));
- ptr.tc = (struct olsr_tc *)msg_data;
+ ptr.tc = (const struct olsr_tc *)msg_data;
ND_PRINT((ndo, "\n\t advertised neighbor seq 0x%04x",
EXTRACT_16BITS(ptr.tc->ans_seq)));
msg_data += sizeof(struct olsr_tc);
@@ -502,11 +502,11 @@ olsr_print(netdissect_options *ndo,
{
int i = 0;
while (msg_tlen >= sizeof(struct olsr_hna6)) {
- struct olsr_hna6 *hna6;
+ const struct olsr_hna6 *hna6;
ND_TCHECK2(*msg_data, sizeof(struct olsr_hna6));
- hna6 = (struct olsr_hna6 *)msg_data;
+ hna6 = (const struct olsr_hna6 *)msg_data;
ND_PRINT((ndo, "\n\t #%i: %s/%u",
i, ip6addr_string(ndo, hna6->network),
@@ -523,7 +523,7 @@ olsr_print(netdissect_options *ndo,
while (msg_tlen >= sizeof(struct olsr_hna4)) {
ND_TCHECK2(*msg_data, sizeof(struct olsr_hna4));
- ptr.hna = (struct olsr_hna4 *)msg_data;
+ ptr.hna = (const struct olsr_hna4 *)msg_data;
/* print 4 prefixes per line */
ND_PRINT((ndo, "%s%s/%u",
diff --git a/print-ospf.c b/print-ospf.c
index 3e0d03c5..3fc0c948 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -558,11 +558,11 @@ ospf_print_lsa(netdissect_options *ndo,
register int ls_length;
const uint8_t *tptr;
- tptr = (uint8_t *)lsap->lsa_un.un_unknown; /* squelch compiler warnings */
+ tptr = (const uint8_t *)lsap->lsa_un.un_unknown; /* squelch compiler warnings */
ls_length = ospf_print_lshdr(ndo, &lsap->ls_hdr);
if (ls_length == -1)
return(NULL);
- ls_end = (uint8_t *)lsap + ls_length;
+ ls_end = (const uint8_t *)lsap + ls_length;
ls_length -= sizeof(struct lsa_hdr);
switch (lsap->ls_hdr.ls_type) {
@@ -612,7 +612,7 @@ ospf_print_lsa(netdissect_options *ndo,
ospf_print_tos_metrics(ndo, &rlp->un_tos);
- rlp = (struct rlalink *)((u_char *)(rlp + 1) +
+ rlp = (const struct rlalink *)((const u_char *)(rlp + 1) +
((rlp->un_tos.link.link_tos_count) * sizeof(union un_tos)));
}
break;
@@ -622,7 +622,7 @@ ospf_print_lsa(netdissect_options *ndo,
ND_PRINT((ndo, "\n\t Mask %s\n\t Connected Routers:",
ipaddr_string(ndo, &lsap->lsa_un.un_nla.nla_mask)));
ap = lsap->lsa_un.un_nla.nla_router;
- while ((u_char *)ap < ls_end) {
+ while ((const u_char *)ap < ls_end) {
ND_TCHECK(*ap);
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
++ap;
@@ -635,7 +635,7 @@ ospf_print_lsa(netdissect_options *ndo,
ipaddr_string(ndo, &lsap->lsa_un.un_sla.sla_mask)));
ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
lp = lsap->lsa_un.un_sla.sla_tosmetric;
- while ((u_char *)lp < ls_end) {
+ while ((const u_char *)lp < ls_end) {
register uint32_t ul;
ND_TCHECK(*lp);
@@ -652,7 +652,7 @@ ospf_print_lsa(netdissect_options *ndo,
case LS_TYPE_SUM_ABR:
ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
lp = lsap->lsa_un.un_sla.sla_tosmetric;
- while ((u_char *)lp < ls_end) {
+ while ((const u_char *)lp < ls_end) {
register uint32_t ul;
ND_TCHECK(*lp);
@@ -674,7 +674,7 @@ ospf_print_lsa(netdissect_options *ndo,
ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
almp = lsap->lsa_un.un_asla.asla_metric;
- while ((u_char *)almp < ls_end) {
+ while ((const u_char *)almp < ls_end) {
register uint32_t ul;
ND_TCHECK(almp->asla_tosmetric);
@@ -704,7 +704,7 @@ ospf_print_lsa(netdissect_options *ndo,
case LS_TYPE_GROUP:
/* Multicast extensions as of 23 July 1991 */
mcp = lsap->lsa_un.un_mcla;
- while ((u_char *)mcp < ls_end) {
+ while ((const u_char *)mcp < ls_end) {
ND_TCHECK(mcp->mcla_vid);
switch (EXTRACT_32BITS(&mcp->mcla_vtype)) {
@@ -733,7 +733,7 @@ ospf_print_lsa(netdissect_options *ndo,
switch (*(&lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) {
case LS_OPAQUE_TYPE_RI:
- tptr = (uint8_t *)(&lsap->lsa_un.un_ri_tlv.type);
+ tptr = (const uint8_t *)(&lsap->lsa_un.un_ri_tlv.type);
while (ls_length != 0) {
ND_TCHECK2(*tptr, 4);
@@ -781,14 +781,14 @@ ospf_print_lsa(netdissect_options *ndo,
break;
case LS_OPAQUE_TYPE_GRACE:
- if (ospf_print_grace_lsa(ndo, (uint8_t *)(&lsap->lsa_un.un_grace_tlv.type),
+ if (ospf_print_grace_lsa(ndo, (const uint8_t *)(&lsap->lsa_un.un_grace_tlv.type),
ls_length) == -1) {
return(ls_end);
}
break;
case LS_OPAQUE_TYPE_TE:
- if (ospf_print_te_lsa(ndo, (uint8_t *)(&lsap->lsa_un.un_te_lsa_tlv.type),
+ if (ospf_print_te_lsa(ndo, (const uint8_t *)(&lsap->lsa_un.un_te_lsa_tlv.type),
ls_length) == -1) {
return(ls_end);
}
@@ -796,7 +796,7 @@ ospf_print_lsa(netdissect_options *ndo,
default:
if (ndo->ndo_vflag <= 1) {
- if (!print_unknown_data(ndo, (uint8_t *)lsap->lsa_un.un_unknown,
+ if (!print_unknown_data(ndo, (const uint8_t *)lsap->lsa_un.un_unknown,
"\n\t ", ls_length))
return(ls_end);
}
@@ -806,7 +806,7 @@ ospf_print_lsa(netdissect_options *ndo,
/* do we want to see an additionally hexdump ? */
if (ndo->ndo_vflag> 1)
- if (!print_unknown_data(ndo, (uint8_t *)lsap->lsa_un.un_unknown,
+ if (!print_unknown_data(ndo, (const uint8_t *)lsap->lsa_un.un_unknown,
"\n\t ", ls_length)) {
return(ls_end);
}
@@ -844,8 +844,8 @@ ospf_decode_lls(netdissect_options *ndo,
/* dig deeper if LLS data is available; see RFC4813 */
length2 = EXTRACT_16BITS(&op->ospf_len);
- dptr = (u_char *)op + length2;
- dataend = (u_char *)op + length;
+ dptr = (const u_char *)op + length2;
+ dataend = (const u_char *)op + length;
if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
dptr = dptr + op->ospf_authdata[3];
@@ -949,9 +949,9 @@ ospf_decode_v2(netdissect_options *ndo,
ipaddr_string(ndo, &op->ospf_hello.hello_bdr)));
ap = op->ospf_hello.hello_neighbor;
- if ((u_char *)ap < dataend)
+ if ((const u_char *)ap < dataend)
ND_PRINT((ndo, "\n\t Neighbor List:"));
- while ((u_char *)ap < dataend) {
+ while ((const u_char *)ap < dataend) {
ND_TCHECK(*ap);
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
++ap;
@@ -974,14 +974,14 @@ ospf_decode_v2(netdissect_options *ndo,
/* Print all the LS adv's */
lshp = op->ospf_db.db_lshdr;
- while (((u_char *)lshp < dataend) && ospf_print_lshdr(ndo, lshp) != -1) {
+ while (((const u_char *)lshp < dataend) && ospf_print_lshdr(ndo, lshp) != -1) {
++lshp;
}
break;
case OSPF_TYPE_LS_REQ:
lsrp = op->ospf_lsr;
- while ((u_char *)lsrp < dataend) {
+ while ((const u_char *)lsrp < dataend) {
ND_TCHECK(*lsrp);
ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)",
@@ -1046,7 +1046,7 @@ ospf_print(netdissect_options *ndo,
register const u_char *dataend;
register const char *cp;
- op = (struct ospfhdr *)bp;
+ op = (const struct ospfhdr *)bp;
/* XXX Before we do anything else, strip off the MD5 trailer */
ND_TCHECK(op->ospf_authtype);
diff --git a/print-ospf6.c b/print-ospf6.c
index 0d25baac..7ae1733a 100644
--- a/print-ospf6.c
+++ b/print-ospf6.c
@@ -385,7 +385,7 @@ static int
ospf6_print_lshdr(netdissect_options *ndo,
register const struct lsa6_hdr *lshp, const u_char *dataend)
{
- if ((u_char *)(lshp + 1) > dataend)
+ if ((const u_char *)(lshp + 1) > dataend)
goto trunc;
ND_TCHECK(lshp->ls_type);
ND_TCHECK(lshp->ls_seq);
@@ -407,7 +407,7 @@ static int
ospf6_print_lsaprefix(netdissect_options *ndo,
const uint8_t *tptr, u_int lsa_length)
{
- const struct lsa6_prefix *lsapp = (struct lsa6_prefix *)tptr;
+ const struct lsa6_prefix *lsapp = (const struct lsa6_prefix *)tptr;
u_int wordlen;
struct in6_addr prefix;
@@ -479,10 +479,10 @@ ospf6_print_lsa(netdissect_options *ndo,
* If it does, find the length of what follows the
* header.
*/
- if (length < sizeof(struct lsa6_hdr) || (u_char *)lsap + length > dataend)
+ if (length < sizeof(struct lsa6_hdr) || (const u_char *)lsap + length > dataend)
return (1);
lsa_length = length - sizeof(struct lsa6_hdr);
- tptr = (uint8_t *)lsap+sizeof(struct lsa6_hdr);
+ tptr = (const uint8_t *)lsap+sizeof(struct lsa6_hdr);
switch (EXTRACT_16BITS(&lsap->ls_hdr.ls_type)) {
case LS_TYPE_ROUTER | LS_SCOPE_AREA:
@@ -568,7 +568,7 @@ ospf6_print_lsa(netdissect_options *ndo,
ND_PRINT((ndo, ", metric %u",
EXTRACT_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC));
- tptr = (uint8_t *)lsap->lsa_un.un_inter_ap.inter_ap_prefix;
+ tptr = (const uint8_t *)lsap->lsa_un.un_inter_ap.inter_ap_prefix;
while (lsa_length != 0) {
bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length);
if (bytelen < 0)
@@ -590,8 +590,8 @@ ospf6_print_lsa(netdissect_options *ndo,
EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric) &
ASLA_MASK_METRIC));
- tptr = (uint8_t *)lsap->lsa_un.un_asla.asla_prefix;
- lsapp = (struct lsa6_prefix *)tptr;
+ tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix;
+ lsapp = (const struct lsa6_prefix *)tptr;
bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length);
if (bytelen < 0)
goto trunc;
@@ -599,9 +599,9 @@ ospf6_print_lsa(netdissect_options *ndo,
tptr += bytelen;
if ((flags32 & ASLA_FLAG_FWDADDR) != 0) {
- struct in6_addr *fwdaddr6;
+ const struct in6_addr *fwdaddr6;
- fwdaddr6 = (struct in6_addr *)tptr;
+ fwdaddr6 = (const struct in6_addr *)tptr;
if (lsa_length < sizeof (*fwdaddr6))
return (1);
lsa_length -= sizeof (*fwdaddr6);
@@ -615,9 +615,9 @@ ospf6_print_lsa(netdissect_options *ndo,
if (lsa_length < sizeof (uint32_t))
return (1);
lsa_length -= sizeof (uint32_t);
- ND_TCHECK(*(uint32_t *)tptr);
+ ND_TCHECK(*(const uint32_t *)tptr);
ND_PRINT((ndo, " tag %s",
- ipaddr_string(ndo, (uint32_t *)tptr)));
+ ipaddr_string(ndo, (const uint32_t *)tptr)));
tptr += sizeof(uint32_t);
}
@@ -625,9 +625,9 @@ ospf6_print_lsa(netdissect_options *ndo,
if (lsa_length < sizeof (uint32_t))
return (1);
lsa_length -= sizeof (uint32_t);
- ND_TCHECK(*(uint32_t *)tptr);
+ ND_TCHECK(*(const uint32_t *)tptr);
ND_PRINT((ndo, " RefLSID: %s",
- ipaddr_string(ndo, (uint32_t *)tptr)));
+ ipaddr_string(ndo, (const uint32_t *)tptr)));
tptr += sizeof(uint32_t);
}
break;
@@ -652,7 +652,7 @@ ospf6_print_lsa(netdissect_options *ndo,
ip6addr_string(ndo, &llsap->llsa_lladdr),
prefixes));
- tptr = (uint8_t *)llsap->llsa_prefix;
+ tptr = (const uint8_t *)llsap->llsa_prefix;
while (prefixes > 0) {
bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length);
if (bytelen < 0)
@@ -680,7 +680,7 @@ ospf6_print_lsa(netdissect_options *ndo,
prefixes = EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
ND_PRINT((ndo, "\n\t Prefixes %d:", prefixes));
- tptr = (uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix;
+ tptr = (const uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix;
while (prefixes > 0) {
bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length);
if (bytelen < 0)
@@ -731,7 +731,7 @@ ospf6_decode_v3(netdissect_options *ndo,
switch (op->ospf6_type) {
case OSPF_TYPE_HELLO: {
- register const struct hello6 *hellop = (const struct hello6 *)((uint8_t *)op + OSPF6HDR_LEN);
+ register const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf6_option_values, "none",
@@ -755,7 +755,7 @@ ospf6_decode_v3(netdissect_options *ndo,
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, "\n\t Neighbor List:"));
ap = hellop->hello_neighbor;
- while ((u_char *)ap < dataend) {
+ while ((const u_char *)ap < dataend) {
ND_TCHECK(*ap);
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
++ap;
@@ -765,7 +765,7 @@ ospf6_decode_v3(netdissect_options *ndo,
}
case OSPF_TYPE_DD: {
- register const struct dd6 *ddp = (const struct dd6 *)((uint8_t *)op + OSPF6HDR_LEN);
+ register const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(ddp->db_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
@@ -782,7 +782,7 @@ ospf6_decode_v3(netdissect_options *ndo,
if (ndo->ndo_vflag > 1) {
/* Print all the LS adv's */
lshp = ddp->db_lshdr;
- while ((u_char *)lshp < dataend) {
+ while ((const u_char *)lshp < dataend) {
if (ospf6_print_lshdr(ndo, lshp++, dataend))
goto trunc;
}
@@ -792,8 +792,8 @@ ospf6_decode_v3(netdissect_options *ndo,
case OSPF_TYPE_LS_REQ:
if (ndo->ndo_vflag > 1) {
- lsrp = (const struct lsr6 *)((uint8_t *)op + OSPF6HDR_LEN);
- while ((u_char *)lsrp < dataend) {
+ lsrp = (const struct lsr6 *)((const uint8_t *)op + OSPF6HDR_LEN);
+ while ((const u_char *)lsrp < dataend) {
ND_TCHECK(*lsrp);
ND_PRINT((ndo, "\n\t Advertising Router %s",
ipaddr_string(ndo, &lsrp->ls_router)));
@@ -806,15 +806,15 @@ ospf6_decode_v3(netdissect_options *ndo,
case OSPF_TYPE_LS_UPDATE:
if (ndo->ndo_vflag > 1) {
- register const struct lsu6 *lsup = (const struct lsu6 *)((uint8_t *)op + OSPF6HDR_LEN);
+ register const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(lsup->lsu_count);
i = EXTRACT_32BITS(&lsup->lsu_count);
lsap = lsup->lsu_lsa;
- while ((u_char *)lsap < dataend && i--) {
+ while ((const u_char *)lsap < dataend && i--) {
if (ospf6_print_lsa(ndo, lsap, dataend))
goto trunc;
- lsap = (struct lsa6 *)((u_char *)lsap +
+ lsap = (const struct lsa6 *)((const u_char *)lsap +
EXTRACT_16BITS(&lsap->ls_hdr.ls_length));
}
}
@@ -822,8 +822,8 @@ ospf6_decode_v3(netdissect_options *ndo,
case OSPF_TYPE_LS_ACK:
if (ndo->ndo_vflag > 1) {
- lshp = (const struct lsa6_hdr *)((uint8_t *)op + OSPF6HDR_LEN);
- while ((u_char *)lshp < dataend) {
+ lshp = (const struct lsa6_hdr *)((const uint8_t *)op + OSPF6HDR_LEN);
+ while ((const u_char *)lshp < dataend) {
if (ospf6_print_lshdr(ndo, lshp++, dataend))
goto trunc;
}
@@ -930,11 +930,11 @@ ospf6_decode_v3_trailer(netdissect_options *ndo,
int lls_dd = 0;
if (op->ospf6_type == OSPF_TYPE_HELLO) {
- const struct hello6 *hellop = (const struct hello6 *)((uint8_t *)op + OSPF6HDR_LEN);
+ const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
if (EXTRACT_32BITS(&hellop->hello_options) & OSPF6_OPTION_L)
lls_hello = 1;
} else if (op->ospf6_type == OSPF_TYPE_DD) {
- const struct dd6 *ddp = (const struct dd6 *)((uint8_t *)op + OSPF6HDR_LEN);
+ const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
if (EXTRACT_32BITS(&ddp->db_options) & OSPF6_OPTION_L)
lls_dd = 1;
}
@@ -955,7 +955,7 @@ ospf6_print(netdissect_options *ndo,
register const char *cp;
uint16_t datalen;
- op = (struct ospf6hdr *)bp;
+ op = (const struct ospf6hdr *)bp;
/* If the type is valid translate it, or just print the type */
/* value. If it's not valid, say so and return */
diff --git a/print-pgm.c b/print-pgm.c
index 58d1f880..fc2b0ccc 100644
--- a/print-pgm.c
+++ b/print-pgm.c
@@ -162,11 +162,11 @@ pgm_print(netdissect_options *ndo,
uint8_t opt_type, opt_len;
uint32_t seq, opts_len, len, offset;
- pgm = (struct pgm_header *)bp;
- ip = (struct ip *)bp2;
+ pgm = (const struct pgm_header *)bp;
+ ip = (const struct ip *)bp2;
#ifdef INET6
if (IP_V(ip) == 6)
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
#else /* INET6 */
@@ -239,9 +239,9 @@ pgm_print(netdissect_options *ndo,
pgm->pgm_gsid[5]));
switch (pgm->pgm_type) {
case PGM_SPM: {
- struct pgm_spm *spm;
+ const struct pgm_spm *spm;
- spm = (struct pgm_spm *)(pgm + 1);
+ spm = (const struct pgm_spm *)(pgm + 1);
ND_TCHECK(*spm);
switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) {
@@ -259,7 +259,7 @@ pgm_print(netdissect_options *ndo,
goto trunc;
break;
}
- bp = (u_char *) (spm + 1);
+ bp = (const u_char *) (spm + 1);
ND_TCHECK2(*bp, addr_size);
nla = bp;
bp += addr_size;
@@ -274,21 +274,21 @@ pgm_print(netdissect_options *ndo,
}
case PGM_POLL: {
- struct pgm_poll *poll;
+ const struct pgm_poll *poll;
- poll = (struct pgm_poll *)(pgm + 1);
+ poll = (const struct pgm_poll *)(pgm + 1);
ND_TCHECK(*poll);
ND_PRINT((ndo, "POLL seq %u round %u",
EXTRACT_32BITS(&poll->pgmp_seq),
EXTRACT_16BITS(&poll->pgmp_round)));
- bp = (u_char *) (poll + 1);
+ bp = (const u_char *) (poll + 1);
break;
}
case PGM_POLR: {
- struct pgm_polr *polr;
+ const struct pgm_polr *polr;
uint32_t ivl, rnd, mask;
- polr = (struct pgm_polr *)(pgm + 1);
+ polr = (const struct pgm_polr *)(pgm + 1);
ND_TCHECK(*polr);
switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) {
@@ -306,7 +306,7 @@ pgm_print(netdissect_options *ndo,
goto trunc;
break;
}
- bp = (u_char *) (polr + 1);
+ bp = (const u_char *) (polr + 1);
ND_TCHECK2(*bp, addr_size);
nla = bp;
bp += addr_size;
@@ -331,33 +331,33 @@ pgm_print(netdissect_options *ndo,
break;
}
case PGM_ODATA: {
- struct pgm_data *odata;
+ const struct pgm_data *odata;
- odata = (struct pgm_data *)(pgm + 1);
+ odata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*odata);
ND_PRINT((ndo, "ODATA trail %u seq %u",
EXTRACT_32BITS(&odata->pgmd_trailseq),
EXTRACT_32BITS(&odata->pgmd_seq)));
- bp = (u_char *) (odata + 1);
+ bp = (const u_char *) (odata + 1);
break;
}
case PGM_RDATA: {
- struct pgm_data *rdata;
+ const struct pgm_data *rdata;
- rdata = (struct pgm_data *)(pgm + 1);
+ rdata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*rdata);
ND_PRINT((ndo, "RDATA trail %u seq %u",
EXTRACT_32BITS(&rdata->pgmd_trailseq),
EXTRACT_32BITS(&rdata->pgmd_seq)));
- bp = (u_char *) (rdata + 1);
+ bp = (const u_char *) (rdata + 1);
break;
}
case PGM_NAK:
case PGM_NULLNAK:
case PGM_NCF: {
- struct pgm_nak *nak;
+ const struct pgm_nak *nak;
const void *source, *group;
int source_af, group_af;
#ifdef INET6
@@ -366,7 +366,7 @@ pgm_print(netdissect_options *ndo,
char source_buf[INET_ADDRSTRLEN], group_buf[INET_ADDRSTRLEN];
#endif
- nak = (struct pgm_nak *)(pgm + 1);
+ nak = (const struct pgm_nak *)(pgm + 1);
ND_TCHECK(*nak);
/*
@@ -388,7 +388,7 @@ pgm_print(netdissect_options *ndo,
goto trunc;
break;
}
- bp = (u_char *) (nak + 1);
+ bp = (const u_char *) (nak + 1);
ND_TCHECK2(*bp, addr_size);
source = bp;
bp += addr_size;
@@ -441,13 +441,13 @@ pgm_print(netdissect_options *ndo,
}
case PGM_ACK: {
- struct pgm_ack *ack;
+ const struct pgm_ack *ack;
- ack = (struct pgm_ack *)(pgm + 1);
+ ack = (const struct pgm_ack *)(pgm + 1);
ND_TCHECK(*ack);
ND_PRINT((ndo, "ACK seq %u",
EXTRACT_32BITS(&ack->pgma_rx_max_seq)));
- bp = (u_char *) (ack + 1);
+ bp = (const u_char *) (ack + 1);
break;
}
diff --git a/print-pim.c b/print-pim.c
index a8bcdcf8..51fa06f4 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -417,7 +417,7 @@ pim_print(netdissect_options *ndo,
register const u_char *bp, register u_int len, u_int cksum)
{
register const u_char *ep;
- register struct pim *pim = (struct pim *)bp;
+ register const struct pim *pim = (const struct pim *)bp;
ep = (const u_char *)ndo->ndo_snapend;
if (bp >= ep)
@@ -624,7 +624,7 @@ pimv2_print(netdissect_options *ndo,
register const u_char *bp, register u_int len, u_int cksum)
{
register const u_char *ep;
- register struct pim *pim = (struct pim *)bp;
+ register const struct pim *pim = (const struct pim *)bp;
int advance;
ep = (const u_char *)ndo->ndo_snapend;
@@ -745,7 +745,7 @@ pimv2_print(netdissect_options *ndo,
case PIMV2_TYPE_REGISTER:
{
- struct ip *ip;
+ const struct ip *ip;
ND_TCHECK2(*(bp + 4), PIMV2_REGISTER_FLAG_LEN);
@@ -756,7 +756,7 @@ pimv2_print(netdissect_options *ndo,
bp += 8; len -= 8;
/* encapsulated multicast packet */
- ip = (struct ip *)bp;
+ ip = (const struct ip *)bp;
switch (IP_V(ip)) {
case 0: /* Null header */
ND_PRINT((ndo, "IP-Null-header %s > %s",
diff --git a/print-pktap.c b/print-pktap.c
index 9fa6b563..daabe41e 100644
--- a/print-pktap.c
+++ b/print-pktap.c
@@ -99,13 +99,13 @@ pktap_if_print(netdissect_options *ndo,
u_int caplen = h->caplen;
u_int length = h->len;
if_printer printer;
- pktap_header_t *hdr;
+ const pktap_header_t *hdr;
if (caplen < sizeof(pktap_header_t) || length < sizeof(pktap_header_t)) {
ND_PRINT((ndo, "[|pktap]"));
return (0);
}
- hdr = (pktap_header_t *)p;
+ hdr = (const pktap_header_t *)p;
dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt);
hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len);
if (hdrlen < sizeof(pktap_header_t)) {
@@ -143,7 +143,7 @@ pktap_if_print(netdissect_options *ndo,
hdrlen += printer(ndo, h, p);
} else {
if (!ndo->ndo_eflag)
- pktap_header_print(ndo, (u_char *)hdr,
+ pktap_header_print(ndo, (const u_char *)hdr,
length + hdrlen);
if (!ndo->ndo_suppress_default_print)
diff --git a/print-ppi.c b/print-ppi.c
index dde1cdb0..b9f76579 100644
--- a/print-ppi.c
+++ b/print-ppi.c
@@ -50,7 +50,7 @@ ppi_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
if_printer printer;
- ppi_header_t *hdr;
+ const ppi_header_t *hdr;
u_int caplen = h->caplen;
u_int length = h->len;
uint16_t len;
@@ -62,7 +62,7 @@ ppi_print(netdissect_options *ndo,
return (caplen);
}
- hdr = (ppi_header_t *)p;
+ hdr = (const ppi_header_t *)p;
len = EXTRACT_LE_16BITS(&hdr->ppi_len);
if (caplen < len) {
/*
@@ -89,7 +89,7 @@ ppi_print(netdissect_options *ndo,
hdrlen = printer(ndo, h, p);
} else {
if (!ndo->ndo_eflag)
- ppi_header_print(ndo, (u_char *)hdr, length + len);
+ ppi_header_print(ndo, (const u_char *)hdr, length + len);
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
diff --git a/print-pptp.c b/print-pptp.c
index 1691dc6a..bac6078c 100644
--- a/print-pptp.c
+++ b/print-pptp.c
@@ -517,7 +517,7 @@ static void
pptp_sccrq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_sccrq *ptr = (struct pptp_msg_sccrq *)dat;
+ const struct pptp_msg_sccrq *ptr = (const struct pptp_msg_sccrq *)dat;
ND_TCHECK(ptr->proto_ver);
pptp_proto_ver_print(ndo, &ptr->proto_ver);
@@ -545,7 +545,7 @@ static void
pptp_sccrp_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_sccrp *ptr = (struct pptp_msg_sccrp *)dat;
+ const struct pptp_msg_sccrp *ptr = (const struct pptp_msg_sccrp *)dat;
ND_TCHECK(ptr->proto_ver);
pptp_proto_ver_print(ndo, &ptr->proto_ver);
@@ -576,7 +576,7 @@ static void
pptp_stopccrq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_stopccrq *ptr = (struct pptp_msg_stopccrq *)dat;
+ const struct pptp_msg_stopccrq *ptr = (const struct pptp_msg_stopccrq *)dat;
ND_TCHECK(ptr->reason);
ND_PRINT((ndo, " REASON(%u", ptr->reason));
@@ -610,7 +610,7 @@ static void
pptp_stopccrp_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_stopccrp *ptr = (struct pptp_msg_stopccrp *)dat;
+ const struct pptp_msg_stopccrp *ptr = (const struct pptp_msg_stopccrp *)dat;
ND_TCHECK(ptr->result_code);
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_StopCCRP);
@@ -628,7 +628,7 @@ static void
pptp_echorq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_echorq *ptr = (struct pptp_msg_echorq *)dat;
+ const struct pptp_msg_echorq *ptr = (const struct pptp_msg_echorq *)dat;
ND_TCHECK(ptr->id);
pptp_id_print(ndo, &ptr->id);
@@ -643,7 +643,7 @@ static void
pptp_echorp_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_echorp *ptr = (struct pptp_msg_echorp *)dat;
+ const struct pptp_msg_echorp *ptr = (const struct pptp_msg_echorp *)dat;
ND_TCHECK(ptr->id);
pptp_id_print(ndo, &ptr->id);
@@ -663,7 +663,7 @@ static void
pptp_ocrq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_ocrq *ptr = (struct pptp_msg_ocrq *)dat;
+ const struct pptp_msg_ocrq *ptr = (const struct pptp_msg_ocrq *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -699,7 +699,7 @@ static void
pptp_ocrp_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_ocrp *ptr = (struct pptp_msg_ocrp *)dat;
+ const struct pptp_msg_ocrp *ptr = (const struct pptp_msg_ocrp *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -730,7 +730,7 @@ static void
pptp_icrq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_icrq *ptr = (struct pptp_msg_icrq *)dat;
+ const struct pptp_msg_icrq *ptr = (const struct pptp_msg_icrq *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -761,7 +761,7 @@ static void
pptp_icrp_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_icrp *ptr = (struct pptp_msg_icrp *)dat;
+ const struct pptp_msg_icrp *ptr = (const struct pptp_msg_icrp *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -787,7 +787,7 @@ static void
pptp_iccn_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_iccn *ptr = (struct pptp_msg_iccn *)dat;
+ const struct pptp_msg_iccn *ptr = (const struct pptp_msg_iccn *)dat;
ND_TCHECK(ptr->peer_call_id);
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -811,7 +811,7 @@ static void
pptp_ccrq_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_ccrq *ptr = (struct pptp_msg_ccrq *)dat;
+ const struct pptp_msg_ccrq *ptr = (const struct pptp_msg_ccrq *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -827,7 +827,7 @@ static void
pptp_cdn_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_cdn *ptr = (struct pptp_msg_cdn *)dat;
+ const struct pptp_msg_cdn *ptr = (const struct pptp_msg_cdn *)dat;
ND_TCHECK(ptr->call_id);
pptp_call_id_print(ndo, &ptr->call_id);
@@ -851,7 +851,7 @@ static void
pptp_wen_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_wen *ptr = (struct pptp_msg_wen *)dat;
+ const struct pptp_msg_wen *ptr = (const struct pptp_msg_wen *)dat;
ND_TCHECK(ptr->peer_call_id);
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -879,7 +879,7 @@ static void
pptp_sli_print(netdissect_options *ndo,
const u_char *dat)
{
- struct pptp_msg_sli *ptr = (struct pptp_msg_sli *)dat;
+ const struct pptp_msg_sli *ptr = (const struct pptp_msg_sli *)dat;
ND_TCHECK(ptr->peer_call_id);
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -905,7 +905,7 @@ pptp_print(netdissect_options *ndo,
ND_PRINT((ndo, ": pptp"));
- hdr = (struct pptp_hdr *)dat;
+ hdr = (const struct pptp_hdr *)dat;
ND_TCHECK(hdr->length);
if (ndo->ndo_vflag) {
diff --git a/print-radius.c b/print-radius.c
index c66c7938..02d6a599 100644
--- a/print-radius.c
+++ b/print-radius.c
@@ -161,12 +161,12 @@ static const struct tok rfc4675_tagged[] = {
};
-static void print_attr_string(netdissect_options *, register u_char *, u_int, u_short );
-static void print_attr_num(netdissect_options *, register u_char *, u_int, u_short );
-static void print_vendor_attr(netdissect_options *, register u_char *, u_int, u_short );
-static void print_attr_address(netdissect_options *, register u_char *, u_int, u_short);
-static void print_attr_time(netdissect_options *, register u_char *, u_int, u_short);
-static void print_attr_strange(netdissect_options *, register u_char *, u_int, u_short);
+static void print_attr_string(netdissect_options *, register const u_char *, u_int, u_short );
+static void print_attr_num(netdissect_options *, register const u_char *, u_int, u_short );
+static void print_vendor_attr(netdissect_options *, register const u_char *, u_int, u_short );
+static void print_attr_address(netdissect_options *, register const u_char *, u_int, u_short);
+static void print_attr_time(netdissect_options *, register const u_char *, u_int, u_short);
+static void print_attr_strange(netdissect_options *, register const u_char *, u_int, u_short);
struct radius_hdr { uint8_t code; /* Radius packet code */
@@ -368,7 +368,7 @@ struct attrtype { const char *name; /* Attribute name */
const char **subtypes; /* Standard Values (if any) */
u_char siz_subtypes; /* Size of total standard values */
u_char first_subtype; /* First standard value is 0 or 1 */
- void (*print_func)(netdissect_options *, register u_char *, u_int, u_short);
+ void (*print_func)(netdissect_options *, register const u_char *, u_int, u_short);
} attr_type[]=
{
{ NULL, NULL, 0, 0, NULL },
@@ -477,7 +477,7 @@ struct attrtype { const char *name; /* Attribute name */
/*****************************/
static void
print_attr_string(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code)
+ register const u_char *data, u_int length, u_short attr_code)
{
register u_int i;
@@ -545,7 +545,7 @@ print_attr_string(netdissect_options *ndo,
*/
static void
print_vendor_attr(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code _U_)
+ register const u_char *data, u_int length, u_short attr_code _U_)
{
u_int idx;
u_int vendor_id;
@@ -610,7 +610,7 @@ print_vendor_attr(netdissect_options *ndo,
/******************************/
static void
print_attr_num(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code)
+ register const u_char *data, u_int length, u_short attr_code)
{
uint32_t timeout;
@@ -733,7 +733,7 @@ print_attr_num(netdissect_options *ndo,
/*****************************/
static void
print_attr_address(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code)
+ register const u_char *data, u_int length, u_short attr_code)
{
if (length != 4)
{
@@ -777,7 +777,7 @@ print_attr_address(netdissect_options *ndo,
/*************************************/
static void
print_attr_time(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code _U_)
+ register const u_char *data, u_int length, u_short attr_code _U_)
{
time_t attr_time;
char string[26];
@@ -810,7 +810,7 @@ print_attr_time(netdissect_options *ndo,
/***********************************/
static void
print_attr_strange(netdissect_options *ndo,
- register u_char *data, u_int length, u_short attr_code)
+ register const u_char *data, u_int length, u_short attr_code)
{
u_short len_data;
@@ -883,7 +883,7 @@ static void
radius_attrs_print(netdissect_options *ndo,
register const u_char *attr, u_int length)
{
- register const struct radius_attr *rad_attr = (struct radius_attr *)attr;
+ register const struct radius_attr *rad_attr = (const struct radius_attr *)attr;
const char *attr_string;
while (length > 0)
@@ -923,16 +923,16 @@ radius_attrs_print(netdissect_options *ndo,
{
if ( attr_type[rad_attr->type].print_func )
(*attr_type[rad_attr->type].print_func)(
- ndo, ((u_char *)(rad_attr+1)),
+ ndo, ((const u_char *)(rad_attr+1)),
rad_attr->len - 2, rad_attr->type);
}
}
/* do we also want to see a hex dump ? */
if (ndo->ndo_vflag> 1)
- print_unknown_data(ndo, (u_char *)rad_attr+2, "\n\t ", (rad_attr->len)-2);
+ print_unknown_data(ndo, (const u_char *)rad_attr+2, "\n\t ", (rad_attr->len)-2);
length-=(rad_attr->len);
- rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len);
+ rad_attr = (const struct radius_attr *)( ((const char *)(rad_attr))+rad_attr->len);
}
return;
@@ -948,7 +948,7 @@ radius_print(netdissect_options *ndo,
u_int len, auth_idx;
ND_TCHECK2(*dat, MIN_RADIUS_LEN);
- rad = (struct radius_hdr *)dat;
+ rad = (const struct radius_hdr *)dat;
len = EXTRACT_16BITS(&rad->len);
if (len < MIN_RADIUS_LEN)
diff --git a/print-rip.c b/print-rip.c
index e76c56f6..3c64bf9a 100644
--- a/print-rip.c
+++ b/print-rip.c
@@ -101,14 +101,14 @@ rip_entry_print_v1(netdissect_options *ndo,
family = EXTRACT_16BITS(&ni->rip_family);
if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family)));
- print_unknown_data(ndo, (uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
+ print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
}
if (EXTRACT_16BITS(&ni->rip_tag) ||
EXTRACT_32BITS(&ni->rip_dest_mask) ||
EXTRACT_32BITS(&ni->rip_router)) {
/* MBZ fields not zero */
- print_unknown_data(ndo, (uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
+ print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
}
if (family == 0) {
@@ -132,31 +132,31 @@ rip_entry_print_v2(netdissect_options *ndo,
if (family == 0xFFFF) { /* variable-sized authentication structures */
uint16_t auth_type = EXTRACT_16BITS(&ni->rip_tag);
if (auth_type == 2) {
- register u_char *p = (u_char *)&ni->rip_dest;
+ register const u_char *p = (const u_char *)&ni->rip_dest;
u_int i = 0;
ND_PRINT((ndo, "\n\t Simple Text Authentication data: "));
for (; i < RIP_AUTHLEN; p++, i++)
ND_PRINT((ndo, "%c", ND_ISPRINT(*p) ? *p : '.'));
} else if (auth_type == 3) {
ND_PRINT((ndo, "\n\t Auth header:"));
- ND_PRINT((ndo, " Packet Len %u,", EXTRACT_16BITS((uint8_t *)ni + 4)));
- ND_PRINT((ndo, " Key-ID %u,", *((uint8_t *)ni + 6)));
- ND_PRINT((ndo, " Auth Data Len %u,", *((uint8_t *)ni + 7)));
+ ND_PRINT((ndo, " Packet Len %u,", EXTRACT_16BITS((const uint8_t *)ni + 4)));
+ ND_PRINT((ndo, " Key-ID %u,", *((const uint8_t *)ni + 6)));
+ ND_PRINT((ndo, " Auth Data Len %u,", *((const uint8_t *)ni + 7)));
ND_PRINT((ndo, " SeqNo %u,", EXTRACT_32BITS(&ni->rip_dest_mask)));
ND_PRINT((ndo, " MBZ %u,", EXTRACT_32BITS(&ni->rip_router)));
ND_PRINT((ndo, " MBZ %u", EXTRACT_32BITS(&ni->rip_metric)));
} else if (auth_type == 1) {
ND_PRINT((ndo, "\n\t Auth trailer:"));
- print_unknown_data(ndo, (uint8_t *)&ni->rip_dest, "\n\t ", remaining);
+ print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
return remaining; /* AT spans till the packet end */
} else {
ND_PRINT((ndo, "\n\t Unknown (%u) Authentication data:",
EXTRACT_16BITS(&ni->rip_tag)));
- print_unknown_data(ndo, (uint8_t *)&ni->rip_dest, "\n\t ", remaining);
+ print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
}
} else if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s", tok2str(bsd_af_values, "Unknown (%u)", family)));
- print_unknown_data(ndo, (uint8_t *)&ni->rip_tag, "\n\t ", RIP_ROUTELEN-2);
+ print_unknown_data(ndo, (const uint8_t *)&ni->rip_tag, "\n\t ", RIP_ROUTELEN-2);
} else { /* BSD_AFNUM_INET or AFI 0 */
ND_PRINT((ndo, "\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ",
tok2str(bsd_af_values, "%u", family),
@@ -193,7 +193,7 @@ rip_print(netdissect_options *ndo,
}
i -= sizeof(*rp);
- rp = (struct rip *)dat;
+ rp = (const struct rip *)dat;
ND_PRINT((ndo, "%sRIPv%u",
(ndo->ndo_vflag >= 1) ? "\n\t" : "",
@@ -212,7 +212,7 @@ rip_print(netdissect_options *ndo,
*
* so perhaps we should just dump the packet, in hex.
*/
- print_unknown_data(ndo, (uint8_t *)&rp->rip_cmd, "\n\t", length);
+ print_unknown_data(ndo, (const uint8_t *)&rp->rip_cmd, "\n\t", length);
break;
default:
/* dump version and lets see if we know the commands name*/
@@ -230,7 +230,7 @@ rip_print(netdissect_options *ndo,
case RIPCMD_RESPONSE:
j = length / sizeof(*ni);
ND_PRINT((ndo, ", routes: %u%s", j, rp->rip_vers == 2 ? " or less" : ""));
- ni = (struct rip_netinfo *)(rp + 1);
+ ni = (const struct rip_netinfo *)(rp + 1);
for (; i >= sizeof(*ni); ++ni) {
if (rp->rip_vers == 1)
{
@@ -255,14 +255,14 @@ rip_print(netdissect_options *ndo,
/* fall through */
default:
if (ndo->ndo_vflag <= 1) {
- if(!print_unknown_data(ndo, (uint8_t *)rp, "\n\t", length))
+ if(!print_unknown_data(ndo, (const uint8_t *)rp, "\n\t", length))
return;
}
break;
}
/* do we want to see an additionally hexdump ? */
if (ndo->ndo_vflag> 1) {
- if(!print_unknown_data(ndo, (uint8_t *)rp, "\n\t", length))
+ if(!print_unknown_data(ndo, (const uint8_t *)rp, "\n\t", length))
return;
}
}
diff --git a/print-ripng.c b/print-ripng.c
index a0318d15..afe1c5e6 100644
--- a/print-ripng.c
+++ b/print-ripng.c
@@ -108,7 +108,7 @@ rip6_entry_print(netdissect_options *ndo, register const struct netinfo6 *ni, in
void
ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
{
- register const struct rip6 *rp = (struct rip6 *)dat;
+ register const struct rip6 *rp = (const struct rip6 *)dat;
register const struct netinfo6 *ni;
register u_int amt;
register u_int i;
diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c
index c9c4e0ab..409125da 100644
--- a/print-rpki-rtr.c
+++ b/print-rpki-rtr.c
@@ -174,7 +174,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
u_int pdu_type, pdu_len, hexdump;
const u_char *msg;
- pdu_header = (rpki_rtr_pdu *)tptr;
+ pdu_header = (const rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
ND_TCHECK2(*tptr, pdu_len);
@@ -220,9 +220,9 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
case RPKI_RTR_IPV4_PREFIX_PDU:
{
- rpki_rtr_pdu_ipv4_prefix *pdu;
+ const rpki_rtr_pdu_ipv4_prefix *pdu;
- pdu = (rpki_rtr_pdu_ipv4_prefix *)tptr;
+ pdu = (const rpki_rtr_pdu_ipv4_prefix *)tptr;
ND_PRINT((ndo, "%sIPv4 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",
indent_string(indent+2),
ipaddr_string(ndo, pdu->prefix),
@@ -234,9 +234,9 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
#ifdef INET6
case RPKI_RTR_IPV6_PREFIX_PDU:
{
- rpki_rtr_pdu_ipv6_prefix *pdu;
+ const rpki_rtr_pdu_ipv6_prefix *pdu;
- pdu = (rpki_rtr_pdu_ipv6_prefix *)tptr;
+ pdu = (const rpki_rtr_pdu_ipv6_prefix *)tptr;
ND_PRINT((ndo, "%sIPv6 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",
indent_string(indent+2),
ip6addr_string(ndo, pdu->prefix),
@@ -248,10 +248,10 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
case RPKI_RTR_ERROR_REPORT_PDU:
{
- rpki_rtr_pdu_error_report *pdu;
+ const rpki_rtr_pdu_error_report *pdu;
u_int encapsulated_pdu_length, text_length, tlen, error_code;
- pdu = (rpki_rtr_pdu_error_report *)tptr;
+ pdu = (const rpki_rtr_pdu_error_report *)tptr;
encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
ND_TCHECK2(*tptr, encapsulated_pdu_length);
tlen = pdu_len;
@@ -332,7 +332,7 @@ rpki_rtr_print(netdissect_options *ndo, register const u_char *pptr, register u_
ND_TCHECK2(*tptr, sizeof(rpki_rtr_pdu));
- pdu_header = (rpki_rtr_pdu *)tptr;
+ pdu_header = (const rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
ND_TCHECK2(*tptr, pdu_len);
diff --git a/print-rt6.c b/print-rt6.c
index baa6945e..8c1ff6a9 100644
--- a/print-rt6.c
+++ b/print-rt6.c
@@ -45,7 +45,7 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2
register const struct in6_addr *addr;
const struct in6_addr *last_addr = NULL;
- dp = (struct ip6_rthdr *)bp;
+ dp = (const struct ip6_rthdr *)bp;
len = dp->ip6r_len;
/* 'ep' points to the end of available data. */
@@ -66,7 +66,7 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2
#endif
case IPV6_RTHDR_TYPE_0:
case IPV6_RTHDR_TYPE_2: /* Mobile IPv6 ID-20 */
- dp0 = (struct ip6_rthdr0 *)dp;
+ dp0 = (const struct ip6_rthdr0 *)dp;
ND_TCHECK(dp0->ip6r0_reserved);
if (dp0->ip6r0_reserved || ndo->ndo_vflag) {
@@ -79,7 +79,7 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2
len >>= 1;
addr = &dp0->ip6r0_addr[0];
for (i = 0; i < len; i++) {
- if ((u_char *)(addr + 1) > ep)
+ if ((const u_char *)(addr + 1) > ep)
goto trunc;
ND_PRINT((ndo, ", [%d]%s", i, ip6addr_string(ndo, addr)));
@@ -91,7 +91,7 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2
* destination : the last address of the routing header
*/
if (last_addr != NULL) {
- struct ip6_hdr *ip6 = (struct ip6_hdr *)bp2;
+ const struct ip6_hdr *ip6 = (const struct ip6_hdr *)bp2;
UNALIGNED_MEMCPY(&ip6->ip6_dst, last_addr, sizeof (struct in6_addr));
}
/*(*/
diff --git a/print-rx.c b/print-rx.c
index d2935a46..53d3a1d6 100644
--- a/print-rx.c
+++ b/print-rx.c
@@ -521,9 +521,9 @@ static int is_ubik(uint32_t);
void
rx_print(netdissect_options *ndo,
register const u_char *bp, int length, int sport, int dport,
- u_char *bp2)
+ const u_char *bp2)
{
- register struct rx_header *rxh;
+ register const struct rx_header *rxh;
int i;
int32_t opcode;
@@ -532,7 +532,7 @@ rx_print(netdissect_options *ndo,
return;
}
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
ND_PRINT((ndo, " rx %s", tok2str(rx_types, "type %d", rxh->type)));
@@ -950,7 +950,7 @@ fs_print(netdissect_options *ndo,
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
- strncpy(a, (char *) bp, i);
+ strncpy(a, (const char *) bp, i);
a[i] = '\0';
acl_print(ndo, (u_char *) a, sizeof(a), (u_char *) a + i);
break;
@@ -1053,12 +1053,12 @@ fs_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
unsigned long i;
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length <= (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -1083,7 +1083,7 @@ fs_reply_print(netdissect_options *ndo,
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
- strncpy(a, (char *) bp, i);
+ strncpy(a, (const char *) bp, i);
a[i] = '\0';
acl_print(ndo, (u_char *) a, sizeof(a), (u_char *) a + i);
break;
@@ -1298,12 +1298,12 @@ static void
cb_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length <= (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -1492,13 +1492,13 @@ static void
prot_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
unsigned long i;
if (length < (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -1699,13 +1699,13 @@ static void
vldb_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
unsigned long i;
if (length < (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -1751,7 +1751,7 @@ vldb_reply_print(netdissect_options *ndo,
ND_TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
ND_PRINT((ndo, " %s",
- intoa(((struct in_addr *) bp)->s_addr)));
+ intoa(((const struct in_addr *) bp)->s_addr)));
bp += sizeof(int32_t);
}
ND_PRINT((ndo, " partitions"));
@@ -1798,7 +1798,7 @@ vldb_reply_print(netdissect_options *ndo,
ND_TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
ND_PRINT((ndo, " %s",
- intoa(((struct in_addr *) bp)->s_addr)));
+ intoa(((const struct in_addr *) bp)->s_addr)));
bp += sizeof(int32_t);
}
ND_PRINT((ndo, " partitions"));
@@ -1981,12 +1981,12 @@ static void
kauth_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length <= (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -2235,12 +2235,12 @@ static void
vol_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length <= (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -2462,12 +2462,12 @@ static void
bos_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length <= (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
@@ -2631,12 +2631,12 @@ static void
ubik_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
- struct rx_header *rxh;
+ const struct rx_header *rxh;
if (length < (int)sizeof(struct rx_header))
return;
- rxh = (struct rx_header *) bp;
+ rxh = (const struct rx_header *) bp;
/*
* Print out the ubik call we're invoking. This table was gleaned
@@ -2695,7 +2695,7 @@ static void
rx_ack_print(netdissect_options *ndo,
register const u_char *bp, int length)
{
- struct rx_ackPacket *rxa;
+ const struct rx_ackPacket *rxa;
int i, start, last;
uint32_t firstPacket;
@@ -2714,7 +2714,7 @@ rx_ack_print(netdissect_options *ndo,
ND_TCHECK2(bp[0], sizeof(struct rx_ackPacket) - RX_MAXACKS);
- rxa = (struct rx_ackPacket *) bp;
+ rxa = (const struct rx_ackPacket *) bp;
bp += (sizeof(struct rx_ackPacket) - RX_MAXACKS);
/*
diff --git a/print-sctp.c b/print-sctp.c
index d48202f5..6c41766d 100644
--- a/print-sctp.c
+++ b/print-sctp.c
@@ -514,7 +514,7 @@ void sctp_print(netdissect_options *ndo,
if( (u_long) endPacketPtr > (u_long) ndo->ndo_snapend)
endPacketPtr = (const void *) ndo->ndo_snapend;
- ip = (struct ip *)bp2;
+ ip = (const struct ip *)bp2;
#ifdef INET6
if (IP_V(ip) == 6)
ip6 = (const struct ip6_hdr *)bp2;
@@ -588,7 +588,7 @@ void sctp_print(netdissect_options *ndo,
break;
}
- ND_TCHECK2(*((uint8_t *)chunkDescPtr), chunkLength);
+ ND_TCHECK2(*((const uint8_t *)chunkDescPtr), chunkLength);
chunkEnd = ((const u_char*)chunkDescPtr + chunkLength);
align=chunkLength % 4;
diff --git a/print-sflow.c b/print-sflow.c
index 708f7605..ed2dee2b 100644
--- a/print-sflow.c
+++ b/print-sflow.c
@@ -761,7 +761,7 @@ sflow_print_flow_sample(netdissect_options *ndo,
if (len < sizeof(struct sflow_flow_sample_t))
return 1;
- sflow_flow_sample = (struct sflow_flow_sample_t *)pointer;
+ sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer;
typesource = EXTRACT_32BITS(sflow_flow_sample->typesource);
nrecords = EXTRACT_32BITS(sflow_flow_sample->records);
diff --git a/print-sl.c b/print-sl.c
index cdf99455..87daa47f 100644
--- a/print-sl.c
+++ b/print-sl.c
@@ -68,17 +68,17 @@ sl_if_print(netdissect_options *ndo,
length -= SLIP_HDRLEN;
- ip = (struct ip *)(p + SLIP_HDRLEN);
+ ip = (const struct ip *)(p + SLIP_HDRLEN);
if (ndo->ndo_eflag)
sliplink_print(ndo, p, ip, length);
switch (IP_V(ip)) {
case 4:
- ip_print(ndo, (u_char *)ip, length);
+ ip_print(ndo, (const u_char *)ip, length);
break;
case 6:
- ip6_print(ndo, (u_char *)ip, length);
+ ip6_print(ndo, (const u_char *)ip, length);
break;
default:
ND_PRINT((ndo, "ip v%d", IP_V(ip)));
@@ -102,14 +102,14 @@ sl_bsdos_if_print(netdissect_options *ndo,
length -= SLIP_HDRLEN;
- ip = (struct ip *)(p + SLIP_HDRLEN);
+ ip = (const struct ip *)(p + SLIP_HDRLEN);
#ifdef notdef
if (ndo->ndo_eflag)
sliplink_print(ndo, p, ip, length);
#endif
- ip_print(ndo, (u_char *)ip, length);
+ ip_print(ndo, (const u_char *)ip, length);
return (SLIP_HDRLEN);
}
@@ -146,9 +146,9 @@ sliplink_print(netdissect_options *ndo,
* Get it from the link layer since sl_uncompress_tcp()
* has restored the IP header copy to IPPROTO_TCP.
*/
- lastconn = ((struct ip *)&p[SLX_CHDR])->ip_p;
+ lastconn = ((const struct ip *)&p[SLX_CHDR])->ip_p;
hlen = IP_HL(ip);
- hlen += TH_OFF((struct tcphdr *)&((int *)ip)[hlen]);
+ hlen += TH_OFF((const struct tcphdr *)&((const int *)ip)[hlen]);
lastlen[dir][lastconn] = length - (hlen << 2);
ND_PRINT((ndo, "utcp %d: ", lastconn));
break;
@@ -241,7 +241,7 @@ compressed_sl_print(netdissect_options *ndo,
* 'length - hlen' is the amount of data in the packet.
*/
hlen = IP_HL(ip);
- hlen += TH_OFF((struct tcphdr *)&((int32_t *)ip)[hlen]);
+ hlen += TH_OFF((const struct tcphdr *)&((const int32_t *)ip)[hlen]);
lastlen[dir][lastconn] = length - (hlen << 2);
ND_PRINT((ndo, " %d (%ld)", lastlen[dir][lastconn], (long)(cp - chdr)));
}
diff --git a/print-slow.c b/print-slow.c
index 968534e5..b46ae007 100644
--- a/print-slow.c
+++ b/print-slow.c
@@ -476,7 +476,7 @@ slow_oam_print(netdissect_options *ndo,
const struct slow_oam_loopbackctrl_t *slow_oam_loopbackctrl;
} tlv;
- ptr.slow_oam_common_header = (struct slow_oam_common_header_t *)tptr;
+ ptr.slow_oam_common_header = (const struct slow_oam_common_header_t *)tptr;
tptr += sizeof(struct slow_oam_common_header_t);
tlen -= sizeof(struct slow_oam_common_header_t);
diff --git a/print-snmp.c b/print-snmp.c
index 04654f45..b9372644 100644
--- a/print-snmp.c
+++ b/print-snmp.c
@@ -324,7 +324,7 @@ static const struct obj_abrev {
struct be {
uint32_t asnlen;
union {
- caddr_t raw;
+ const uint8_t *raw;
int32_t integer;
uint32_t uns;
const u_char *str;
@@ -524,7 +524,7 @@ asn1_parse(netdissect_options *ndo,
case OBJECTID:
elem->type = BE_OID;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
break;
case ASN_NULL:
@@ -534,7 +534,7 @@ asn1_parse(netdissect_options *ndo,
default:
elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
ND_PRINT((ndo, "[P/U/%s]", Class[class].Id[id]));
break;
}
@@ -544,7 +544,7 @@ asn1_parse(netdissect_options *ndo,
switch (id) {
case IPADDR:
elem->type = BE_INETADDR;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
break;
case COUNTER:
@@ -577,7 +577,7 @@ asn1_parse(netdissect_options *ndo,
default:
elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
ND_PRINT((ndo, "[P/A/%s]",
Class[class].Id[id]));
break;
@@ -607,7 +607,7 @@ asn1_parse(netdissect_options *ndo,
ND_PRINT((ndo, "[P/%s/%s]", Class[class].name, Class[class].Id[id]));
ND_TCHECK2(*p, elem->asnlen);
elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
break;
}
break;
@@ -618,12 +618,12 @@ asn1_parse(netdissect_options *ndo,
switch (id) {
case SEQUENCE:
elem->type = BE_SEQ;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
break;
default:
elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
ND_PRINT((ndo, "C/U/%s", Class[class].Id[id]));
break;
}
@@ -631,12 +631,12 @@ asn1_parse(netdissect_options *ndo,
case CONTEXT:
elem->type = BE_PDU;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
break;
default:
elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
+ elem->data.raw = (const uint8_t *)p;
ND_PRINT((ndo, "C/%s/%s", Class[class].name, Class[class].Id[id]));
break;
}
@@ -660,7 +660,7 @@ static int
asn1_print(netdissect_options *ndo,
struct be *elem)
{
- u_char *p = (u_char *)elem->data.raw;
+ const u_char *p = (const u_char *)elem->data.raw;
uint32_t asnlen = elem->asnlen;
uint32_t i;
@@ -683,7 +683,7 @@ asn1_print(netdissect_options *ndo,
size_t a_len = strlen(a->oid);
for (; a->node; a++) {
ND_TCHECK2(*p, a_len);
- if (memcmp(a->oid, (char *)p, a_len) == 0) {
+ if (memcmp(a->oid, p, a_len) == 0) {
objp = a->node->child;
i -= strlen(a->oid);
p += strlen(a->oid);
@@ -894,7 +894,7 @@ smi_decode_oid(netdissect_options *ndo,
struct be *elem, unsigned int *oid,
unsigned int oidsize, unsigned int *oidlen)
{
- u_char *p = (u_char *)elem->data.raw;
+ const u_char *p = (const u_char *)elem->data.raw;
uint32_t asnlen = elem->asnlen;
int o = 0, first = -1, i = asnlen;
unsigned int firstval;
@@ -1216,7 +1216,7 @@ varbind_print(netdissect_options *ndo,
ND_PRINT((ndo, "[%d extra after SEQ of varbind]", length - count));
/* descend */
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
for (ind = 1; length > 0; ind++) {
const u_char *vbend;
@@ -1236,7 +1236,7 @@ varbind_print(netdissect_options *ndo,
vblength = length - count;
/* descend */
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
/* objName (OID) */
if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
@@ -1485,7 +1485,7 @@ pdu_print(netdissect_options *ndo,
ND_PRINT((ndo, " "));
/* descend into PDU */
length = pdu.asnlen;
- np = (u_char *)pdu.data.raw;
+ np = (const u_char *)pdu.data.raw;
if (version == SNMP_VERSION_1 &&
(pdu.id == GETBULKREQ || pdu.id == INFORMREQ ||
@@ -1539,7 +1539,7 @@ scopedpdu_print(netdissect_options *ndo,
return;
}
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
/* contextEngineID (OCTET STRING) */
if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
@@ -1594,7 +1594,7 @@ community_print(netdissect_options *ndo,
}
/* default community */
if (!(elem.asnlen == sizeof(DEF_COMMUNITY) - 1 &&
- strncmp((char *)elem.data.str, DEF_COMMUNITY,
+ strncmp((const char *)elem.data.str, DEF_COMMUNITY,
sizeof(DEF_COMMUNITY) - 1) == 0))
/* ! "public" */
ND_PRINT((ndo, "C=%.*s ", (int)elem.asnlen, elem.data.str));
@@ -1623,7 +1623,7 @@ usm_print(netdissect_options *ndo,
return;
}
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
/* msgAuthoritativeEngineID (OCTET STRING) */
if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
@@ -1724,7 +1724,7 @@ v3msg_print(netdissect_options *ndo,
return;
}
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "{ "));
@@ -1863,7 +1863,7 @@ snmp_print(netdissect_options *ndo,
ND_PRINT((ndo, "[%d extra after iSEQ]", length - count));
/* descend */
length = elem.asnlen;
- np = (u_char *)elem.data.raw;
+ np = (const u_char *)elem.data.raw;
/* Version (INTEGER) */
if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
diff --git a/print-stp.c b/print-stp.c
index a89932d6..d3879615 100644
--- a/print-stp.c
+++ b/print-stp.c
@@ -368,7 +368,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length)
u_int mstp_len;
u_int spb_len;
- stp_bpdu = (struct stp_bpdu_*)p;
+ stp_bpdu = (const struct stp_bpdu_*)p;
/* Minimum STP Frame size. */
if (length < 4)
diff --git a/print-sunrpc.c b/print-sunrpc.c
index 1bca04e4..e1da350a 100644
--- a/print-sunrpc.c
+++ b/print-sunrpc.c
@@ -176,7 +176,7 @@ sunrpcrequest_print(netdissect_options *ndo, register const u_char *bp,
uint32_t x;
char srcid[20], dstid[20]; /*fits 32bit*/
- rp = (struct sunrpc_msg *)bp;
+ rp = (const struct sunrpc_msg *)bp;
if (!ndo->ndo_nflag) {
snprintf(srcid, sizeof(srcid), "0x%x",
@@ -188,16 +188,16 @@ sunrpcrequest_print(netdissect_options *ndo, register const u_char *bp,
snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
}
- switch (IP_V((struct ip *)bp2)) {
+ switch (IP_V((const struct ip *)bp2)) {
case 4:
- ip = (struct ip *)bp2;
+ ip = (const struct ip *)bp2;
ND_PRINT((ndo, "%s.%s > %s.%s: %d",
ipaddr_string(ndo, &ip->ip_src), srcid,
ipaddr_string(ndo, &ip->ip_dst), dstid, length));
break;
#ifdef INET6
case 6:
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
ND_PRINT((ndo, "%s.%s > %s.%s: %d",
ip6addr_string(ndo, &ip6->ip6_src), srcid,
ip6addr_string(ndo, &ip6->ip6_dst), dstid, length));
diff --git a/print-symantec.c b/print-symantec.c
index 665dbcc2..e4328880 100644
--- a/print-symantec.c
+++ b/print-symantec.c
@@ -74,7 +74,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
{
u_int length = h->len;
u_int caplen = h->caplen;
- struct symantec_header *sp;
+ const struct symantec_header *sp;
u_short ether_type;
if (caplen < sizeof (struct symantec_header)) {
@@ -87,7 +87,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
length -= sizeof (struct symantec_header);
caplen -= sizeof (struct symantec_header);
- sp = (struct symantec_header *)p;
+ sp = (const struct symantec_header *)p;
p += sizeof (struct symantec_header);
ether_type = EXTRACT_16BITS(&sp->ether_type);
@@ -95,14 +95,14 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
if (ether_type <= ETHERMTU) {
/* ether_type not known, print raw packet */
if (!ndo->ndo_eflag)
- symantec_hdr_print(ndo, (u_char *)sp, length + sizeof (struct symantec_header));
+ symantec_hdr_print(ndo, (const u_char *)sp, length + sizeof (struct symantec_header));
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
} else if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
/* ether_type not known, print raw packet */
if (!ndo->ndo_eflag)
- symantec_hdr_print(ndo, (u_char *)sp, length + sizeof (struct symantec_header));
+ symantec_hdr_print(ndo, (const u_char *)sp, length + sizeof (struct symantec_header));
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
diff --git a/print-tcp.c b/print-tcp.c
index 5c979235..9334a2d0 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -170,11 +170,11 @@ tcp_print(netdissect_options *ndo,
register const struct ip6_hdr *ip6;
#endif
- tp = (struct tcphdr *)bp;
- ip = (struct ip *)bp2;
+ tp = (const struct tcphdr *)bp;
+ ip = (const struct ip *)bp2;
#ifdef INET6
if (IP_V(ip) == 6)
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
#endif /*INET6*/
@@ -724,23 +724,23 @@ tcp_print(netdissect_options *ndo,
* to NFS print routines.
*/
uint32_t fraglen;
- register struct sunrpc_msg *rp;
+ register const struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
fraglen = EXTRACT_32BITS(bp) & 0x7FFFFFFF;
if (fraglen > (length) - 4)
fraglen = (length) - 4;
- rp = (struct sunrpc_msg *)(bp + 4);
+ rp = (const struct sunrpc_msg *)(bp + 4);
if (ND_TTEST(rp->rm_direction)) {
direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreq_print_noaddr(ndo, (u_char *)rp, fraglen, (u_char *)ip);
+ nfsreq_print_noaddr(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreply_print_noaddr(ndo, (u_char *)rp, fraglen, (u_char *)ip);
+ nfsreply_print_noaddr(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
}
@@ -829,7 +829,7 @@ tcp_verify_signature(netdissect_options *ndo,
MD5_CTX ctx;
uint16_t savecsum, tlen;
#ifdef INET6
- struct ip6_hdr *ip6;
+ const struct ip6_hdr *ip6;
uint32_t len32;
uint8_t nxt;
#endif
@@ -851,26 +851,26 @@ tcp_verify_signature(netdissect_options *ndo,
* Step 1: Update MD5 hash with IP pseudo-header.
*/
if (IP_V(ip) == 4) {
- MD5_Update(&ctx, (char *)&ip->ip_src, sizeof(ip->ip_src));
- MD5_Update(&ctx, (char *)&ip->ip_dst, sizeof(ip->ip_dst));
- MD5_Update(&ctx, (char *)&zero_proto, sizeof(zero_proto));
- MD5_Update(&ctx, (char *)&ip->ip_p, sizeof(ip->ip_p));
+ MD5_Update(&ctx, (const char *)&ip->ip_src, sizeof(ip->ip_src));
+ MD5_Update(&ctx, (const char *)&ip->ip_dst, sizeof(ip->ip_dst));
+ MD5_Update(&ctx, (const char *)&zero_proto, sizeof(zero_proto));
+ MD5_Update(&ctx, (const char *)&ip->ip_p, sizeof(ip->ip_p));
tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
tlen = htons(tlen);
- MD5_Update(&ctx, (char *)&tlen, sizeof(tlen));
+ MD5_Update(&ctx, (const char *)&tlen, sizeof(tlen));
#ifdef INET6
} else if (IP_V(ip) == 6) {
- ip6 = (struct ip6_hdr *)ip;
- MD5_Update(&ctx, (char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
- MD5_Update(&ctx, (char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
+ ip6 = (const struct ip6_hdr *)ip;
+ MD5_Update(&ctx, (const char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
+ MD5_Update(&ctx, (const char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
len32 = htonl(EXTRACT_16BITS(&ip6->ip6_plen));
- MD5_Update(&ctx, (char *)&len32, sizeof(len32));
+ MD5_Update(&ctx, (const char *)&len32, sizeof(len32));
nxt = 0;
- MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
- MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
- MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
nxt = IPPROTO_TCP;
- MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
#endif
} else {
#ifdef INET6
@@ -887,7 +887,7 @@ tcp_verify_signature(netdissect_options *ndo,
*/
savecsum = tp1.th_sum;
tp1.th_sum = 0;
- MD5_Update(&ctx, (char *)&tp1, sizeof(struct tcphdr));
+ MD5_Update(&ctx, (const char *)&tp1, sizeof(struct tcphdr));
tp1.th_sum = savecsum;
/*
* Step 3: Update MD5 hash with TCP segment data, if present.
diff --git a/print-tftp.c b/print-tftp.c
index acb8ca9d..d996b8cf 100644
--- a/print-tftp.c
+++ b/print-tftp.c
@@ -130,7 +130,7 @@ tftp_print(netdissect_options *ndo,
case RRQ:
case WRQ:
case OACK:
- p = (u_char *)tp->th_stuff;
+ p = (const u_char *)tp->th_stuff;
ND_PRINT((ndo, " "));
/* Print filename or first option */
if (opcode != OACK)
diff --git a/print-timed.c b/print-timed.c
index 1d8c5804..395ab4bb 100644
--- a/print-timed.c
+++ b/print-timed.c
@@ -94,7 +94,7 @@ void
timed_print(netdissect_options *ndo,
register const u_char *bp)
{
- struct tsp *tsp = (struct tsp *)bp;
+ const struct tsp *tsp = (const struct tsp *)bp;
long sec, usec;
ND_TCHECK(tsp->tsp_type);
@@ -137,7 +137,7 @@ timed_print(netdissect_options *ndo,
}
ND_TCHECK(tsp->tsp_name);
ND_PRINT((ndo, " name "));
- if (fn_print(ndo, (u_char *)tsp->tsp_name, (u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
+ if (fn_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name)))
goto trunc;
return;
diff --git a/print-tipc.c b/print-tipc.c
index f75d9f23..9c760fdd 100644
--- a/print-tipc.c
+++ b/print-tipc.c
@@ -341,7 +341,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
uint32_t w0;
u_int user;
- ap = (struct tipc_pkthdr *)bp;
+ ap = (const struct tipc_pkthdr *)bp;
ND_TCHECK(ap->w0);
w0 = EXTRACT_32BITS(&ap->w0);
user = TIPC_USER(w0);
@@ -354,11 +354,11 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
case TIPC_USER_CRITICAL_IMPORTANCE:
case TIPC_USER_NAME_DISTRIBUTOR:
case TIPC_USER_CONN_MANAGER:
- print_payload(ndo, (struct payload_tipc_pkthdr *)bp);
+ print_payload(ndo, (const struct payload_tipc_pkthdr *)bp);
break;
case TIPC_USER_LINK_CONFIG:
- print_link_conf(ndo, (struct link_conf_tipc_pkthdr *)bp);
+ print_link_conf(ndo, (const struct link_conf_tipc_pkthdr *)bp);
break;
case TIPC_USER_BCAST_PROTOCOL:
@@ -366,7 +366,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
case TIPC_USER_LINK_PROTOCOL:
case TIPC_USER_CHANGEOVER_PROTOCOL:
case TIPC_USER_MSG_FRAGMENTER:
- print_internal(ndo, (struct internal_tipc_pkthdr *)bp);
+ print_internal(ndo, (const struct internal_tipc_pkthdr *)bp);
break;
}
diff --git a/print-udp.c b/print-udp.c
index eddc771c..dc161abf 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -104,8 +104,8 @@ vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr
ts & 0x3ff, ts >> 10));
} else {
/* probably vat */
- uint32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
- uint32_t i1 = EXTRACT_32BITS(&((u_int *)hdr)[1]);
+ uint32_t i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ uint32_t i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
ND_PRINT((ndo, "udp/vat %u c%d %u%s",
(uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
i0 & 0xffff,
@@ -123,10 +123,10 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
register const struct udphdr *up)
{
/* rtp v1 or v2 */
- u_int *ip = (u_int *)hdr;
+ const u_int *ip = (const u_int *)hdr;
u_int hasopt, hasext, contype, hasmarker;
- uint32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
- uint32_t i1 = EXTRACT_32BITS(&((u_int *)hdr)[1]);
+ uint32_t i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ uint32_t i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
u_int dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
const char * ptype;
@@ -160,7 +160,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
i0 & 0xffff,
i1));
if (ndo->ndo_vflag) {
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((u_int *)hdr)[2])));
+ ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((const u_int *)hdr)[2])));
if (hasopt) {
u_int i2, optlen;
do {
@@ -193,14 +193,14 @@ static const u_char *
rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
{
/* rtp v2 control (rtcp) */
- struct rtcp_rr *rr = 0;
- struct rtcp_sr *sr;
- struct rtcphdr *rh = (struct rtcphdr *)hdr;
+ const struct rtcp_rr *rr = 0;
+ const struct rtcp_sr *sr;
+ const struct rtcphdr *rh = (const struct rtcphdr *)hdr;
u_int len;
uint16_t flags;
int cnt;
double ts, dts;
- if ((u_char *)(rh + 1) > ep) {
+ if ((const u_char *)(rh + 1) > ep) {
ND_PRINT((ndo, " [|rtcp]"));
return (ep);
}
@@ -209,13 +209,13 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
- sr = (struct rtcp_sr *)(rh + 1);
+ sr = (const struct rtcp_sr *)(rh + 1);
ND_PRINT((ndo, " sr"));
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
ND_PRINT((ndo, " [%d]", len));
if (ndo->ndo_vflag)
ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
- if ((u_char *)(sr + 1) > ep) {
+ if ((const u_char *)(sr + 1) > ep) {
ND_PRINT((ndo, " [|rtcp]"));
return (ep);
}
@@ -224,13 +224,13 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
4294967296.0);
ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts),
EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb)));
- rr = (struct rtcp_rr *)(sr + 1);
+ rr = (const struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
ND_PRINT((ndo, " rr"));
if (len != cnt * sizeof(*rr) + sizeof(*rh))
ND_PRINT((ndo, " [%d]", len));
- rr = (struct rtcp_rr *)(rh + 1);
+ rr = (const struct rtcp_rr *)(rh + 1);
if (ndo->ndo_vflag)
ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
break;
@@ -254,7 +254,7 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
if (cnt > 1)
ND_PRINT((ndo, " c%d", cnt));
while (--cnt >= 0) {
- if ((u_char *)(rr + 1) > ep) {
+ if ((const u_char *)(rr + 1) > ep) {
ND_PRINT((ndo, " [|rtcp]"));
return (ep);
}
@@ -274,7 +274,7 @@ static int udp_cksum(netdissect_options *ndo, register const struct ip *ip,
register const struct udphdr *up,
register u_int len)
{
- return nextproto4_cksum(ndo, ip, (const uint8_t *)(void *)up, len, len,
+ return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)up, len, len,
IPPROTO_UDP);
}
@@ -282,7 +282,7 @@ static int udp_cksum(netdissect_options *ndo, register const struct ip *ip,
static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
u_int len)
{
- return nextproto6_cksum(ip6, (const uint8_t *)(void *)up, len, len,
+ return nextproto6_cksum(ip6, (const uint8_t *)(const void *)up, len, len,
IPPROTO_UDP);
}
#endif
@@ -358,11 +358,11 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
if (ep > ndo->ndo_snapend)
ep = ndo->ndo_snapend;
- up = (struct udphdr *)bp;
- ip = (struct ip *)bp2;
+ up = (const struct udphdr *)bp;
+ ip = (const struct ip *)bp2;
#ifdef INET6
if (IP_V(ip) == 6)
- ip6 = (struct ip6_hdr *)bp2;
+ ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
#endif /*INET6*/
@@ -391,7 +391,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
if (ulen < length)
length = ulen;
- cp = (u_char *)(up + 1);
+ cp = (const u_char *)(up + 1);
if (cp > ndo->ndo_snapend) {
udpipaddr_print(ndo, ip, sport, dport);
ND_PRINT((ndo, "[|udp]"));
@@ -399,35 +399,35 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
}
if (ndo->ndo_packettype) {
- register struct sunrpc_msg *rp;
+ register const struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
switch (ndo->ndo_packettype) {
case PT_VAT:
udpipaddr_print(ndo, ip, sport, dport);
- vat_print(ndo, (void *)(up + 1), up);
+ vat_print(ndo, (const void *)(up + 1), up);
break;
case PT_WB:
udpipaddr_print(ndo, ip, sport, dport);
- wb_print(ndo, (void *)(up + 1), length);
+ wb_print(ndo, (const void *)(up + 1), length);
break;
case PT_RPC:
- rp = (struct sunrpc_msg *)(up + 1);
+ rp = (const struct sunrpc_msg *)(up + 1);
direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
if (direction == SUNRPC_CALL)
- sunrpcrequest_print(ndo, (u_char *)rp, length,
- (u_char *)ip);
+ sunrpcrequest_print(ndo, (const u_char *)rp, length,
+ (const u_char *)ip);
else
- nfsreply_print(ndo, (u_char *)rp, length,
- (u_char *)ip); /*XXX*/
+ nfsreply_print(ndo, (const u_char *)rp, length,
+ (const u_char *)ip); /*XXX*/
break;
case PT_RTP:
udpipaddr_print(ndo, ip, sport, dport);
- rtp_print(ndo, (void *)(up + 1), length, up);
+ rtp_print(ndo, (const void *)(up + 1), length, up);
break;
case PT_RTCP:
@@ -486,33 +486,33 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
udpipaddr_print(ndo, ip, sport, dport);
if (!ndo->ndo_qflag) {
- register struct sunrpc_msg *rp;
+ register const struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
- rp = (struct sunrpc_msg *)(up + 1);
+ rp = (const struct sunrpc_msg *)(up + 1);
if (ND_TTEST(rp->rm_direction)) {
direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreq_print_noaddr(ndo, (u_char *)rp, length,
- (u_char *)ip);
+ nfsreq_print_noaddr(ndo, (const u_char *)rp, length,
+ (const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreply_print_noaddr(ndo, (u_char *)rp, length,
- (u_char *)ip);
+ nfsreply_print_noaddr(ndo, (const u_char *)rp, length,
+ (const u_char *)ip);
return;
}
#ifdef notdef
if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) {
- sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
+ sunrpcrequest_print((const u_char *)rp, length, (const u_char *)ip);
return;
}
#endif
}
- if (ND_TTEST(((struct LAP *)cp)->type) &&
- ((struct LAP *)cp)->type == lapDDP &&
+ if (ND_TTEST(((const struct LAP *)cp)->type) &&
+ ((const struct LAP *)cp)->type == lapDDP &&
(atalk_port(sport) || atalk_port(dport))) {
if (ndo->ndo_vflag)
ND_PRINT((ndo, "kip "));
@@ -616,7 +616,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
(dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
rx_print(ndo, (const void *)(up + 1), length, sport, dport,
- (u_char *) ip);
+ (const u_char *) ip);
#ifdef INET6
else if (ISPORT(RIPNG_PORT))
ripng_print(ndo, (const u_char *)(up + 1), length);
diff --git a/print-vjc.c b/print-vjc.c
index 0023af8b..65aa8e6a 100644
--- a/print-vjc.c
+++ b/print-vjc.c
@@ -102,7 +102,7 @@ vjc_print(netdissect_options *ndo, register const char *bp, u_short proto _U_)
if (bp[1])
ND_PRINT((ndo, " "));
ND_PRINT((ndo, "C=0x%02x ", bp[2]));
- ND_PRINT((ndo, "sum=0x%04x ", *(u_short *)&bp[3]));
+ ND_PRINT((ndo, "sum=0x%04x ", *(const u_short *)&bp[3]));
return -1;
case TYPE_ERROR:
if (ndo->ndo_eflag)
diff --git a/print-vrrp.c b/print-vrrp.c
index 30f89d34..3caa0b24 100644
--- a/print-vrrp.c
+++ b/print-vrrp.c
@@ -146,7 +146,7 @@ vrrp_print(netdissect_options *ndo,
}
if (version == 3 && ND_TTEST2(bp[0], len)) {
- uint16_t cksum = nextproto4_cksum(ndo, (struct ip *)bp2, bp,
+ uint16_t cksum = nextproto4_cksum(ndo, (const struct ip *)bp2, bp,
len, len, IPPROTO_VRRP);
if (cksum)
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
diff --git a/print-vtp.c b/print-vtp.c
index b771c643..2ee37542 100644
--- a/print-vtp.c
+++ b/print-vtp.c
@@ -240,7 +240,7 @@ vtp_print (netdissect_options *ndo,
ND_TCHECK2(*tptr, len);
- vtp_vlan = (struct vtp_vlan_*)tptr;
+ vtp_vlan = (const struct vtp_vlan_*)tptr;
ND_PRINT((ndo, "\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name %s",
tok2str(vtp_vlan_status,"Unknown",vtp_vlan->status),
tok2str(vtp_vlan_type_values,"Unknown",vtp_vlan->type),
diff --git a/print-wb.c b/print-wb.c
index 4fa5e380..92b8c2c3 100644
--- a/print-wb.c
+++ b/print-wb.c
@@ -47,8 +47,8 @@ static const char tstr[] = "[|wb]";
#define DOP_ALIGN 4
#define DOP_ROUNDUP(x) ((((int)(x)) + (DOP_ALIGN - 1)) & ~(DOP_ALIGN - 1))
#define DOP_NEXT(d)\
- ((struct dophdr *)((u_char *)(d) + \
- DOP_ROUNDUP(EXTRACT_16BITS(&(d)->dh_len) + sizeof(*(d)))))
+ ((const struct dophdr *)((const u_char *)(d) + \
+ DOP_ROUNDUP(EXTRACT_16BITS(&(d)->dh_len) + sizeof(*(d)))))
/*
* Format of the whiteboard packet header.
@@ -199,11 +199,11 @@ wb_id(netdissect_options *ndo,
nid = EXTRACT_16BITS(&id->pi_ps.nid);
len -= sizeof(*io) * nid;
- io = (struct id_off *)(id + 1);
- cp = (char *)(io + nid);
+ io = (const struct id_off *)(id + 1);
+ cp = (const char *)(io + nid);
if (ND_TTEST2(cp, len)) {
ND_PRINT((ndo, "\""));
- fn_print(ndo, (u_char *)cp, (u_char *)cp + len);
+ fn_print(ndo, (const u_char *)cp, (const u_char *)cp + len);
ND_PRINT((ndo, "\""));
}
@@ -274,16 +274,16 @@ wb_prep(netdissect_options *ndo,
EXTRACT_32BITS(&ps->slot),
ipaddr_string(ndo, &ps->page.p_sid),
EXTRACT_32BITS(&ps->page.p_uid)));
- io = (struct id_off *)(ps + 1);
+ io = (const struct id_off *)(ps + 1);
for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
EXTRACT_32BITS(&io->off)));
c = ',';
}
ND_PRINT((ndo, ">"));
- ps = (struct pgstate *)io;
+ ps = (const struct pgstate *)io;
}
- return ((u_char *)ps <= ep? 0 : -1);
+ return ((const u_char *)ps <= ep? 0 : -1);
}
@@ -415,32 +415,32 @@ wb_print(netdissect_options *ndo,
return;
case PT_ID:
- if (wb_id(ndo, (struct pkt_id *)(ph + 1), len) >= 0)
+ if (wb_id(ndo, (const struct pkt_id *)(ph + 1), len) >= 0)
return;
break;
case PT_RREQ:
- if (wb_rreq(ndo, (struct pkt_rreq *)(ph + 1), len) >= 0)
+ if (wb_rreq(ndo, (const struct pkt_rreq *)(ph + 1), len) >= 0)
return;
break;
case PT_RREP:
- if (wb_rrep(ndo, (struct pkt_rrep *)(ph + 1), len) >= 0)
+ if (wb_rrep(ndo, (const struct pkt_rrep *)(ph + 1), len) >= 0)
return;
break;
case PT_DRAWOP:
- if (wb_drawop(ndo, (struct pkt_dop *)(ph + 1), len) >= 0)
+ if (wb_drawop(ndo, (const struct pkt_dop *)(ph + 1), len) >= 0)
return;
break;
case PT_PREQ:
- if (wb_preq(ndo, (struct pkt_preq *)(ph + 1), len) >= 0)
+ if (wb_preq(ndo, (const struct pkt_preq *)(ph + 1), len) >= 0)
return;
break;
case PT_PREP:
- if (wb_prep(ndo, (struct pkt_prep *)(ph + 1), len) >= 0)
+ if (wb_prep(ndo, (const struct pkt_prep *)(ph + 1), len) >= 0)
return;
break;
diff --git a/print-zephyr.c b/print-zephyr.c
index c004f144..700d0bc0 100644
--- a/print-zephyr.c
+++ b/print-zephyr.c
@@ -33,23 +33,23 @@
#include "interface.h"
struct z_packet {
- char *version;
+ const char *version;
int numfields;
int kind;
- char *uid;
+ const char *uid;
int port;
int auth;
int authlen;
- char *authdata;
- char *class;
- char *inst;
- char *opcode;
- char *sender;
+ const char *authdata;
+ const char *class;
+ const char *inst;
+ const char *opcode;
+ const char *sender;
const char *recipient;
- char *format;
+ const char *format;
int cksum;
int multi;
- char *multi_uid;
+ const char *multi_uid;
/* Other fields follow here.. */
};
@@ -79,30 +79,30 @@ static const struct tok z_types[] = {
static char z_buf[256];
-static char *
-parse_field(netdissect_options *ndo, char **pptr, int *len)
+static const char *
+parse_field(netdissect_options *ndo, const char **pptr, int *len)
{
- char *s;
+ const char *s;
if (*len <= 0 || !pptr || !*pptr)
return NULL;
- if (*pptr > (char *) ndo->ndo_snapend)
+ if (*pptr > (const char *) ndo->ndo_snapend)
return NULL;
s = *pptr;
- while (*pptr <= (char *) ndo->ndo_snapend && *len >= 0 && **pptr) {
+ while (*pptr <= (const char *) ndo->ndo_snapend && *len >= 0 && **pptr) {
(*pptr)++;
(*len)--;
}
(*pptr)++;
(*len)--;
- if (*len < 0 || *pptr > (char *) ndo->ndo_snapend)
+ if (*len < 0 || *pptr > (const char *) ndo->ndo_snapend)
return NULL;
return s;
}
static const char *
-z_triple(char *class, char *inst, const char *recipient)
+z_triple(const char *class, const char *inst, const char *recipient)
{
if (!*recipient)
recipient = "*";
@@ -112,15 +112,17 @@ z_triple(char *class, char *inst, const char *recipient)
}
static const char *
-str_to_lower(char *string)
+str_to_lower(const char *string)
{
+ char *zb_string;
+
strncpy(z_buf, string, sizeof(z_buf));
z_buf[sizeof(z_buf)-1] = '\0';
- string = z_buf;
- while (*string) {
- *string = tolower((unsigned char)(*string));
- string++;
+ zb_string = z_buf;
+ while (*zb_string) {
+ *zb_string = tolower((unsigned char)(*zb_string));
+ zb_string++;
}
return z_buf;
@@ -130,9 +132,9 @@ void
zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
{
struct z_packet z;
- char *parse = (char *) cp;
+ const char *parse = (const char *) cp;
int parselen = length;
- char *s;
+ const char *s;
int lose = 0;
/* squelch compiler warnings */
@@ -192,7 +194,7 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
ND_PRINT((ndo, " %s", tok2str(z_types, "type %d", z.kind)));
if (z.kind == Z_PACKET_SERVACK) {
/* Initialization to silence warnings */
- char *ackdata = NULL;
+ const char *ackdata = NULL;
PARSE_FIELD_STR(ackdata);
if (!lose && strcmp(ackdata, "SENT"))
ND_PRINT((ndo, "/%s", str_to_lower(ackdata)));
@@ -225,7 +227,7 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
"-nodefs"));
if (z.kind != Z_PACKET_SERVACK) {
/* Initialization to silence warnings */
- char *c = NULL, *i = NULL, *r = NULL;
+ const char *c = NULL, *i = NULL, *r = NULL;
PARSE_FIELD_STR(c);
PARSE_FIELD_STR(i);
PARSE_FIELD_STR(r);
diff --git a/smb.h b/smb.h
index 88eaa069..b521617f 100644
--- a/smb.h
+++ b/smb.h
@@ -116,7 +116,7 @@
#define TRANSACT2_FINDNOTIFYNEXT 12
#define TRANSACT2_MKDIR 13
-#define PTR_DIFF(p1, p2) ((size_t)(((char *)(p1)) - (char *)(p2)))
+#define PTR_DIFF(p1, p2) ((size_t)(((const char *)(p1)) - (const char *)(p2)))
/* some protos */
const u_char *smb_fdata(netdissect_options *, const u_char *, const char *, const u_char *, int);