diff options
Diffstat (limited to 'print-ospf6.c')
-rw-r--r-- | print-ospf6.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/print-ospf6.c b/print-ospf6.c index 82b8375a..fb61c3d7 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.9 2002-08-01 08:53:23 risso Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.10 2002-12-11 07:14:06 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -217,8 +217,8 @@ ospf6_print_lshdr(register const struct lsa_hdr *lshp) printf(" {"); /* } (ctags) */ TCHECK(lshp->ls_seq); - ospf6_print_seqage(ntohl(lshp->ls_seq), ntohs(lshp->ls_age)); - ospf6_print_ls_type(ntohs(lshp->ls_type), &lshp->ls_stateid, + ospf6_print_seqage(EXTRACT_32BITS(&lshp->ls_seq), EXTRACT_16BITS(&lshp->ls_age)); + ospf6_print_ls_type(EXTRACT_16BITS(&lshp->ls_type), &lshp->ls_stateid, &lshp->ls_router, "ls_type %d"); return (0); @@ -245,7 +245,7 @@ ospf6_print_lsaprefix(register const struct lsa_prefix *lsapp) if (lsapp->lsa_p_opt) printf("(opt=%x)", lsapp->lsa_p_opt); if (lsapp->lsa_p_mbz) - printf("(mbz=%x)", ntohs(lsapp->lsa_p_mbz)); /* XXX */ + printf("(mbz=%x)", EXTRACT_16BITS(&lsapp->lsa_p_mbz)); /* XXX */ return sizeof(*lsapp) - 4 + k * 4; trunc: @@ -280,15 +280,15 @@ ospf6_print_lsa(register const struct lsa *lsap) if (ospf6_print_lshdr(&lsap->ls_hdr)) return (1); TCHECK(lsap->ls_hdr.ls_length); - ls_end = (u_char *)lsap + ntohs(lsap->ls_hdr.ls_length); - switch (ntohs(lsap->ls_hdr.ls_type)) { + ls_end = (u_char *)lsap + EXTRACT_16BITS(&lsap->ls_hdr.ls_length); + switch (EXTRACT_16BITS(&lsap->ls_hdr.ls_type)) { case LS_TYPE_ROUTER | LS_SCOPE_AREA: TCHECK(lsap->lsa_un.un_rla.rla_flags); ospf6_print_bits(ospf6_rla_flag_bits, lsap->lsa_un.un_rla.rla_flags); TCHECK(lsap->lsa_un.un_rla.rla_options); ospf6_print_bits(ospf6_option_bits, - ntohl(lsap->lsa_un.un_rla.rla_options)); + EXTRACT_32BITS(&lsap->lsa_un.un_rla.rla_options)); TCHECK(lsap->lsa_un.un_rla.rla_link); rlp = lsap->lsa_un.un_rla.rla_link; @@ -321,7 +321,7 @@ ospf6_print_lsa(register const struct lsa *lsap) rlp->link_type); return (0); } - printf(" metric %d", ntohs(rlp->link_metric)); + printf(" metric %d", EXTRACT_16BITS(&rlp->link_metric)); /* { (ctags) */ printf(" }"); rlp++; @@ -331,7 +331,7 @@ ospf6_print_lsa(register const struct lsa *lsap) case LS_TYPE_NETWORK | LS_SCOPE_AREA: TCHECK(lsap->lsa_un.un_nla.nla_options); ospf6_print_bits(ospf6_option_bits, - ntohl(lsap->lsa_un.un_nla.nla_options)); + EXTRACT_32BITS(&lsap->lsa_un.un_nla.nla_options)); printf(" rtrs"); ap = lsap->lsa_un.un_nla.nla_router; while ((u_char *)ap < ls_end) { @@ -344,7 +344,7 @@ ospf6_print_lsa(register const struct lsa *lsap) case LS_TYPE_INTER_AP | LS_SCOPE_AREA: TCHECK(lsap->lsa_un.un_inter_ap.inter_ap_metric); printf(" metric %u", - (u_int32_t)ntohl(lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC); + EXTRACT_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC); lsapp = lsap->lsa_un.un_inter_ap.inter_ap_prefix; while (lsapp + sizeof(lsapp) <= (struct lsa_prefix *)ls_end) { k = ospf6_print_lsaprefix(lsapp); @@ -355,10 +355,10 @@ ospf6_print_lsa(register const struct lsa *lsap) break; case LS_SCOPE_AS | LS_TYPE_ASE: TCHECK(lsap->lsa_un.un_asla.asla_metric); - flags32 = ntohl(lsap->lsa_un.un_asla.asla_metric); + flags32 = EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric); ospf6_print_bits(ospf6_asla_flag_bits, flags32); printf(" metric %u", - (u_int32_t)ntohl(lsap->lsa_un.un_asla.asla_metric) & + EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric) & ASLA_MASK_METRIC); lsapp = lsap->lsa_un.un_asla.asla_prefix; k = ospf6_print_lsaprefix(lsapp); @@ -401,7 +401,7 @@ ospf6_print_lsa(register const struct lsa *lsap) register u_int32_t ul; TCHECK(*lp); - ul = ntohl(*lp); + ul = EXTRACT_32BITS(lp); printf(" tos %d metric %d", (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS, ul & SLA_MASK_METRIC); @@ -414,7 +414,7 @@ ospf6_print_lsa(register const struct lsa *lsap) mcp = lsap->lsa_un.un_mcla; while ((u_char *)mcp < ls_end) { TCHECK(mcp->mcla_vid); - switch (ntohl(mcp->mcla_vtype)) { + switch (EXTRACT_32BITS(&mcp->mcla_vtype)) { case MCLA_VERTEX_ROUTER: printf(" rtr rtrid %s", @@ -428,7 +428,7 @@ ospf6_print_lsa(register const struct lsa *lsap) default: printf(" ??VertexType %u??", - (u_int32_t)ntohl(mcp->mcla_vtype)); + EXTRACT_32BITS(&mcp->mcla_vtype)); break; } ++mcp; @@ -439,13 +439,13 @@ ospf6_print_lsa(register const struct lsa *lsap) /* Link LSA */ llsap = &lsap->lsa_un.un_llsa; TCHECK(llsap->llsa_options); - ospf6_print_bits(ospf6_option_bits, ntohl(llsap->llsa_options)); + ospf6_print_bits(ospf6_option_bits, EXTRACT_32BITS(&llsap->llsa_options)); TCHECK(llsap->llsa_nprefix); printf(" pri %d lladdr %s npref %d", llsap->llsa_priority, ip6addr_string(&llsap->llsa_lladdr), - (u_int32_t)ntohl(llsap->llsa_nprefix)); + EXTRACT_32BITS(&llsap->llsa_nprefix)); lsapp = llsap->llsa_prefix; - for (j = 0; j < ntohl(llsap->llsa_nprefix); j++) { + for (j = 0; j < EXTRACT_32BITS(&llsap->llsa_nprefix); j++) { k = ospf6_print_lsaprefix(lsapp); if (k) goto trunc; @@ -457,17 +457,17 @@ ospf6_print_lsa(register const struct lsa *lsap) /* Intra-Area-Prefix LSA */ TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_rtid); ospf6_print_ls_type( - ntohs(lsap->lsa_un.un_intra_ap.intra_ap_lstype), + EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype), &lsap->lsa_un.un_intra_ap.intra_ap_lsid, &lsap->lsa_un.un_intra_ap.intra_ap_rtid, "LinkStateType %d"); TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); printf(" npref %d", - ntohs(lsap->lsa_un.un_intra_ap.intra_ap_nprefix)); + EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix)); lsapp = lsap->lsa_un.un_intra_ap.intra_ap_prefix; for (j = 0; - j < ntohs(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); + j < EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix); j++) { k = ospf6_print_lsaprefix(lsapp); if (k) @@ -478,7 +478,7 @@ ospf6_print_lsa(register const struct lsa *lsap) default: printf(" ??LinkStateType 0x%04x??", - ntohs(lsap->ls_hdr.ls_type)); + EXTRACT_16BITS(&lsap->ls_hdr.ls_type)); } /* { (ctags) */ @@ -513,12 +513,12 @@ ospf6_decode_v3(register const struct ospf6hdr *op, if (vflag) { TCHECK(op->ospf6_hello.hello_deadint); ospf6_print_bits(ospf6_option_bits, - ntohl(op->ospf6_hello.hello_options)); + EXTRACT_32BITS(&op->ospf6_hello.hello_options)); printf(" ifid %s pri %d int %d dead %u", ipaddr_string(&op->ospf6_hello.hello_ifid), op->ospf6_hello.hello_priority, - ntohs(op->ospf6_hello.hello_helloint), - ntohs(op->ospf6_hello.hello_deadint)); + EXTRACT_16BITS(&op->ospf6_hello.hello_helloint), + EXTRACT_16BITS(&op->ospf6_hello.hello_deadint)); } TCHECK(op->ospf6_hello.hello_dr); if (op->ospf6_hello.hello_dr != 0) @@ -542,7 +542,7 @@ ospf6_decode_v3(register const struct ospf6hdr *op, case OSPF_TYPE_DB: TCHECK(op->ospf6_db.db_options); ospf6_print_bits(ospf6_option_bits, - ntohl(op->ospf6_db.db_options)); + EXTRACT_32BITS(&op->ospf6_db.db_options)); sep = ' '; TCHECK(op->ospf6_db.db_flags); if (op->ospf6_db.db_flags & OSPF6_DB_INIT) { @@ -558,8 +558,8 @@ ospf6_decode_v3(register const struct ospf6hdr *op, sep = '/'; } TCHECK(op->ospf6_db.db_seq); - printf(" mtu %u S %X", ntohs(op->ospf6_db.db_mtu), - (u_int32_t)ntohl(op->ospf6_db.db_seq)); + printf(" mtu %u S %X", EXTRACT_16BITS(&op->ospf6_db.db_mtu), + EXTRACT_32BITS(&op->ospf6_db.db_seq)); if (vflag) { /* Print all the LS adv's */ @@ -579,7 +579,7 @@ ospf6_decode_v3(register const struct ospf6hdr *op, while ((u_char *)lsrp < dataend) { TCHECK(*lsrp); printf(" {"); /* } (ctags) */ - ospf6_print_ls_type(ntohs(lsrp->ls_type), + ospf6_print_ls_type(EXTRACT_16BITS(&lsrp->ls_type), &lsrp->ls_stateid, &lsrp->ls_router, "LinkStateType %d"); @@ -594,12 +594,12 @@ ospf6_decode_v3(register const struct ospf6hdr *op, if (vflag) { lsap = op->ospf6_lsu.lsu_lsa; TCHECK(op->ospf6_lsu.lsu_count); - i = ntohl(op->ospf6_lsu.lsu_count); + i = EXTRACT_32BITS(&op->ospf6_lsu.lsu_count); while (i--) { if (ospf6_print_lsa(lsap)) goto trunc; lsap = (struct lsa *)((u_char *)lsap + - ntohs(lsap->ls_hdr.ls_length)); + EXTRACT_16BITS(&lsap->ls_hdr.ls_length)); } } break; @@ -644,8 +644,8 @@ ospf6_print(register const u_char *bp, register u_int length) return; TCHECK(op->ospf6_len); - if (length != ntohs(op->ospf6_len)) { - printf(" [len %d]", ntohs(op->ospf6_len)); + if (length != EXTRACT_16BITS(&op->ospf6_len)) { + printf(" [len %d]", EXTRACT_16BITS(&op->ospf6_len)); return; } dataend = bp + length; |