From ef65cb0696b3ee42834a72a35c1eb08da75eed99 Mon Sep 17 00:00:00 2001 From: Pierre Pfister Date: Fri, 19 Feb 2016 13:52:44 +0000 Subject: Add custom mac address option to vhost interfaces. Generating a new MAC address everytime vpp reboots can quickly become cumbersome (e.g. in test scenarios). This commit allows vhost mac addresses to be configured manually. Change-Id: Ic6d16a2d14cdf8e49dc29041bbafde39d9fc8370 Signed-off-by: Pierre Pfister --- vpp-api-test/vat/api_format.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'vpp-api-test/vat/api_format.c') diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 13b2c0d6..a1a023be 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -6893,6 +6893,8 @@ static int api_create_vhost_user_if (vat_main_t * vam) u8 is_server = 0; u8 file_name_set = 0; u32 custom_dev_instance = ~0; + u8 hwaddr[6]; + u8 use_custom_mac = 0; while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { if (unformat (i, "socket %s", &file_name)) { @@ -6900,6 +6902,8 @@ static int api_create_vhost_user_if (vat_main_t * vam) } else if (unformat (i, "renumber %"PRIu32, &custom_dev_instance)) ; + else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr)) + use_custom_mac = 1; else if (unformat (i, "server")) is_server = 1; else @@ -6926,6 +6930,8 @@ static int api_create_vhost_user_if (vat_main_t * vam) mp->renumber = 1; mp->custom_dev_instance = ntohl(custom_dev_instance); } + mp->use_custom_mac = use_custom_mac; + memcpy(mp->mac_address, hwaddr, 6); S; W; /* NOTREACHED */ @@ -8993,7 +8999,8 @@ _(l2_interface_vlan_tag_rewrite, \ "[disable][push-[1|2]][pop-[1|2]][translate-1-[1|2]] \n" \ "[translate-2-[1|2]] [push_dot1q 0] tag1 tag2 ") \ _(create_vhost_user_if, \ - "socket [server] [renumber ]") \ + "socket [server] [renumber ] " \ + "[mac ]") \ _(modify_vhost_user_if, \ " | sw_if_index socket \n" \ "[server] [renumber ]") \ -- cgit 1.2.3-korg