summaryrefslogtreecommitdiff
path: root/proto_ethernet.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-05-05 11:40:53 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-05-05 11:40:53 +0200
commitd245603ab331de51d774f3d69ba3689155b0eb53 (patch)
tree0fff18e7aad48df2a9974501d70e511db859edc0 /proto_ethernet.c
parent0102de0e67185a09c39d5b1e1b3c51bc1607144b (diff)
dissectors: ethernet: Display multicast/broadcast also in less mode
Commit a37101161784 ("dissectors: ethernet: Handle multicast/broadcast addresses properly") introduced handling of multicast/broadcast addresses in string translation, but only for the verbose mode. Also print these strings instead of "Unknown" in less mode. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'proto_ethernet.c')
-rw-r--r--proto_ethernet.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/proto_ethernet.c b/proto_ethernet.c
index 5a257f0..a8e10cf 100644
--- a/proto_ethernet.c
+++ b/proto_ethernet.c
@@ -26,7 +26,7 @@ static inline bool is_broadcast_ether_addr(const uint8_t *mac)
return (mac[0] & mac[1] & mac[2] & mac[3] & mac[4] & mac[5]) == 0xff;
}
-static const char *ether_lookup_addr(uint8_t *mac)
+static const char *ether_lookup_addr(const uint8_t *mac)
{
if (is_multicast_ether_addr(mac)) {
if (is_broadcast_ether_addr(mac))
@@ -82,12 +82,9 @@ static void ethernet_less(struct pkt_buff *pkt)
src_mac = eth->h_source;
dst_mac = eth->h_dest;
- tprintf(" %s => %s ",
- lookup_vendor_str((src_mac[0] << 16) | (src_mac[1] << 8) |
- src_mac[2]),
- lookup_vendor_str((dst_mac[0] << 16) | (dst_mac[1] << 8) |
- dst_mac[2]));
- tprintf("%s%s%s", colorize_start(bold),
+ tprintf(" %s => %s ", ether_lookup_addr(src_mac),
+ ether_lookup_addr(dst_mac));
+ tprintf("%s%s%s", colorize_start(bold),
lookup_ether_type(ntohs(eth->h_proto)), colorize_end());
pkt_set_dissector(pkt, &eth_lay2, ntohs(eth->h_proto));