mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
Use more ND_TCHECK_n() macros
This commit is contained in:
parent
2a1c7a3975
commit
6e15ad4b99
@ -116,7 +116,7 @@ hsrp_print(netdissect_options *ndo, const uint8_t *bp, u_int len)
|
||||
if (EXTRACT_U_1(hp->hsrp_reserved) != 0) {
|
||||
ND_PRINT("[reserved=%u!] ", EXTRACT_U_1(hp->hsrp_reserved));
|
||||
}
|
||||
ND_TCHECK(hp->hsrp_virtaddr);
|
||||
ND_TCHECK_4(&hp->hsrp_virtaddr);
|
||||
ND_PRINT("addr=%s", ipaddr_string(ndo, &hp->hsrp_virtaddr));
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_PRINT(" hellotime=");
|
||||
|
@ -1043,7 +1043,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
uint16_t sum, udp_sum;
|
||||
|
||||
if (ND_TTEST_LEN(bp, length)) {
|
||||
ND_TCHECK(dp->icmp6_cksum);
|
||||
ND_TCHECK_2(dp->icmp6_cksum);
|
||||
udp_sum = EXTRACT_BE_U_2(dp->icmp6_cksum);
|
||||
sum = icmp6_cksum(ndo, ip, dp, length);
|
||||
if (sum != 0)
|
||||
@ -1074,7 +1074,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
|
||||
switch (icmp6_type) {
|
||||
case ICMP6_DST_UNREACH:
|
||||
ND_TCHECK(oip->ip6_dst);
|
||||
ND_TCHECK_16(&oip->ip6_dst);
|
||||
ND_PRINT(", %s", tok2str(icmp6_dst_unreach_code_values,"unknown unreach code (%u)",icmp6_code));
|
||||
switch (icmp6_code) {
|
||||
|
||||
@ -1125,7 +1125,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
ND_PRINT(", mtu %u", EXTRACT_BE_U_4(dp->icmp6_mtu));
|
||||
break;
|
||||
case ICMP6_TIME_EXCEEDED:
|
||||
ND_TCHECK(oip->ip6_dst);
|
||||
ND_TCHECK_16(&oip->ip6_dst);
|
||||
switch (icmp6_code) {
|
||||
case ICMP6_TIME_EXCEED_TRANSIT:
|
||||
ND_PRINT(" for %s",
|
||||
@ -1140,7 +1140,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case ICMP6_PARAM_PROB:
|
||||
ND_TCHECK(oip->ip6_dst);
|
||||
ND_TCHECK_16(&oip->ip6_dst);
|
||||
switch (icmp6_code) {
|
||||
case ICMP6_PARAMPROB_HEADER:
|
||||
ND_PRINT(", erroneous - octet %u", EXTRACT_BE_U_4(dp->icmp6_pptr));
|
||||
@ -1191,7 +1191,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
const struct nd_router_advert *p;
|
||||
|
||||
p = (const struct nd_router_advert *)dp;
|
||||
ND_TCHECK(p->nd_ra_retransmit);
|
||||
ND_TCHECK_4(p->nd_ra_retransmit);
|
||||
ND_PRINT("\n\thop limit %u, Flags [%s]"
|
||||
", pref %s, router lifetime %us, reachable time %us, retrans time %us",
|
||||
EXTRACT_U_1(p->nd_ra_curhoplimit),
|
||||
@ -1209,7 +1209,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
{
|
||||
const struct nd_neighbor_solicit *p;
|
||||
p = (const struct nd_neighbor_solicit *)dp;
|
||||
ND_TCHECK(p->nd_ns_target);
|
||||
ND_TCHECK_16(&p->nd_ns_target);
|
||||
ND_PRINT(", who has %s", ip6addr_string(ndo, &p->nd_ns_target));
|
||||
if (ndo->ndo_vflag) {
|
||||
#define NDSOLLEN 24
|
||||
@ -1223,7 +1223,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
const struct nd_neighbor_advert *p;
|
||||
|
||||
p = (const struct nd_neighbor_advert *)dp;
|
||||
ND_TCHECK(p->nd_na_target);
|
||||
ND_TCHECK_16(&p->nd_na_target);
|
||||
ND_PRINT(", tgt is %s",
|
||||
ip6addr_string(ndo, &p->nd_na_target));
|
||||
if (ndo->ndo_vflag) {
|
||||
@ -1450,7 +1450,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
|
||||
break;
|
||||
case ND_OPT_PREFIX_INFORMATION:
|
||||
opp = (const struct nd_opt_prefix_info *)op;
|
||||
ND_TCHECK(opp->nd_opt_pi_prefix);
|
||||
ND_TCHECK_16(&opp->nd_opt_pi_prefix);
|
||||
ND_PRINT("%s/%u%s, Flags [%s], valid time %s",
|
||||
ip6addr_string(ndo, &opp->nd_opt_pi_prefix),
|
||||
EXTRACT_U_1(opp->nd_opt_pi_prefix_len),
|
||||
@ -1465,7 +1465,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
|
||||
break;
|
||||
case ND_OPT_MTU:
|
||||
opm = (const struct nd_opt_mtu *)op;
|
||||
ND_TCHECK(opm->nd_opt_mtu_mtu);
|
||||
ND_TCHECK_4(opm->nd_opt_mtu_mtu);
|
||||
ND_PRINT(" %u%s",
|
||||
EXTRACT_BE_U_4(opm->nd_opt_mtu_mtu),
|
||||
(opt_len != 1) ? "bad option length" : "" );
|
||||
@ -1476,7 +1476,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
|
||||
ND_PRINT(" lifetime %us,",
|
||||
EXTRACT_BE_U_4(oprd->nd_opt_rdnss_lifetime));
|
||||
for (i = 0; i < l; i++) {
|
||||
ND_TCHECK(oprd->nd_opt_rdnss_addr[i]);
|
||||
ND_TCHECK_16(&oprd->nd_opt_rdnss_addr[i]);
|
||||
ND_PRINT(" addr: %s",
|
||||
ip6addr_string(ndo, &oprd->nd_opt_rdnss_addr[i]));
|
||||
}
|
||||
@ -1495,19 +1495,19 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
|
||||
break;
|
||||
case ND_OPT_ADVINTERVAL:
|
||||
opa = (const struct nd_opt_advinterval *)op;
|
||||
ND_TCHECK(opa->nd_opt_adv_interval);
|
||||
ND_TCHECK_4(opa->nd_opt_adv_interval);
|
||||
ND_PRINT(" %ums", EXTRACT_BE_U_4(opa->nd_opt_adv_interval));
|
||||
break;
|
||||
case ND_OPT_HOMEAGENT_INFO:
|
||||
oph = (const struct nd_opt_homeagent_info *)op;
|
||||
ND_TCHECK(oph->nd_opt_hai_lifetime);
|
||||
ND_TCHECK_2(oph->nd_opt_hai_lifetime);
|
||||
ND_PRINT(" preference %u, lifetime %u",
|
||||
EXTRACT_BE_U_2(oph->nd_opt_hai_preference),
|
||||
EXTRACT_BE_U_2(oph->nd_opt_hai_lifetime));
|
||||
break;
|
||||
case ND_OPT_ROUTE_INFO:
|
||||
opri = (const struct nd_opt_route_info *)op;
|
||||
ND_TCHECK(opri->nd_opt_rti_lifetime);
|
||||
ND_TCHECK_4(opri->nd_opt_rti_lifetime);
|
||||
memset(&in6, 0, sizeof(in6));
|
||||
in6p = (const struct in6_addr *)(opri + 1);
|
||||
switch (opt_len) {
|
||||
@ -1994,7 +1994,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
|
||||
rr6 = (const struct icmp6_router_renum *)bp;
|
||||
cp = (const char *)(rr6 + 1);
|
||||
|
||||
ND_TCHECK(rr6->rr_reserved);
|
||||
ND_TCHECK_4(rr6->rr_reserved);
|
||||
switch (EXTRACT_U_1(rr6->rr_code)) {
|
||||
case ICMP6_ROUTER_RENUMBERING_COMMAND:
|
||||
ND_PRINT("router renum: command");
|
||||
@ -2036,7 +2036,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
|
||||
match = (const struct rr_pco_match *)cp;
|
||||
cp = (const char *)(match + 1);
|
||||
|
||||
ND_TCHECK(match->rpm_prefix);
|
||||
ND_TCHECK_16(&match->rpm_prefix);
|
||||
|
||||
if (ndo->ndo_vflag > 1)
|
||||
ND_PRINT("\n\t");
|
||||
@ -2070,7 +2070,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep)
|
||||
use = (const struct rr_pco_use *)cp;
|
||||
cp = (const char *)(use + 1);
|
||||
|
||||
ND_TCHECK(use->rpu_prefix);
|
||||
ND_TCHECK_16(&use->rpu_prefix);
|
||||
|
||||
if (ndo->ndo_vflag > 1)
|
||||
ND_PRINT("\n\t");
|
||||
|
@ -2889,7 +2889,7 @@ isis_print(netdissect_options *ndo,
|
||||
tmp--;
|
||||
}
|
||||
if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) {
|
||||
ND_TCHECK(tlv_ptp_adj->extd_local_circuit_id);
|
||||
ND_TCHECK_4(tlv_ptp_adj->extd_local_circuit_id);
|
||||
ND_PRINT("\n\t Extended Local circuit-ID: 0x%08x",
|
||||
EXTRACT_BE_U_4(tlv_ptp_adj->extd_local_circuit_id));
|
||||
tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id);
|
||||
@ -2901,7 +2901,7 @@ isis_print(netdissect_options *ndo,
|
||||
tmp-=SYSTEM_ID_LEN;
|
||||
}
|
||||
if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
|
||||
ND_TCHECK(tlv_ptp_adj->neighbor_extd_local_circuit_id);
|
||||
ND_TCHECK_4(tlv_ptp_adj->neighbor_extd_local_circuit_id);
|
||||
ND_PRINT("\n\t Neighbor Extended Local circuit-ID: 0x%08x",
|
||||
EXTRACT_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id));
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ nfsreply_print(netdissect_options *ndo,
|
||||
nfserr = 0; /* assume no error */
|
||||
rp = (const struct sunrpc_msg *)bp;
|
||||
|
||||
ND_TCHECK(rp->rm_xid);
|
||||
ND_TCHECK_4(rp->rm_xid);
|
||||
if (!ndo->ndo_nflag) {
|
||||
strlcpy(srcid, "nfs", sizeof(srcid));
|
||||
snprintf(dstid, sizeof(dstid), "%u",
|
||||
|
36
print-ospf.c
36
print-ospf.c
@ -515,7 +515,7 @@ ospf_print_lshdr(netdissect_options *ndo,
|
||||
u_int ls_type;
|
||||
u_int ls_length;
|
||||
|
||||
ND_TCHECK(lshp->ls_length);
|
||||
ND_TCHECK_2(lshp->ls_length);
|
||||
ls_length = EXTRACT_BE_U_2(lshp->ls_length);
|
||||
if (ls_length < sizeof(struct lsa_hdr)) {
|
||||
ND_PRINT("\n\t Bogus length %u < header (%lu)", ls_length,
|
||||
@ -523,14 +523,14 @@ ospf_print_lshdr(netdissect_options *ndo,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */
|
||||
ND_TCHECK_4(lshp->ls_seq); /* XXX - ls_length check checked this */
|
||||
ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
|
||||
ipaddr_string(ndo, &lshp->ls_router),
|
||||
EXTRACT_BE_U_4(lshp->ls_seq),
|
||||
EXTRACT_BE_U_2(lshp->ls_age),
|
||||
ls_length - (u_int)sizeof(struct lsa_hdr));
|
||||
|
||||
ND_TCHECK(lshp->ls_type); /* XXX - ls_length check checked this */
|
||||
ND_TCHECK_1(lshp->ls_type); /* XXX - ls_length check checked this */
|
||||
ls_type = EXTRACT_U_1(lshp->ls_type);
|
||||
switch (ls_type) {
|
||||
/* the LSA header for opaque LSAs was slightly changed */
|
||||
@ -559,7 +559,7 @@ ospf_print_lshdr(netdissect_options *ndo,
|
||||
break;
|
||||
}
|
||||
|
||||
ND_TCHECK(lshp->ls_options); /* XXX - ls_length check checked this */
|
||||
ND_TCHECK_1(lshp->ls_options); /* XXX - ls_length check checked this */
|
||||
ND_PRINT("\n\t Options: [%s]", bittok2str(ospf_option_values, "none", EXTRACT_U_1(lshp->ls_options)));
|
||||
|
||||
return (ls_length);
|
||||
@ -638,11 +638,11 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
switch (EXTRACT_U_1(lsap->ls_hdr.ls_type)) {
|
||||
|
||||
case LS_TYPE_ROUTER:
|
||||
ND_TCHECK(lsap->lsa_un.un_rla.rla_flags);
|
||||
ND_TCHECK_1(lsap->lsa_un.un_rla.rla_flags);
|
||||
ND_PRINT("\n\t Router LSA Options: [%s]",
|
||||
bittok2str(ospf_rla_flag_values, "none", EXTRACT_U_1(lsap->lsa_un.un_rla.rla_flags)));
|
||||
|
||||
ND_TCHECK(lsap->lsa_un.un_rla.rla_count);
|
||||
ND_TCHECK_2(lsap->lsa_un.un_rla.rla_count);
|
||||
j = EXTRACT_BE_U_2(lsap->lsa_un.un_rla.rla_count);
|
||||
ND_TCHECK(lsap->lsa_un.un_rla.rla_link);
|
||||
rlp = lsap->lsa_un.un_rla.rla_link;
|
||||
@ -689,7 +689,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
break;
|
||||
|
||||
case LS_TYPE_NETWORK:
|
||||
ND_TCHECK(lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_TCHECK_4(&lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_PRINT("\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;
|
||||
@ -701,7 +701,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
break;
|
||||
|
||||
case LS_TYPE_SUM_IP:
|
||||
ND_TCHECK(lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_TCHECK_4(&lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_PRINT("\n\t Mask %s",
|
||||
ipaddr_string(ndo, &lsap->lsa_un.un_sla.sla_mask));
|
||||
ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
|
||||
@ -739,7 +739,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
|
||||
case LS_TYPE_ASE:
|
||||
case LS_TYPE_NSSA: /* fall through - those LSAs share the same format */
|
||||
ND_TCHECK(lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_TCHECK_4(&lsap->lsa_un.un_nla.nla_mask);
|
||||
ND_PRINT("\n\t Mask %s",
|
||||
ipaddr_string(ndo, &lsap->lsa_un.un_asla.asla_mask));
|
||||
|
||||
@ -748,7 +748,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
while ((const u_char *)almp < ls_end) {
|
||||
uint32_t ul;
|
||||
|
||||
ND_TCHECK(almp->asla_tosmetric);
|
||||
ND_TCHECK_4(almp->asla_tosmetric);
|
||||
ul = EXTRACT_BE_U_4(almp->asla_tosmetric);
|
||||
topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS);
|
||||
ND_PRINT("\n\t\ttopology %s (%u), type %u, metric",
|
||||
@ -760,11 +760,11 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
else
|
||||
ND_PRINT(" %u", (ul & ASLA_MASK_METRIC));
|
||||
|
||||
ND_TCHECK(almp->asla_forward);
|
||||
ND_TCHECK_4(&almp->asla_forward);
|
||||
if (almp->asla_forward.s_addr) {
|
||||
ND_PRINT(", forward %s", ipaddr_string(ndo, &almp->asla_forward));
|
||||
}
|
||||
ND_TCHECK(almp->asla_tag);
|
||||
ND_TCHECK_4(&almp->asla_tag);
|
||||
if (almp->asla_tag.s_addr) {
|
||||
ND_PRINT(", tag %s", ipaddr_string(ndo, &almp->asla_tag));
|
||||
}
|
||||
@ -776,7 +776,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
/* Multicast extensions as of 23 July 1991 */
|
||||
mcp = lsap->lsa_un.un_mcla;
|
||||
while ((const u_char *)mcp < ls_end) {
|
||||
ND_TCHECK(mcp->mcla_vid);
|
||||
ND_TCHECK_4(&mcp->mcla_vid);
|
||||
switch (EXTRACT_BE_U_4(mcp->mcla_vtype)) {
|
||||
|
||||
case MCLA_VERTEX_ROUTER:
|
||||
@ -1114,7 +1114,7 @@ ospf_print(netdissect_options *ndo,
|
||||
op = (const struct ospfhdr *)bp;
|
||||
|
||||
/* XXX Before we do anything else, strip off the MD5 trailer */
|
||||
ND_TCHECK(op->ospf_authtype);
|
||||
ND_TCHECK_2(op->ospf_authtype);
|
||||
if (EXTRACT_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) {
|
||||
length -= OSPF_AUTH_MD5_LEN;
|
||||
ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN;
|
||||
@ -1122,7 +1122,7 @@ ospf_print(netdissect_options *ndo,
|
||||
|
||||
/* If the type is valid translate it, or just print the type */
|
||||
/* value. If it's not valid, say so and return */
|
||||
ND_TCHECK(op->ospf_type);
|
||||
ND_TCHECK_1(op->ospf_type);
|
||||
cp = tok2str(type2str, "unknown LS-type %u", EXTRACT_U_1(op->ospf_type));
|
||||
ND_PRINT("OSPFv%u, %s, length %u", EXTRACT_U_1(op->ospf_version), cp, length);
|
||||
if (*cp == 'u')
|
||||
@ -1132,7 +1132,7 @@ ospf_print(netdissect_options *ndo,
|
||||
return;
|
||||
}
|
||||
|
||||
ND_TCHECK(op->ospf_len);
|
||||
ND_TCHECK_2(op->ospf_len);
|
||||
if (length != EXTRACT_BE_U_2(op->ospf_len)) {
|
||||
ND_PRINT(" [len %u]", EXTRACT_BE_U_2(op->ospf_len));
|
||||
}
|
||||
@ -1143,10 +1143,10 @@ ospf_print(netdissect_options *ndo,
|
||||
dataend = bp + length;
|
||||
}
|
||||
|
||||
ND_TCHECK(op->ospf_routerid);
|
||||
ND_TCHECK_4(&op->ospf_routerid);
|
||||
ND_PRINT("\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf_routerid));
|
||||
|
||||
ND_TCHECK(op->ospf_areaid);
|
||||
ND_TCHECK_4(&op->ospf_areaid);
|
||||
if (op->ospf_areaid.s_addr != 0)
|
||||
ND_PRINT(", Area %s", ipaddr_string(ndo, &op->ospf_areaid));
|
||||
else
|
||||
|
@ -389,8 +389,8 @@ ospf6_print_lshdr(netdissect_options *ndo,
|
||||
{
|
||||
if ((const u_char *)(lshp + 1) > dataend)
|
||||
goto trunc;
|
||||
ND_TCHECK(lshp->ls_type);
|
||||
ND_TCHECK(lshp->ls_seq);
|
||||
ND_TCHECK_2(lshp->ls_type);
|
||||
ND_TCHECK_4(lshp->ls_seq);
|
||||
|
||||
ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
|
||||
ipaddr_string(ndo, &lshp->ls_router),
|
||||
@ -473,7 +473,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
|
||||
if (ospf6_print_lshdr(ndo, &lsap->ls_hdr, dataend))
|
||||
return (1);
|
||||
ND_TCHECK(lsap->ls_hdr.ls_length);
|
||||
ND_TCHECK_2(lsap->ls_hdr.ls_length);
|
||||
length = EXTRACT_BE_U_2(lsap->ls_hdr.ls_length);
|
||||
|
||||
/*
|
||||
@ -546,7 +546,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (lsap->lsa_un.un_nla.nla_options))
|
||||
return (1);
|
||||
lsa_length -= sizeof (lsap->lsa_un.un_nla.nla_options);
|
||||
ND_TCHECK(lsap->lsa_un.un_nla.nla_options);
|
||||
ND_TCHECK_4(lsap->lsa_un.un_nla.nla_options);
|
||||
ND_PRINT("\n\t Options [%s]",
|
||||
bittok2str(ospf6_option_values, "none",
|
||||
EXTRACT_BE_U_4(lsap->lsa_un.un_nla.nla_options)));
|
||||
@ -567,7 +567,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric))
|
||||
return (1);
|
||||
lsa_length -= sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric);
|
||||
ND_TCHECK(lsap->lsa_un.un_inter_ap.inter_ap_metric);
|
||||
ND_TCHECK_4(lsap->lsa_un.un_inter_ap.inter_ap_metric);
|
||||
ND_PRINT(", metric %u",
|
||||
EXTRACT_BE_U_4(lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC);
|
||||
|
||||
@ -585,7 +585,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (lsap->lsa_un.un_asla.asla_metric))
|
||||
return (1);
|
||||
lsa_length -= sizeof (lsap->lsa_un.un_asla.asla_metric);
|
||||
ND_TCHECK(lsap->lsa_un.un_asla.asla_metric);
|
||||
ND_TCHECK_4(lsap->lsa_un.un_asla.asla_metric);
|
||||
flags32 = EXTRACT_BE_U_4(lsap->lsa_un.un_asla.asla_metric);
|
||||
ND_PRINT("\n\t Flags [%s]",
|
||||
bittok2str(ospf6_asla_flag_values, "none", flags32));
|
||||
@ -649,7 +649,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix))
|
||||
return (1);
|
||||
lsa_length -= sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix);
|
||||
ND_TCHECK(llsap->llsa_nprefix);
|
||||
ND_TCHECK_4(llsap->llsa_nprefix);
|
||||
prefixes = EXTRACT_BE_U_4(llsap->llsa_nprefix);
|
||||
ND_PRINT("\n\t Priority %u, Link-local address %s, Prefixes %u:",
|
||||
EXTRACT_U_1(llsap->llsa_priority),
|
||||
@ -680,7 +680,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix))
|
||||
return (1);
|
||||
lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
|
||||
ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
|
||||
ND_TCHECK_2(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
|
||||
prefixes = EXTRACT_BE_U_2(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
|
||||
ND_PRINT("\n\t Prefixes %u:", prefixes);
|
||||
|
||||
@ -742,7 +742,7 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
bittok2str(ospf6_option_values, "none",
|
||||
EXTRACT_BE_U_4(hellop->hello_options)));
|
||||
|
||||
ND_TCHECK(hellop->hello_deadint);
|
||||
ND_TCHECK_2(hellop->hello_deadint);
|
||||
ND_PRINT("\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u",
|
||||
EXTRACT_BE_U_2(hellop->hello_helloint),
|
||||
EXTRACT_BE_U_2(hellop->hello_deadint),
|
||||
@ -772,15 +772,15 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
case OSPF_TYPE_DD: {
|
||||
const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
|
||||
|
||||
ND_TCHECK(ddp->db_options);
|
||||
ND_TCHECK_4(ddp->db_options);
|
||||
ND_PRINT("\n\tOptions [%s]",
|
||||
bittok2str(ospf6_option_values, "none",
|
||||
EXTRACT_BE_U_4(ddp->db_options)));
|
||||
ND_TCHECK(ddp->db_flags);
|
||||
ND_TCHECK_1(ddp->db_flags);
|
||||
ND_PRINT(", DD Flags [%s]",
|
||||
bittok2str(ospf6_dd_flag_values,"none",EXTRACT_U_1(ddp->db_flags)));
|
||||
|
||||
ND_TCHECK(ddp->db_seq);
|
||||
ND_TCHECK_4(ddp->db_seq);
|
||||
ND_PRINT(", MTU %u, DD-Sequence 0x%08x",
|
||||
EXTRACT_BE_U_2(ddp->db_mtu),
|
||||
EXTRACT_BE_U_4(ddp->db_seq));
|
||||
@ -814,7 +814,7 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
if (ndo->ndo_vflag > 1) {
|
||||
const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN);
|
||||
|
||||
ND_TCHECK(lsup->lsu_count);
|
||||
ND_TCHECK_4(lsup->lsu_count);
|
||||
i = EXTRACT_BE_U_4(lsup->lsu_count);
|
||||
lsap = lsup->lsu_lsa;
|
||||
while ((const u_char *)lsap < dataend && i--) {
|
||||
@ -944,7 +944,7 @@ ospf6_decode_v3_trailer(netdissect_options *ndo,
|
||||
lls_hello = 1;
|
||||
} else if (type == OSPF_TYPE_DD) {
|
||||
const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
|
||||
ND_TCHECK(ddp->db_options);
|
||||
ND_TCHECK_4(ddp->db_options);
|
||||
if (EXTRACT_BE_U_4(ddp->db_options) & OSPF6_OPTION_L)
|
||||
lls_dd = 1;
|
||||
}
|
||||
@ -969,7 +969,7 @@ ospf6_print(netdissect_options *ndo,
|
||||
|
||||
/* If the type is valid translate it, or just print the type */
|
||||
/* value. If it's not valid, say so and return */
|
||||
ND_TCHECK(op->ospf6_type);
|
||||
ND_TCHECK_1(op->ospf6_type);
|
||||
cp = tok2str(ospf6_type_values, "unknown packet type (%u)", EXTRACT_U_1(op->ospf6_type));
|
||||
ND_PRINT("OSPFv%u, %s, length %u", EXTRACT_U_1(op->ospf6_version), cp, length);
|
||||
if (*cp == 'u') {
|
||||
@ -981,7 +981,7 @@ ospf6_print(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
/* OSPFv3 data always comes first and optional trailing data may follow. */
|
||||
ND_TCHECK(op->ospf6_len);
|
||||
ND_TCHECK_2(op->ospf6_len);
|
||||
datalen = EXTRACT_BE_U_2(op->ospf6_len);
|
||||
if (datalen > length) {
|
||||
ND_PRINT(" [len %u]", datalen);
|
||||
@ -997,7 +997,7 @@ ospf6_print(netdissect_options *ndo,
|
||||
ND_PRINT(", Area %s", ipaddr_string(ndo, &op->ospf6_areaid));
|
||||
else
|
||||
ND_PRINT(", Backbone Area");
|
||||
ND_TCHECK(op->ospf6_instanceid);
|
||||
ND_TCHECK_1(op->ospf6_instanceid);
|
||||
if (EXTRACT_U_1(op->ospf6_instanceid))
|
||||
ND_PRINT(", Instance %u", EXTRACT_U_1(op->ospf6_instanceid));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user