From 603293c5f9b1b7be1ea80587a4356316d793892d Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Thu, 13 Oct 2011 15:40:05 +0200 Subject: [PATCH] [Listener] Fix request display Use owl_mac_bytes_to_string_r() instead of owl_mac_bytes_to_string() when there are more than one address to display in a single printf(). --- owlps-listener/owlps-listenerd.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index 7cc7aeb..9cf68a6 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -137,11 +137,10 @@ int main(int argc, char *argv[]) get_mac_addr(GET_WIFI_IFACE(), my_mac_bytes) ; get_ip_addr(GET_WIFI_IFACE(), my_ip) ; if (VERBOSE_INFO) - { - printf("My MAC address is: %s\n", - owl_mac_bytes_to_string(my_mac_bytes)) ; - printf("My IP address is: %s\n", my_ip) ; - } + printf("My MAC address is: %s\n" + "My IP address is: %s\n", + owl_mac_bytes_to_string(my_mac_bytes), + my_ip) ; #ifdef USE_PTHREAD /* Set up threads */ @@ -1021,11 +1020,17 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, { char request_time_str[OWL_TIMESTAMP_STRLEN], - start_time_str[OWL_TIMESTAMP_STRLEN] ; + start_time_str[OWL_TIMESTAMP_STRLEN], + ap_mac_addr_str[OWL_ETHER_ADDR_STRLEN], + mobile_mac_addr_str[OWL_ETHER_ADDR_STRLEN] ; owl_timestamp_to_string(request_time_str, owl_ntoh_timestamp(request.request_time)) ; owl_timestamp_to_string(start_time_str, owl_ntoh_timestamp(request.start_time)) ; + owl_mac_bytes_to_string_r(request.ap_mac_addr_bytes, + ap_mac_addr_str) ; + owl_mac_bytes_to_string_r(request.mobile_mac_addr_bytes, + mobile_mac_addr_str) ; printf("*** Request to send ***\n" "\tType: %"PRIu8"\n" "\tMAC AP: %s\n" @@ -1039,8 +1044,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, "\tDirection: %hhd\n" , request.type, - owl_mac_bytes_to_string(request.ap_mac_addr_bytes), - owl_mac_bytes_to_string(request.mobile_mac_addr_bytes), + ap_mac_addr_str, + mobile_mac_addr_str, request_time_str, start_time_str, rtap_fields[RTAP_ANTENNASIGNALDBM] ?