summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/dslite/dslite_cli.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-03-11 12:49:46 +0100
committerFilip Varga <fivarga@cisco.com>2020-03-11 17:41:40 +0100
commitf2833e42c1e3721ce06b0f510447d8a6dd3e5eb4 (patch)
treeb1a6711d4958b9cca4a1ded5b4b94742225e1562 /src/plugins/nat/dslite/dslite_cli.c
parent92a6ac24f36dcc7e22682c0ce448cefc23d58e5e (diff)
nat: dslite plugin separation
Type: refactor Signed-off-by: Filip Varga <fivarga@cisco.com> Change-Id: I81546423200cc7f8a06b527dac8ead191a9e0519
Diffstat (limited to 'src/plugins/nat/dslite/dslite_cli.c')
-rw-r--r--src/plugins/nat/dslite/dslite_cli.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/nat/dslite/dslite_cli.c b/src/plugins/nat/dslite/dslite_cli.c
index d5c0ca6498b..0819f95261a 100644
--- a/src/plugins/nat/dslite/dslite_cli.c
+++ b/src/plugins/nat/dslite/dslite_cli.c
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <nat/dslite/dslite.h>
static clib_error_t *
@@ -205,6 +204,25 @@ dslite_show_b4_ip6_addr_command_fn (vlib_main_t * vm,
}
static u8 *
+format_nat_protocol (u8 * s, va_list * args)
+{
+ u32 i = va_arg (*args, u32);
+ u8 *t = 0;
+
+ switch (i)
+ {
+#define _(N, j, n, str) case NAT_PROTOCOL_##N: t = (u8 *) str; break;
+ foreach_nat_protocol
+#undef _
+ default:
+ s = format (s, "unknown");
+ return s;
+ }
+ s = format (s, "%s", t);
+ return s;
+}
+
+static u8 *
format_dslite_session (u8 * s, va_list * args)
{
dslite_session_t *session = va_arg (*args, dslite_session_t *);
@@ -216,7 +234,7 @@ format_dslite_session (u8 * s, va_list * args)
clib_net_to_host_u16 (session->in2out.port),
format_ip4_address, &session->out2in.addr,
clib_net_to_host_u16 (session->out2in.port),
- format_snat_protocol, session->in2out.proto);
+ format_nat_protocol, session->in2out.proto);
s = format (s, "%Utotal pkts %d, total bytes %lld\n",
format_white_space, indent + 4,
session->total_pkts, session->total_bytes);