diff options
author | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-11-21 10:39:16 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-11-21 10:41:05 +0100 |
commit | ba983e34ca0af8196cfb5569d658f62961418480 (patch) | |
tree | 571bacd80f7ab1ecef9606546168cdef9a761094 /print-lisp.c | |
parent | 9759a5bc71a30159479f85a2d8aceb1f348ef818 (diff) | |
download | tcpdump-ba983e34ca0af8196cfb5569d658f62961418480.tar.gz |
LISP: Add and use istr[] and tstr[] strings
Update the output of a test accordingly.
Moreover:
Delete extra blank lines.
Diffstat (limited to 'print-lisp.c')
-rw-r--r-- | print-lisp.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/print-lisp.c b/print-lisp.c index 325f9840..c6d8809c 100644 --- a/print-lisp.c +++ b/print-lisp.c @@ -93,7 +93,6 @@ * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -109,6 +108,9 @@ #include "extract.h" #include "addrtoname.h" +static const char tstr[] = " [|LISP]"; +static const char istr[] = " (invalid)"; + #define IPv4_AFI 1 #define IPv6_AFI 2 #define TYPE_INDEX 4 @@ -278,7 +280,7 @@ void lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) packet_offset += auth_data_len; if (record_count == 0) - goto malformed; + goto invalid; /* Print all the EID records */ while ((length > packet_offset) && (record_count--)) { @@ -359,13 +361,13 @@ void lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) } /* - * Print xTR and Site ID. Handle the fact that the packet could be malformed. + * Print xTR and Site ID. Handle the fact that the packet could be invalid. * If the xTR_ID_Present bit is not set, and we still have data to display, * show it as hex data. */ if (xtr_present) { if (!ND_TTEST2(*(packet_iterator + packet_offset), 24)) - goto malformed; + goto invalid; hex_print_with_offset(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16, 0); ND_PRINT((ndo, "\n SITE-ID: %" PRIu64, EXTRACT_64BITS(packet_iterator + packet_offset + 16))); @@ -378,14 +380,13 @@ void lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) } return; trunc: - ND_PRINT((ndo, "\n [|LISP]")); + ND_PRINT((ndo, "\n %s", tstr)); return; -malformed: - ND_PRINT((ndo, "\n (malformed-packet)")); +invalid: + ND_PRINT((ndo, "\n %s", istr)); return; } - static inline uint8_t extract_lisp_type(uint8_t lisp_hdr_flags) { return (lisp_hdr_flags) >> TYPE_INDEX; @@ -425,7 +426,6 @@ static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr * return; } - static void action_flag(netdissect_options *ndo, uint8_t act_auth_inc_res) { uint8_t action; @@ -442,7 +442,6 @@ static void action_flag(netdissect_options *ndo, uint8_t act_auth_inc_res) ND_PRINT((ndo, " %s,", tok2str(lisp_eid_action, "unknown", action))); } - static void loc_hdr_flag(netdissect_options *ndo, uint16_t flag) { ND_PRINT((ndo, " flags [%s],", bittok2str(lisp_loc_flag, "none", flag))); |