Consolidate the [un]format_mac_address implementations
Change-Id: Ic4c42c5610a827234e6582501f0ddcba47aa34ee
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h
index 79ae7e6..0bfd487 100644
--- a/src/vnet/ethernet/ethernet.h
+++ b/src/vnet/ethernet/ethernet.h
@@ -339,6 +339,7 @@
void ethernet_register_l3_redirect (vlib_main_t * vm, u32 node_index);
/* Formats ethernet address X:X:X:X:X:X */
+u8 *format_mac_address (u8 * s, va_list * args);
u8 *format_ethernet_address (u8 * s, va_list * args);
u8 *format_ethernet_type (u8 * s, va_list * args);
u8 *format_ethernet_vlan_tci (u8 * s, va_list * va);
@@ -347,6 +348,7 @@
/* Parse ethernet address in either X:X:X:X:X:X unix or X.X.X cisco format. */
uword unformat_ethernet_address (unformat_input_t * input, va_list * args);
+uword unformat_mac_address (unformat_input_t * input, va_list * args);
/* Parse ethernet type as 0xXXXX or type name from ethernet/types.def.
In either host or network byte order. */
diff --git a/src/vnet/ethernet/format.c b/src/vnet/ethernet/format.c
index 13a209f..1ca1bce 100644
--- a/src/vnet/ethernet/format.c
+++ b/src/vnet/ethernet/format.c
@@ -55,6 +55,12 @@
}
u8 *
+format_mac_address (u8 * s, va_list * args)
+{
+ return (format_ethernet_address (s, args));
+}
+
+u8 *
format_ethernet_type (u8 * s, va_list * args)
{
ethernet_type_t type = va_arg (*args, u32);
@@ -231,6 +237,13 @@
|| unformat_user (input, unformat_ethernet_address_cisco, result));
}
+uword
+unformat_mac_address (unformat_input_t * input, va_list * args)
+{
+ return (unformat_ethernet_address (input, args));
+}
+
+
/* Returns ethernet type as an int in host byte order. */
uword
unformat_ethernet_type_host_byte_order (unformat_input_t * input,
diff --git a/src/vnet/lisp-cp/lisp_types.c b/src/vnet/lisp-cp/lisp_types.c
index 05f046f..d118717 100644
--- a/src/vnet/lisp-cp/lisp_types.c
+++ b/src/vnet/lisp-cp/lisp_types.c
@@ -204,22 +204,6 @@
}
uword
-unformat_mac_address (unformat_input_t * input, va_list * args)
-{
- u8 *a = va_arg (*args, u8 *);
- return unformat (input, "%x:%x:%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3],
- &a[4], &a[5]);
-}
-
-u8 *
-format_mac_address (u8 * s, va_list * args)
-{
- u8 *a = va_arg (*args, u8 *);
- return format (s, "%02x:%02x:%02x:%02x:%02x:%02x",
- a[0], a[1], a[2], a[3], a[4], a[5]);
-}
-
-uword
unformat_nsh_address (unformat_input_t * input, va_list * args)
{
nsh_t *a = va_arg (*args, nsh_t *);
diff --git a/src/vnet/lisp-cp/lisp_types.h b/src/vnet/lisp-cp/lisp_types.h
index 4a919e7..ff7880b 100644
--- a/src/vnet/lisp-cp/lisp_types.h
+++ b/src/vnet/lisp-cp/lisp_types.h
@@ -220,8 +220,6 @@
uword unformat_ip_address (unformat_input_t * input, va_list * args);
u8 *format_ip_prefix (u8 * s, va_list * args);
uword unformat_ip_prefix (unformat_input_t * input, va_list * args);
-u8 *format_mac_address (u8 * s, va_list * args);
-uword unformat_mac_address (unformat_input_t * input, va_list * args);
u16 ip4_address_size_to_put ();
u16 ip6_address_size_to_put ();