format_sockaddr: add trivial support for AF_LOCAL sockets 61/8461/2
authorDave Barach <dave@barachs.net>
Tue, 19 Sep 2017 18:36:46 +0000 (14:36 -0400)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 19 Sep 2017 20:23:52 +0000 (20:23 +0000)
There isn't anything useful to print. Return a unique name since the
unix cli uses the returned string to create a node name.  Node names
must be unique, or vpp will quit abruptly.

Change-Id: I8f85ae8fececdbfd26c729bc32c2c2007c06d1ea
Signed-off-by: Dave Barach <dave@barachs.net>
src/vppinfra/unix-formats.c

index 9198651..b09433c 100644 (file)
@@ -231,6 +231,7 @@ u8 * format_sockaddr (u8 * s, va_list * args)
 {
   void * v = va_arg (*args, void *);
   struct sockaddr * sa = v;
+  static u32 local_counter;
 
   switch (sa->sa_family)
     {
@@ -243,6 +244,17 @@ u8 * format_sockaddr (u8 * s, va_list * args)
       }
       break;
 
+    case AF_LOCAL:
+      {
+        /* 
+         * There isn't anything useful to print.
+         * The unix cli world uses the output to make a node name,
+         * so we need to return a unique name. 
+         */
+        s = format (s, "local:%u", local_counter++);
+      }
+      break;
+
 #ifndef __KERNEL__
 #ifdef AF_NETLINK
     case AF_NETLINK: