From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNTVd-0000CH-74 for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNTVW-0001JB-95 for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:17 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:46053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNTVV-0001J0-Ux for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:10 -0500 Received: by pdjz10 with SMTP id z10so38929914pdj.12 for ; Mon, 16 Feb 2015 13:47:09 -0800 (PST) From: sfeldma@gmail.com Date: Mon, 16 Feb 2015 13:47:42 -0800 Message-Id: <1424123271-7656-2-git-send-email-sfeldma@gmail.com> In-Reply-To: <1424123271-7656-1-git-send-email-sfeldma@gmail.com> References: <1424123271-7656-1-git-send-email-sfeldma@gmail.com> Subject: [Qemu-devel] [PATCH v7 01/10] net: add MAC address string printer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, jiri@resnulli.us, roopa@cumulusnetworks.com, john.fastabend@gmail.com, eblake@redhat.com, pbonzini@redhat.com, stefanha@gmail.com, dsahern@gmail.com, jasowang@redhat.com From: Scott Feldman We can use this in virtio-net code as well as new Rocker driver code, so up-level this. Signed-off-by: Scott Feldman Reviewed-by: Eric Blake --- include/net/net.h | 1 + net/net.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 008d610..90742f0 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -97,6 +97,7 @@ typedef struct NICState { bool peer_deleted; } NICState; +char *qemu_mac_strdup_printf(const uint8_t *macaddr); NetClientState *qemu_find_netdev(const char *id); int qemu_find_net_clients_except(const char *id, NetClientState **ncs, NetClientOptionsKind type, int max); diff --git a/net/net.c b/net/net.c index 74e651e..a942a04 100644 --- a/net/net.c +++ b/net/net.c @@ -151,6 +151,13 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str) return 0; } +char *qemu_mac_strdup_printf(const uint8_t *macaddr) +{ + return g_strdup_printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", + macaddr[0], macaddr[1], macaddr[2], + macaddr[3], macaddr[4], macaddr[5]); +} + void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]) { snprintf(nc->info_str, sizeof(nc->info_str), -- 1.7.10.4