diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-05-09 09:04:20 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-05-09 12:26:58 +0200 |
commit | 2b5ab9ae73292ee9e0cc01b86e127d9079a78fb2 (patch) | |
tree | d61840cd15c5a1ce6b417792c7e5977caf2de5fd /print-sll.c | |
parent | 8d3c2ed39e1b365da42c3aa5d2c5d6a6a5796bac (diff) | |
download | tcpdump-2b5ab9ae73292ee9e0cc01b86e127d9079a78fb2.tar.gz |
SLL: Update the SLL2 printing
Print the interface name without parentheses.
Always print the SLL2 packet type (In, Out, B, M or P).
Only print "ifindex N" with the -e option.
Diffstat (limited to 'print-sll.c')
-rw-r--r-- | print-sll.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/print-sll.c b/print-sll.c index 50335879..fe529efa 100644 --- a/print-sll.c +++ b/print-sll.c @@ -343,8 +343,7 @@ sll2_print(netdissect_options *ndo, const struct sll2_header *sllp, u_int length u_short ether_type; ndo->ndo_protocol = "sll2"; - ND_PRINT("%3s ", - tok2str(sll_pkttype_values,"?",GET_U_1(sllp->sll2_pkttype))); + ND_PRINT("ifindex %u ", GET_BE_U_4(sllp->sll2_if_index)); /* * XXX - check the link-layer address type value? @@ -429,12 +428,14 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char sllp = (const struct sll2_header *)p; #ifdef HAVE_NET_IF_H if_index = GET_BE_U_4(sllp->sll2_if_index); - if (if_indextoname(if_index, ifname)) - ND_PRINT("ifindex %u (%s) ", if_index, ifname); - else - ND_PRINT("ifindex %u ", if_index); + if (!if_indextoname(if_index, ifname)) + strncpy(ifname, "?", 2); + ND_PRINT("%-5s ", ifname); #endif + ND_PRINT("%-3s ", + tok2str(sll_pkttype_values, "?", GET_U_1(sllp->sll2_pkttype))); + if (ndo->ndo_eflag) sll2_print(ndo, sllp, length); |