aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-03-13 21:09:25 -0700
committerStefan Hajnoczi <stefanha@redhat.com>2015-05-11 14:49:03 +0100
commit890ee6abb385d6508bba7f5273c74a8e43bea6af (patch)
tree39111b90ce5dbf77ca041dace0821377c144e1f2 /net
parentb951cda21d6b232f138ccf008e12bce8ddc95465 (diff)
downloadqemu-890ee6abb385d6508bba7f5273c74a8e43bea6af.zip
qemu-890ee6abb385d6508bba7f5273c74a8e43bea6af.tar.gz
qemu-890ee6abb385d6508bba7f5273c74a8e43bea6af.tar.bz2
net: add MAC address string printer
We can use this in virtio-net code as well as new Rocker driver code, so up-level this. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1426306173-24884-2-git-send-email-sfeldma@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/net.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index 0be084d..7427f6a 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),