diff --git a/src/vnet/unix/gdb_funcs.c b/src/vnet/unix/gdb_funcs.c
index 40d0d66..41ae3bd 100644
--- a/src/vnet/unix/gdb_funcs.c
+++ b/src/vnet/unix/gdb_funcs.c
@@ -31,7 +31,8 @@
  * @return length - u32
  *
  */
-u32 vl(void *p)
+u32
+vl (void *p)
 {
   return vec_len (p);
 }
@@ -44,9 +45,10 @@
  * @return number - uword
  *
  */
-uword pe (void *v)
+uword
+pe (void *v)
 {
-  return (pool_elts(v));
+  return (pool_elts (v));
 }
 
 /**
@@ -58,7 +60,8 @@
  * @return 0|1 - int
  *
  */
-int pifi (void *p, u32 index)
+int
+pifi (void *p, u32 index)
 {
   return pool_is_free_index (p, index);
 }
@@ -70,7 +73,8 @@
  * @param n - u32 - number of bytes to format
  *
  */
-void debug_hex_bytes (u8 *s, u32 n)
+void
+debug_hex_bytes (u8 * s, u32 n)
 {
   fformat (stderr, "%U\n", format_hex_bytes, s, n);
 }
@@ -79,39 +83,39 @@
  * @brief GDB callable function: vlib_dump_frame_ownership
  *
  */
-void vlib_dump_frame_ownership (void)
+void
+vlib_dump_frame_ownership (void)
 {
-  vlib_main_t * vm = vlib_get_main();
-  vlib_node_main_t * nm = &vm->node_main;
-  vlib_node_runtime_t * this_node_runtime;
-  vlib_next_frame_t * nf;
+  vlib_main_t *vm = vlib_get_main ();
+  vlib_node_main_t *nm = &vm->node_main;
+  vlib_node_runtime_t *this_node_runtime;
+  vlib_next_frame_t *nf;
   u32 first_nf_index;
   u32 index;
 
-  vec_foreach(this_node_runtime, nm->nodes_by_type[VLIB_NODE_TYPE_INTERNAL])
-    {
-      first_nf_index = this_node_runtime->next_frame_index;
+  vec_foreach (this_node_runtime, nm->nodes_by_type[VLIB_NODE_TYPE_INTERNAL])
+  {
+    first_nf_index = this_node_runtime->next_frame_index;
 
-      for (index = first_nf_index; index < first_nf_index + 
-             this_node_runtime->n_next_nodes; index++) 
-        {
-          vlib_node_runtime_t * owned_runtime;
-          nf = vec_elt_at_index (vm->node_main.next_frames, index);
-          if (nf->flags & VLIB_FRAME_OWNER) 
-            {
-              owned_runtime = vec_elt_at_index (nm->nodes_by_type[0],
-                                                nf->node_runtime_index);
-              fformat(stderr, 
-                      "%s next index %d owns enqueue rights to %s\n",
-                      nm->nodes[this_node_runtime->node_index]->name, 
-                      index - first_nf_index, 
-                      nm->nodes[owned_runtime->node_index]->name);
-              fformat (stderr, "  nf index %d nf->frame_index %d\n",
-                       nf - vm->node_main.next_frames, 
-                       nf->frame_index);
-            }
-        }
-    }
+    for (index = first_nf_index; index < first_nf_index +
+	 this_node_runtime->n_next_nodes; index++)
+      {
+	vlib_node_runtime_t *owned_runtime;
+	nf = vec_elt_at_index (vm->node_main.next_frames, index);
+	if (nf->flags & VLIB_FRAME_OWNER)
+	  {
+	    owned_runtime = vec_elt_at_index (nm->nodes_by_type[0],
+					      nf->node_runtime_index);
+	    fformat (stderr,
+		     "%s next index %d owns enqueue rights to %s\n",
+		     nm->nodes[this_node_runtime->node_index]->name,
+		     index - first_nf_index,
+		     nm->nodes[owned_runtime->node_index]->name);
+	    fformat (stderr, "  nf index %d nf->frame_index %d\n",
+		     nf - vm->node_main.next_frames, nf->frame_index);
+	  }
+      }
+  }
 }
 
 /**
@@ -121,45 +125,49 @@
  *
  * @param index - u32
  */
-void vlib_runtime_index_to_node_name (u32 index)
+void
+vlib_runtime_index_to_node_name (u32 index)
 {
-  vlib_main_t * vm = vlib_get_main();
-  vlib_node_main_t * nm = &vm->node_main;
+  vlib_main_t *vm = vlib_get_main ();
+  vlib_node_main_t *nm = &vm->node_main;
 
   if (index > vec_len (nm->nodes))
     {
-      fformat(stderr, "%d out of range, max %d\n", vec_len(nm->nodes));
+      fformat (stderr, "%d out of range, max %d\n", vec_len (nm->nodes));
       return;
     }
 
-  fformat(stderr, "node runtime index %d name %s\n", index, nm->nodes[index]->name);
+  fformat (stderr, "node runtime index %d name %s\n", index,
+	   nm->nodes[index]->name);
 }
 
-void gdb_show_errors (int verbose)
+void
+gdb_show_errors (int verbose)
 {
   extern vlib_cli_command_t vlib_cli_show_errors;
   unformat_input_t input;
-  vlib_main_t * vm = vlib_get_main();
+  vlib_main_t *vm = vlib_get_main ();
 
   if (verbose == 0)
     unformat_init_string (&input, "verbose 0", 9);
   else if (verbose == 1)
     unformat_init_string (&input, "verbose 1", 9);
-  else 
+  else
     {
-      fformat(stderr, "verbose not 0 or 1\n");
+      fformat (stderr, "verbose not 0 or 1\n");
       return;
     }
 
-  vlib_cli_show_errors.function (vm, &input, 0 /* cmd */);
+  vlib_cli_show_errors.function (vm, &input, 0 /* cmd */ );
   unformat_free (&input);
-}  
+}
 
-void gdb_show_session (int verbose)
+void
+gdb_show_session (int verbose)
 {
   extern vlib_cli_command_t vlib_cli_show_session_command;
   unformat_input_t input;
-  vlib_main_t * vm = vlib_get_main();
+  vlib_main_t *vm = vlib_get_main ();
 
   if (verbose == 0)
     unformat_init_string (&input, "verbose 0", 9);
@@ -167,15 +175,15 @@
     unformat_init_string (&input, "verbose 1", 9);
   else if (verbose == 2)
     unformat_init_string (&input, "verbose 2", 9);
-  else 
+  else
     {
-      fformat(stderr, "verbose not 0 - 2\n");
+      fformat (stderr, "verbose not 0 - 2\n");
       return;
     }
 
-  vlib_cli_show_session_command.function (vm, &input, 0 /* cmd */);
+  vlib_cli_show_session_command.function (vm, &input, 0 /* cmd */ );
   unformat_free (&input);
-}  
+}
 
 /**
  * @brief GDB callable function: show_gdb_command_fn - show gdb
@@ -186,8 +194,7 @@
  */
 static clib_error_t *
 show_gdb_command_fn (vlib_main_t * vm,
-                     unformat_input_t * input,
-                     vlib_cli_command_t * cmd)
+		     unformat_input_t * input, vlib_cli_command_t * cmd)
 {
   vlib_cli_output (vm, "vl(p) returns vec_len(p)");
   vlib_cli_output (vm, "vb(b) returns vnet_buffer(b) [opaque]");
@@ -203,35 +210,50 @@
   return 0;
 }
 
+/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (show_gdb_funcs_command, static) = {
   .path = "show gdb",
   .short_help = "Describe functions which can be called from gdb",
   .function = show_gdb_command_fn,
 };
+/* *INDENT-ON* */
 
-vnet_buffer_opaque_t *vb (void *vb_arg)
+vnet_buffer_opaque_t *
+vb (void *vb_arg)
 {
-    vlib_buffer_t *b = (vlib_buffer_t *)vb_arg;
-    vnet_buffer_opaque_t *rv;
-    
-    rv = vnet_buffer (b);
+  vlib_buffer_t *b = (vlib_buffer_t *) vb_arg;
+  vnet_buffer_opaque_t *rv;
 
-    return rv;
+  rv = vnet_buffer (b);
+
+  return rv;
 }
 
-vnet_buffer_opaque2_t *vb2 (void *vb_arg)
+vnet_buffer_opaque2_t *
+vb2 (void *vb_arg)
 {
-    vlib_buffer_t *b = (vlib_buffer_t *)vb_arg;
-    vnet_buffer_opaque2_t *rv;
-    
-    rv = vnet_buffer2(b);
+  vlib_buffer_t *b = (vlib_buffer_t *) vb_arg;
+  vnet_buffer_opaque2_t *rv;
 
-    return rv;
+  rv = vnet_buffer2 (b);
+
+  return rv;
 }
 
 
 /* Cafeteria plan, maybe you don't want these functions */
-clib_error_t * 
-gdb_func_init (vlib_main_t * vm) { return 0; } 
+clib_error_t *
+gdb_func_init (vlib_main_t * vm)
+{
+  return 0;
+}
 
 VLIB_INIT_FUNCTION (gdb_func_init);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/pcap.c b/src/vnet/unix/pcap.c
index bba225f..0832b16 100644
--- a/src/vnet/unix/pcap.c
+++ b/src/vnet/unix/pcap.c
@@ -88,20 +88,22 @@
 clib_error_t *
 pcap_write (pcap_main_t * pm)
 {
-  clib_error_t * error = 0;
+  clib_error_t *error = 0;
 
-  if (! (pm->flags & PCAP_MAIN_INIT_DONE))
+  if (!(pm->flags & PCAP_MAIN_INIT_DONE))
     {
       pcap_file_header_t fh;
       int n;
 
-      if (! pm->file_name)
+      if (!pm->file_name)
 	pm->file_name = "/tmp/vnet.pcap";
 
-      pm->file_descriptor = open (pm->file_name, O_CREAT | O_TRUNC | O_WRONLY, 0664);
+      pm->file_descriptor =
+	open (pm->file_name, O_CREAT | O_TRUNC | O_WRONLY, 0664);
       if (pm->file_descriptor < 0)
 	{
-	  error = clib_error_return_unix (0, "failed to open `%s'", pm->file_name);
+	  error =
+	    clib_error_return_unix (0, "failed to open `%s'", pm->file_name);
 	  goto done;
 	}
 
@@ -121,9 +123,13 @@
       if (n != sizeof (fh))
 	{
 	  if (n < 0)
-	    error = clib_error_return_unix (0, "write file header `%s'", pm->file_name);
+	    error =
+	      clib_error_return_unix (0, "write file header `%s'",
+				      pm->file_name);
 	  else
-	    error = clib_error_return (0, "short write of file header `%s'", pm->file_name);
+	    error =
+	      clib_error_return (0, "short write of file header `%s'",
+				 pm->file_name);
 	  goto done;
 	}
     }
@@ -133,15 +139,16 @@
       int n = vec_len (pm->pcap_data) - pm->n_pcap_data_written;
 
       n = write (pm->file_descriptor,
-		 vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written), n);
+		 vec_elt_at_index (pm->pcap_data, pm->n_pcap_data_written),
+		 n);
 
       if (n < 0 && unix_error_is_fatal (errno))
 	{
 	  error = clib_error_return_unix (0, "write `%s'", pm->file_name);
 	  goto done;
 	}
-        pm->n_pcap_data_written += n;
-      }
+      pm->n_pcap_data_written += n;
+    }
 
   if (pm->n_pcap_data_written >= vec_len (pm->pcap_data))
     {
@@ -150,9 +157,9 @@
     }
 
   if (pm->n_packets_captured >= pm->n_packets_to_capture)
-    pcap_close(pm);
+    pcap_close (pm);
 
- done:
+done:
   if (error)
     {
       if (pm->file_descriptor >= 0)
@@ -167,9 +174,10 @@
  * @return rc - clib_error_t
  *
  */
-clib_error_t * pcap_read (pcap_main_t * pm)
+clib_error_t *
+pcap_read (pcap_main_t * pm)
 {
-  clib_error_t * error = 0;
+  clib_error_t *error = 0;
   int fd, need_swap, n;
   pcap_file_header_t fh;
   pcap_packet_header_t ph;
@@ -183,7 +191,8 @@
 
   if (read (fd, &fh, sizeof (fh)) != sizeof (fh))
     {
-      error = clib_error_return_unix (0, "read file header `%s'", pm->file_name);
+      error =
+	clib_error_return_unix (0, "read file header `%s'", pm->file_name);
       goto done;
     }
 
@@ -194,7 +203,7 @@
 #define _(t,f) fh.f = clib_byte_swap_##t (fh.f);
       foreach_pcap_file_header;
 #undef _
-    }    
+    }
 
   if (fh.magic != 0xa1b2c3d4)
     {
@@ -206,7 +215,7 @@
   pm->max_packet_bytes = 0;
   while ((n = read (fd, &ph, sizeof (ph))) != 0)
     {
-      u8 * data;
+      u8 *data;
 
       if (need_swap)
 	{
@@ -216,7 +225,8 @@
 	}
 
       data = vec_new (u8, ph.n_bytes_in_packet);
-      if (read (fd, data, ph.n_packet_bytes_stored_in_file) != ph.n_packet_bytes_stored_in_file)
+      if (read (fd, data, ph.n_packet_bytes_stored_in_file) !=
+	  ph.n_packet_bytes_stored_in_file)
 	{
 	  error = clib_error_return (0, "short read `%s'", pm->file_name);
 	  goto done;
@@ -226,16 +236,26 @@
 	pm->min_packet_bytes = pm->max_packet_bytes = ph.n_bytes_in_packet;
       else
 	{
-	  pm->min_packet_bytes = clib_min (pm->min_packet_bytes, ph.n_bytes_in_packet);
-	  pm->max_packet_bytes = clib_max (pm->max_packet_bytes, ph.n_bytes_in_packet);
+	  pm->min_packet_bytes =
+	    clib_min (pm->min_packet_bytes, ph.n_bytes_in_packet);
+	  pm->max_packet_bytes =
+	    clib_max (pm->max_packet_bytes, ph.n_bytes_in_packet);
 	}
 
       vec_add1 (pm->packets_read, data);
     }
 
- done:
+done:
   if (fd >= 0)
     close (fd);
   return error;
 
 }
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/pcap.h b/src/vnet/unix/pcap.h
index 6aaf32b..e3fac45 100644
--- a/src/vnet/unix/pcap.h
+++ b/src/vnet/unix/pcap.h
@@ -61,7 +61,8 @@
   _ (ip, 12)					\
   _ (hdlc, 104)
 
-typedef enum {
+typedef enum
+{
 #define _(f,n) PCAP_PACKET_TYPE_##f = (n),
   foreach_vnet_pcap_packet_type
 #undef _
@@ -89,7 +90,8 @@
   _ (u32, packet_type)
 
 /** File header struct */
-typedef struct {
+typedef struct
+{
 #define _(t, f) t f;
   foreach_pcap_file_header
 #undef _
@@ -107,11 +109,11 @@
   _ (u32, n_bytes_in_packet)
 
 /** Packet header. */
-typedef struct {
+typedef struct
+{
 #define _(t, f) t f;
   foreach_pcap_packet_header
 #undef _
-
   /** Packet data follows. */
   u8 data[0];
 } pcap_packet_header_t;
@@ -119,9 +121,10 @@
 /**
  * @brief PCAP main state data structure
  */
-typedef struct {
+typedef struct
+{
   /** File name of pcap output. */
-  char * file_name;
+  char *file_name;
 
   /** Number of packets to capture. */
   u32 n_packets_to_capture;
@@ -143,20 +146,20 @@
   u32 n_pcap_data_written;
 
   /** Vector of pcap data. */
-  u8 * pcap_data;
+  u8 *pcap_data;
 
   /** Packets read from file. */
-  u8 ** packets_read;
+  u8 **packets_read;
 
   /** Min/Max Packet bytes */
   u32 min_packet_bytes, max_packet_bytes;
 } pcap_main_t;
 
 /** Write out data to output file. */
-clib_error_t * pcap_write (pcap_main_t * pm);
+clib_error_t *pcap_write (pcap_main_t * pm);
 
 /** Read data from file. */
-clib_error_t * pcap_read (pcap_main_t * pm);
+clib_error_t *pcap_read (pcap_main_t * pm);
 
 /**
  * @brief Add packet
@@ -171,17 +174,15 @@
  */
 static inline void *
 pcap_add_packet (pcap_main_t * pm,
-		 f64 time_now,
-		 u32 n_bytes_in_trace,
-		 u32 n_bytes_in_packet)
+		 f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
 {
-  pcap_packet_header_t * h;
-  u8 * d;
+  pcap_packet_header_t *h;
+  u8 *d;
 
   vec_add2 (pm->pcap_data, d, sizeof (h[0]) + n_bytes_in_trace);
   h = (void *) (d);
   h->time_in_sec = time_now;
-  h->time_in_usec = 1e6*(time_now - h->time_in_sec);
+  h->time_in_usec = 1e6 * (time_now - h->time_in_sec);
   h->n_packet_bytes_stored_in_file = n_bytes_in_trace;
   h->n_bytes_in_packet = n_bytes_in_packet;
   pm->n_packets_captured++;
@@ -199,14 +200,13 @@
  */
 static inline void
 pcap_add_buffer (pcap_main_t * pm,
-		 vlib_main_t * vm, u32 buffer_index,
-		 u32 n_bytes_in_trace)
+		 vlib_main_t * vm, u32 buffer_index, u32 n_bytes_in_trace)
 {
-  vlib_buffer_t * b = vlib_get_buffer (vm, buffer_index);
+  vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
   u32 n = vlib_buffer_length_in_chain (vm, b);
   i32 n_left = clib_min (n_bytes_in_trace, n);
   f64 time_now = vlib_time_now (vm);
-  void * d;
+  void *d;
 
   d = pcap_add_packet (pm, time_now, n_left, n);
   while (1)
@@ -222,9 +222,17 @@
     }
 
   /** Flush output vector. */
-  if (vec_len (pm->pcap_data) >= 64*1024
+  if (vec_len (pm->pcap_data) >= 64 * 1024
       || pm->n_packets_captured >= pm->n_packets_to_capture)
     pcap_write (pm);
 }
 
 #endif /* included_vnet_pcap_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/pcap2pg.c b/src/vnet/unix/pcap2pg.c
index 217a61f..46d6bfc 100644
--- a/src/vnet/unix/pcap2pg.c
+++ b/src/vnet/unix/pcap2pg.c
@@ -28,12 +28,10 @@
 /**
  * @brief char * to seed a PG file
  */
-static char * pg_fmt =
+static char *pg_fmt =
   "packet-generator new {\n"
   "    name s%d\n"
-  "    limit 1\n"
-  "    size %d-%d\n"
-  "    node ethernet-input\n";
+  "    limit 1\n" "    size %d-%d\n" "    node ethernet-input\n";
 
 
 /**
@@ -43,9 +41,10 @@
  * @param i - int
  * @param *pkt - u8
  */
-void stream_boilerplate (FILE *ofp, int i, u8 * pkt)
+void
+stream_boilerplate (FILE * ofp, int i, u8 * pkt)
 {
-  fformat(ofp, pg_fmt, i, vec_len(pkt), vec_len(pkt));
+  fformat (ofp, pg_fmt, i, vec_len (pkt), vec_len (pkt));
 }
 
 /**
@@ -57,7 +56,8 @@
  * @return rc - int
  *
  */
-int pcap2pg (pcap_main_t * pm, FILE *ofp)
+int
+pcap2pg (pcap_main_t * pm, FILE * ofp)
 {
   int i, j;
   u8 *pkt;
@@ -65,11 +65,11 @@
   for (i = 0; i < vec_len (pm->packets_read); i++)
     {
       int offset;
-      ethernet_header_t * h;
+      ethernet_header_t *h;
       u64 ethertype;
 
       pkt = pm->packets_read[i];
-      h = (ethernet_header_t *)pkt;
+      h = (ethernet_header_t *) pkt;
 
       stream_boilerplate (ofp, i, pkt);
 
@@ -83,36 +83,34 @@
        * This transforms captured 802.1q VLAN packets into
        * regular Ethernet packets.
        */
-      if (ethertype == 0x8100 /* 802.1q vlan */)
-        {
-          u16 * vlan_ethertype = (u16 *)(h+1);
-          ethertype = clib_net_to_host_u16(vlan_ethertype[0]);
-          offset = 18;
-        }
+      if (ethertype == 0x8100 /* 802.1q vlan */ )
+	{
+	  u16 *vlan_ethertype = (u16 *) (h + 1);
+	  ethertype = clib_net_to_host_u16 (vlan_ethertype[0]);
+	  offset = 18;
+	}
       else
-        offset = 14;
+	offset = 14;
 
       fformat (ofp,
-               "          0x%04x: %02x%02x.%02x%02x.%02x%02x"
-               " -> %02x%02x.%02x%02x.%02x%02x\n",
-               ethertype,
-               h->src_address[0],
-               h->src_address[1],
-               h->src_address[2],
-               h->src_address[3],
-               h->src_address[4],
-               h->src_address[5],
-               h->dst_address[0],
-               h->dst_address[1],
-               h->dst_address[2],
-               h->dst_address[3],
-               h->dst_address[4],
-               h->dst_address[5]);
+	       "          0x%04x: %02x%02x.%02x%02x.%02x%02x"
+	       " -> %02x%02x.%02x%02x.%02x%02x\n",
+	       ethertype,
+	       h->src_address[0],
+	       h->src_address[1],
+	       h->src_address[2],
+	       h->src_address[3],
+	       h->src_address[4],
+	       h->src_address[5],
+	       h->dst_address[0],
+	       h->dst_address[1],
+	       h->dst_address[2],
+	       h->dst_address[3], h->dst_address[4], h->dst_address[5]);
 
       fformat (ofp, "      hex 0x");
 
       for (j = offset; j < vec_len (pkt); j++)
-          fformat (ofp, "%02x", pkt[j]);
+	fformat (ofp, "%02x", pkt[j]);
 
       fformat (ofp, " }\n");
       fformat (ofp, "}\n\n");
@@ -124,37 +122,38 @@
  * @brief pcap2pg.
  * usage: pcap2pg -i <input-file> [-o <output-file>]
  */
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
 {
   unformat_input_t input;
-  pcap_main_t * pm = &pcap_main;
-  u8 * input_file = 0, * output_file = 0;
-  FILE * ofp;
-  clib_error_t * error;
+  pcap_main_t *pm = &pcap_main;
+  u8 *input_file = 0, *output_file = 0;
+  FILE *ofp;
+  clib_error_t *error;
 
   unformat_init_command_line (&input, argv);
 
   while (unformat_check_input (&input) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat(&input, "-i %s", &input_file)
-          || unformat (&input, "input %s", &input_file))
-        ;
+      if (unformat (&input, "-i %s", &input_file)
+	  || unformat (&input, "input %s", &input_file))
+	;
       else if (unformat (&input, "-o %s", &output_file)
-               || unformat (&input, "output %s", &output_file))
-        ;
-      else 
-        {
-        usage:
-          fformat(stderr, 
-                  "usage: pcap2pg -i <input-file> [-o <output-file>]\n");
-          exit (1);
-        }
+	       || unformat (&input, "output %s", &output_file))
+	;
+      else
+	{
+	usage:
+	  fformat (stderr,
+		   "usage: pcap2pg -i <input-file> [-o <output-file>]\n");
+	  exit (1);
+	}
     }
 
   if (input_file == 0)
     goto usage;
-  
-  pm->file_name = (char *)input_file;
+
+  pm->file_name = (char *) input_file;
   error = pcap_read (pm);
 
   if (error)
@@ -165,18 +164,26 @@
 
   if (output_file)
     {
-      ofp = fopen ((char *)output_file, "rw");
+      ofp = fopen ((char *) output_file, "rw");
       if (ofp == NULL)
-        clib_unix_warning ("Couldn't create '%s'", output_file);
+	clib_unix_warning ("Couldn't create '%s'", output_file);
       exit (1);
     }
   else
     {
       ofp = stdout;
     }
-  
+
   pcap2pg (pm, ofp);
 
   fclose (ofp);
   exit (0);
 }
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 3ad8338..10a86a4 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -49,12 +49,13 @@
 static vlib_node_registration_t tapcli_rx_node;
 
 static void tapcli_nopunt_frame (vlib_main_t * vm,
-                                 vlib_node_runtime_t * node,
-                                 vlib_frame_t * frame);
+				 vlib_node_runtime_t * node,
+				 vlib_frame_t * frame);
 /**
  * @brief Struct for the tapcli interface
  */
-typedef struct {
+typedef struct
+{
   u32 unix_fd;
   u32 clib_file_index;
   u32 provision_fd;
@@ -71,7 +72,8 @@
 /**
  * @brief Struct for RX trace
  */
-typedef struct {
+typedef struct
+{
   u16 sw_if_index;
 } tapcli_rx_trace_t;
 
@@ -84,14 +86,14 @@
  * @return *s - u8 - formatted string
  *
  */
-u8 * format_tapcli_rx_trace (u8 * s, va_list * va)
+u8 *
+format_tapcli_rx_trace (u8 * s, va_list * va)
 {
   CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *);
   CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
-  vnet_main_t * vnm = vnet_get_main();
-  tapcli_rx_trace_t * t = va_arg (*va, tapcli_rx_trace_t *);
-  s = format (s, "%U", format_vnet_sw_if_index_name,
-                vnm, t->sw_if_index);
+  vnet_main_t *vnm = vnet_get_main ();
+  tapcli_rx_trace_t *t = va_arg (*va, tapcli_rx_trace_t *);
+  s = format (s, "%U", format_vnet_sw_if_index_name, vnm, t->sw_if_index);
   return s;
 }
 
@@ -102,18 +104,19 @@
 {
   /** Vector of VLIB rx buffers to use.  We allocate them in blocks
      of VLIB_FRAME_SIZE (256). */
-  u32 * rx_buffers;
+  u32 *rx_buffers;
 
   /** Vector of iovecs for readv/writev calls. */
-  struct iovec * iovecs;  
+  struct iovec *iovecs;
 } tapcli_per_thread_t;
 
 /**
  * @brief TAPCLI main state struct
  */
-typedef struct {
+typedef struct
+{
   /** per thread variables */
-  tapcli_per_thread_t * threads;
+  tapcli_per_thread_t *threads;
 
   /** tap device destination MAC address. Required, or Linux drops pkts */
   u8 ether_dst_mac[6];
@@ -122,30 +125,30 @@
   u32 mtu_bytes, mtu_buffers;
 
   /** Vector of tap interfaces */
-  tapcli_interface_t * tapcli_interfaces;
+  tapcli_interface_t *tapcli_interfaces;
 
   /** Vector of deleted tap interfaces */
-  u32 * tapcli_inactive_interfaces;
+  u32 *tapcli_inactive_interfaces;
 
   /** Bitmap of tap interfaces with pending reads */
-  uword * pending_read_bitmap;
+  uword *pending_read_bitmap;
 
   /** Hash table to find tapcli interface given hw_if_index */
-  uword * tapcli_interface_index_by_sw_if_index;
+  uword *tapcli_interface_index_by_sw_if_index;
 
   /** Hash table to find tapcli interface given unix fd */
-  uword * tapcli_interface_index_by_unix_fd;
+  uword *tapcli_interface_index_by_unix_fd;
 
   /** renumbering table */
-  u32 * show_dev_instance_by_real_dev_instance;
+  u32 *show_dev_instance_by_real_dev_instance;
 
   /** 1 => disable CLI */
   int is_disabled;
 
   /** convenience - vlib_main_t */
-  vlib_main_t * vlib_main;
+  vlib_main_t *vlib_main;
   /** convenience - vnet_main_t */
-  vnet_main_t * vnet_main;
+  vnet_main_t *vnet_main;
 } tapcli_main_t;
 
 static tapcli_main_t tapcli_main;
@@ -165,48 +168,46 @@
  *
  */
 static uword
-tapcli_tx (vlib_main_t * vm,
-	   vlib_node_runtime_t * node,
-	   vlib_frame_t * frame)
+tapcli_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  u32 * buffers = vlib_frame_args (frame);
+  u32 *buffers = vlib_frame_args (frame);
   uword n_packets = frame->n_vectors;
-  tapcli_main_t * tm = &tapcli_main;
-  tapcli_interface_t * ti;
+  tapcli_main_t *tm = &tapcli_main;
+  tapcli_interface_t *ti;
   int i;
   u16 thread_index = vlib_get_thread_index ();
 
   for (i = 0; i < n_packets; i++)
     {
-      struct iovec * iov;
-      vlib_buffer_t * b;
+      struct iovec *iov;
+      vlib_buffer_t *b;
       uword l;
-      vnet_hw_interface_t * hw;
-      uword * p;
+      vnet_hw_interface_t *hw;
+      uword *p;
       u32 tx_sw_if_index;
 
       b = vlib_get_buffer (vm, buffers[i]);
 
-      tx_sw_if_index = vnet_buffer(b)->sw_if_index[VLIB_TX];
-      if (tx_sw_if_index == (u32)~0)
-        tx_sw_if_index = vnet_buffer(b)->sw_if_index[VLIB_RX];
-        
-      ASSERT(tx_sw_if_index != (u32)~0);
+      tx_sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_TX];
+      if (tx_sw_if_index == (u32) ~ 0)
+	tx_sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
+
+      ASSERT (tx_sw_if_index != (u32) ~ 0);
 
       /* Use the sup intfc to finesse vlan subifs */
       hw = vnet_get_sup_hw_interface (tm->vnet_main, tx_sw_if_index);
       tx_sw_if_index = hw->sw_if_index;
 
-      p = hash_get (tm->tapcli_interface_index_by_sw_if_index, 
-                    tx_sw_if_index);
+      p = hash_get (tm->tapcli_interface_index_by_sw_if_index,
+		    tx_sw_if_index);
       if (p == 0)
-        {
-          clib_warning ("sw_if_index %d unknown", tx_sw_if_index);
-          /* $$$ leak, but this should never happen... */
-          continue;
-        }
+	{
+	  clib_warning ("sw_if_index %d unknown", tx_sw_if_index);
+	  /* $$$ leak, but this should never happen... */
+	  continue;
+	}
       else
-        ti = vec_elt_at_index (tm->tapcli_interfaces, p[0]);
+	ti = vec_elt_at_index (tm->tapcli_interfaces, p[0]);
 
       /* Re-set iovecs if present. */
       if (tm->threads[thread_index].iovecs)
@@ -219,15 +220,17 @@
 
       if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NEXT_PRESENT))
 	{
-	  do {
-	    b = vlib_get_buffer (vm, b->next_buffer);
+	  do
+	    {
+	      b = vlib_get_buffer (vm, b->next_buffer);
 
-	    vec_add2 (tm->threads[thread_index].iovecs, iov, 1);
+	      vec_add2 (tm->threads[thread_index].iovecs, iov, 1);
 
-	    iov->iov_base = b->data + b->current_data;
-	    iov->iov_len = b->current_length;
-	    l += b->current_length;
-	  } while (b->flags & VLIB_BUFFER_NEXT_PRESENT);
+	      iov->iov_base = b->data + b->current_data;
+	      iov->iov_len = b->current_length;
+	      l += b->current_length;
+	    }
+	  while (b->flags & VLIB_BUFFER_NEXT_PRESENT);
 	}
 
       if (writev (ti->unix_fd, tm->threads[thread_index].iovecs,
@@ -235,17 +238,19 @@
 	clib_unix_warning ("writev");
     }
 
-  vlib_buffer_free(vm, vlib_frame_vector_args(frame), frame->n_vectors);
+  vlib_buffer_free (vm, vlib_frame_vector_args (frame), frame->n_vectors);
 
   return n_packets;
 }
 
+/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (tapcli_tx_node,static) = {
   .function = tapcli_tx,
   .name = "tapcli-tx",
   .type = VLIB_NODE_TYPE_INTERNAL,
   .vector_size = 4,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Dispatch tapcli RX node function for node tap_cli_rx
@@ -258,141 +263,164 @@
  * @return n_packets - uword
  *
  */
-static uword tapcli_rx_iface(vlib_main_t * vm,
-                            vlib_node_runtime_t * node,
-                            tapcli_interface_t * ti)
+static uword
+tapcli_rx_iface (vlib_main_t * vm,
+		 vlib_node_runtime_t * node, tapcli_interface_t * ti)
 {
-  tapcli_main_t * tm = &tapcli_main;
+  tapcli_main_t *tm = &tapcli_main;
   const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
   u32 n_trace = vlib_get_trace_count (vm, node);
   u8 set_trace = 0;
   u16 thread_index = vlib_get_thread_index ();
   vnet_main_t *vnm;
-  vnet_sw_interface_t * si;
+  vnet_sw_interface_t *si;
   u8 admin_down;
   u32 next = node->cached_next_index;
   u32 n_left_to_next, next_index;
   u32 *to_next;
 
-  vnm = vnet_get_main();
+  vnm = vnet_get_main ();
   si = vnet_get_sw_interface (vnm, ti->sw_if_index);
   admin_down = !(si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP);
 
-  vlib_get_next_frame(vm, node, next, to_next, n_left_to_next);
+  vlib_get_next_frame (vm, node, next, to_next, n_left_to_next);
 
-  while (n_left_to_next) { // Fill at most one vector
-    vlib_buffer_t *b_first, *b, *prev;
-    u32 bi_first, bi;
-    word n_bytes_in_packet;
-    int j, n_bytes_left;
+  while (n_left_to_next)
+    {				// Fill at most one vector
+      vlib_buffer_t *b_first, *b, *prev;
+      u32 bi_first, bi;
+      word n_bytes_in_packet;
+      int j, n_bytes_left;
 
-    if (PREDICT_FALSE(vec_len(tm->threads[thread_index].rx_buffers) <
-		      tm->mtu_buffers)) {
-      uword len = vec_len(tm->threads[thread_index].rx_buffers);
-      _vec_len(tm->threads[thread_index].rx_buffers) +=
-          vlib_buffer_alloc_from_free_list(vm, &tm->threads[thread_index].rx_buffers[len],
-                            VLIB_FRAME_SIZE - len, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
-      if (PREDICT_FALSE(vec_len(tm->threads[thread_index].rx_buffers) <
-			tm->mtu_buffers)) {
-          vlib_node_increment_counter(vm, tapcli_rx_node.index,
-                                      TAPCLI_ERROR_BUFFER_ALLOC,
-                                      tm->mtu_buffers -
-				      vec_len(tm->threads[thread_index].rx_buffers));
-        break;
-      }
-    }
+      if (PREDICT_FALSE (vec_len (tm->threads[thread_index].rx_buffers) <
+			 tm->mtu_buffers))
+	{
+	  uword len = vec_len (tm->threads[thread_index].rx_buffers);
+	  _vec_len (tm->threads[thread_index].rx_buffers) +=
+	    vlib_buffer_alloc_from_free_list (vm,
+					      &tm->threads[thread_index].
+					      rx_buffers[len],
+					      VLIB_FRAME_SIZE - len,
+					      VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+	  if (PREDICT_FALSE
+	      (vec_len (tm->threads[thread_index].rx_buffers) <
+	       tm->mtu_buffers))
+	    {
+	      vlib_node_increment_counter (vm, tapcli_rx_node.index,
+					   TAPCLI_ERROR_BUFFER_ALLOC,
+					   tm->mtu_buffers -
+					   vec_len (tm->threads
+						    [thread_index].
+						    rx_buffers));
+	      break;
+	    }
+	}
 
-    uword i_rx = vec_len (tm->threads[thread_index].rx_buffers) - 1;
+      uword i_rx = vec_len (tm->threads[thread_index].rx_buffers) - 1;
 
-    /* Allocate RX buffers from end of rx_buffers.
-           Turn them into iovecs to pass to readv. */
-    vec_validate (tm->threads[thread_index].iovecs, tm->mtu_buffers - 1);
-    for (j = 0; j < tm->mtu_buffers; j++) {
-      b = vlib_get_buffer (vm, tm->threads[thread_index].rx_buffers[i_rx - j]);
-      tm->threads[thread_index].iovecs[j].iov_base = b->data;
-      tm->threads[thread_index].iovecs[j].iov_len = buffer_size;
-    }
+      /* Allocate RX buffers from end of rx_buffers.
+         Turn them into iovecs to pass to readv. */
+      vec_validate (tm->threads[thread_index].iovecs, tm->mtu_buffers - 1);
+      for (j = 0; j < tm->mtu_buffers; j++)
+	{
+	  b =
+	    vlib_get_buffer (vm,
+			     tm->threads[thread_index].rx_buffers[i_rx - j]);
+	  tm->threads[thread_index].iovecs[j].iov_base = b->data;
+	  tm->threads[thread_index].iovecs[j].iov_len = buffer_size;
+	}
 
-    n_bytes_left = readv (ti->unix_fd, tm->threads[thread_index].iovecs,
-			  tm->mtu_buffers);
-    n_bytes_in_packet = n_bytes_left;
-    if (n_bytes_left <= 0) {
-      if (errno != EAGAIN) {
-        vlib_node_increment_counter(vm, tapcli_rx_node.index,
-                                    TAPCLI_ERROR_READ, 1);
-      }
-      break;
-    }
-
-    bi_first = tm->threads[thread_index].rx_buffers[i_rx];
-    b = b_first = vlib_get_buffer (vm,
-				   tm->threads[thread_index].rx_buffers[i_rx]);
-    prev = NULL;
-
-    while (1) {
-      b->current_length = n_bytes_left < buffer_size ? n_bytes_left : buffer_size;
-      n_bytes_left -= buffer_size;
-
-      if (prev) {
-        prev->next_buffer = bi;
-        prev->flags |= VLIB_BUFFER_NEXT_PRESENT;
-      }
-      prev = b;
-
-      /* last segment */
+      n_bytes_left = readv (ti->unix_fd, tm->threads[thread_index].iovecs,
+			    tm->mtu_buffers);
+      n_bytes_in_packet = n_bytes_left;
       if (n_bytes_left <= 0)
-        break;
+	{
+	  if (errno != EAGAIN)
+	    {
+	      vlib_node_increment_counter (vm, tapcli_rx_node.index,
+					   TAPCLI_ERROR_READ, 1);
+	    }
+	  break;
+	}
 
-      i_rx--;
-      bi = tm->threads[thread_index].rx_buffers[i_rx];
-      b = vlib_get_buffer (vm, bi);
+      bi_first = tm->threads[thread_index].rx_buffers[i_rx];
+      b = b_first = vlib_get_buffer (vm,
+				     tm->threads[thread_index].
+				     rx_buffers[i_rx]);
+      prev = NULL;
+
+      while (1)
+	{
+	  b->current_length =
+	    n_bytes_left < buffer_size ? n_bytes_left : buffer_size;
+	  n_bytes_left -= buffer_size;
+
+	  if (prev)
+	    {
+	      prev->next_buffer = bi;
+	      prev->flags |= VLIB_BUFFER_NEXT_PRESENT;
+	    }
+	  prev = b;
+
+	  /* last segment */
+	  if (n_bytes_left <= 0)
+	    break;
+
+	  i_rx--;
+	  bi = tm->threads[thread_index].rx_buffers[i_rx];
+	  b = vlib_get_buffer (vm, bi);
+	}
+
+      _vec_len (tm->threads[thread_index].rx_buffers) = i_rx;
+
+      b_first->total_length_not_including_first_buffer =
+	(n_bytes_in_packet >
+	 buffer_size) ? n_bytes_in_packet - buffer_size : 0;
+      b_first->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
+
+      VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b_first);
+
+      vnet_buffer (b_first)->sw_if_index[VLIB_RX] = ti->sw_if_index;
+      vnet_buffer (b_first)->sw_if_index[VLIB_TX] = (u32) ~ 0;
+
+      b_first->error = node->errors[TAPCLI_ERROR_NONE];
+      next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
+      next_index = (ti->per_interface_next_index != ~0) ?
+	ti->per_interface_next_index : next_index;
+      next_index = admin_down ? VNET_DEVICE_INPUT_NEXT_DROP : next_index;
+
+      to_next[0] = bi_first;
+      to_next++;
+      n_left_to_next--;
+
+      vnet_feature_start_device_input_x1 (ti->sw_if_index, &next_index,
+					  b_first);
+
+      vlib_validate_buffer_enqueue_x1 (vm, node, next,
+				       to_next, n_left_to_next,
+				       bi_first, next_index);
+
+      /* Interface counters for tapcli interface. */
+      if (PREDICT_TRUE (!admin_down))
+	{
+	  vlib_increment_combined_counter (vnet_main.interface_main.
+					   combined_sw_if_counters +
+					   VNET_INTERFACE_COUNTER_RX,
+					   thread_index, ti->sw_if_index, 1,
+					   n_bytes_in_packet);
+
+	  if (PREDICT_FALSE (n_trace > 0))
+	    {
+	      vlib_trace_buffer (vm, node, next_index,
+				 b_first, /* follow_chain */ 1);
+	      n_trace--;
+	      set_trace = 1;
+	      tapcli_rx_trace_t *t0 =
+		vlib_add_trace (vm, node, b_first, sizeof (*t0));
+	      t0->sw_if_index = si->sw_if_index;
+	    }
+	}
     }
-
-    _vec_len (tm->threads[thread_index].rx_buffers) = i_rx;
-
-    b_first->total_length_not_including_first_buffer =
-        (n_bytes_in_packet > buffer_size) ? n_bytes_in_packet - buffer_size : 0;
-    b_first->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
-
-    VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b_first);
-
-    vnet_buffer (b_first)->sw_if_index[VLIB_RX] = ti->sw_if_index;
-    vnet_buffer (b_first)->sw_if_index[VLIB_TX] = (u32)~0;
-
-    b_first->error = node->errors[TAPCLI_ERROR_NONE];
-    next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
-    next_index = (ti->per_interface_next_index != ~0) ?
-        ti->per_interface_next_index : next_index;
-    next_index = admin_down ? VNET_DEVICE_INPUT_NEXT_DROP : next_index;
-
-    to_next[0] = bi_first;
-    to_next++;
-    n_left_to_next--;
-
-    vnet_feature_start_device_input_x1 (ti->sw_if_index, &next_index, b_first);
-
-    vlib_validate_buffer_enqueue_x1 (vm, node, next,
-                                     to_next, n_left_to_next,
-                                     bi_first, next_index);
-
-    /* Interface counters for tapcli interface. */
-    if (PREDICT_TRUE(!admin_down)) {
-      vlib_increment_combined_counter (
-          vnet_main.interface_main.combined_sw_if_counters
-          + VNET_INTERFACE_COUNTER_RX,
-          thread_index, ti->sw_if_index,
-          1, n_bytes_in_packet);
-
-      if (PREDICT_FALSE(n_trace > 0)) {
-        vlib_trace_buffer (vm, node, next_index,
-                           b_first, /* follow_chain */ 1);
-        n_trace--;
-        set_trace = 1;
-        tapcli_rx_trace_t *t0 = vlib_add_trace (vm, node, b_first, sizeof (*t0));
-        t0->sw_if_index = si->sw_if_index;
-      }
-    }
-  }
   vlib_put_next_frame (vm, node, next, n_left_to_next);
   if (set_trace)
     vlib_set_trace_count (vm, node, n_trace);
@@ -413,44 +441,46 @@
  *
  */
 static uword
-tapcli_rx (vlib_main_t * vm,
-	   vlib_node_runtime_t * node,
-	   vlib_frame_t * frame)
+tapcli_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  tapcli_main_t * tm = &tapcli_main;
-  static u32 * ready_interface_indices;
-  tapcli_interface_t * ti;
+  tapcli_main_t *tm = &tapcli_main;
+  static u32 *ready_interface_indices;
+  tapcli_interface_t *ti;
   int i;
   u32 total_count = 0;
 
   vec_reset_length (ready_interface_indices);
+  /* *INDENT-OFF* */
   clib_bitmap_foreach (i, tm->pending_read_bitmap,
   ({
     vec_add1 (ready_interface_indices, i);
   }));
+  /* *INDENT-ON* */
 
   if (vec_len (ready_interface_indices) == 0)
     return 0;
 
-  for (i = 0; i < vec_len(ready_interface_indices); i++)
-  {
-    tm->pending_read_bitmap =
-        clib_bitmap_set (tm->pending_read_bitmap,
-                         ready_interface_indices[i], 0);
+  for (i = 0; i < vec_len (ready_interface_indices); i++)
+    {
+      tm->pending_read_bitmap =
+	clib_bitmap_set (tm->pending_read_bitmap,
+			 ready_interface_indices[i], 0);
 
-    ti = vec_elt_at_index (tm->tapcli_interfaces, ready_interface_indices[i]);
-    total_count += tapcli_rx_iface(vm, node, ti);
-  }
-  return total_count; //This might return more than 256.
+      ti =
+	vec_elt_at_index (tm->tapcli_interfaces, ready_interface_indices[i]);
+      total_count += tapcli_rx_iface (vm, node, ti);
+    }
+  return total_count;		//This might return more than 256.
 }
 
 /** TAPCLI error strings */
-static char * tapcli_rx_error_strings[] = {
+static char *tapcli_rx_error_strings[] = {
 #define _(sym,string) string,
   foreach_tapcli_error
 #undef _
 };
 
+/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (tapcli_rx_node, static) = {
   .function = tapcli_rx,
   .name = "tapcli-rx",
@@ -462,6 +492,7 @@
   .error_strings = tapcli_rx_error_strings,
   .format_trace = format_tapcli_rx_trace,
 };
+/* *INDENT-ON* */
 
 
 /**
@@ -472,11 +503,12 @@
  * @return error - clib_error_t
  *
  */
-static clib_error_t * tapcli_read_ready (clib_file_t * uf)
+static clib_error_t *
+tapcli_read_ready (clib_file_t * uf)
 {
-  vlib_main_t * vm = vlib_get_main();
-  tapcli_main_t * tm = &tapcli_main;
-  uword * p;
+  vlib_main_t *vm = vlib_get_main ();
+  tapcli_main_t *tm = &tapcli_main;
+  uword *p;
 
   /** Schedule the rx node */
   vlib_node_set_interrupt_pending (vm, tapcli_rx_node.index);
@@ -486,7 +518,7 @@
   /** Mark the specific tap interface ready-to-read */
   if (p)
     tm->pending_read_bitmap = clib_bitmap_set (tm->pending_read_bitmap,
-                                               p[0], 1);
+					       p[0], 1);
   else
     clib_warning ("fd %d not in hash table", uf->file_descriptor);
 
@@ -513,16 +545,16 @@
       if (unformat (input, "mtu %d", &tm->mtu_bytes))
 	;
       else if (unformat (input, "disable"))
-        tm->is_disabled = 1;
+	tm->is_disabled = 1;
       else
-          return clib_error_return (0, "unknown input `%U'",
-                                    format_unformat_error, input);
+	return clib_error_return (0, "unknown input `%U'",
+				  format_unformat_error, input);
     }
 
   if (tm->is_disabled)
     return 0;
 
-  if (geteuid())
+  if (geteuid ())
     {
       clib_warning ("tapcli disabled: must be superuser");
       tm->is_disabled = 1;
@@ -543,15 +575,15 @@
  * @return rc - int
  *
  */
-static int tap_name_renumber (vnet_hw_interface_t * hi,
-                              u32 new_dev_instance)
+static int
+tap_name_renumber (vnet_hw_interface_t * hi, u32 new_dev_instance)
 {
   tapcli_main_t *tm = &tapcli_main;
 
   vec_validate_init_empty (tm->show_dev_instance_by_real_dev_instance,
-                           hi->dev_instance, ~0);
+			   hi->dev_instance, ~0);
 
-  tm->show_dev_instance_by_real_dev_instance [hi->dev_instance] =
+  tm->show_dev_instance_by_real_dev_instance[hi->dev_instance] =
     new_dev_instance;
 
   return 0;
@@ -569,19 +601,20 @@
  */
 static void
 tapcli_nopunt_frame (vlib_main_t * vm,
-                   vlib_node_runtime_t * node,
-                   vlib_frame_t * frame)
+		     vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  u32 * buffers = vlib_frame_args (frame);
+  u32 *buffers = vlib_frame_args (frame);
   uword n_packets = frame->n_vectors;
   vlib_buffer_free (vm, buffers, n_packets);
   vlib_frame_free (vm, node, frame);
 }
 
+/* *INDENT-OFF* */
 VNET_HW_INTERFACE_CLASS (tapcli_interface_class,static) = {
   .name = "tapcli",
   .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Formatter for TAPCLI interface name
@@ -592,11 +625,12 @@
  * @return *s - formatted string
  *
  */
-static u8 * format_tapcli_interface_name (u8 * s, va_list * args)
+static u8 *
+format_tapcli_interface_name (u8 * s, va_list * args)
 {
   u32 i = va_arg (*args, u32);
   u32 show_dev_instance = ~0;
-  tapcli_main_t * tm = &tapcli_main;
+  tapcli_main_t *tm = &tapcli_main;
 
   if (i < vec_len (tm->show_dev_instance_by_real_dev_instance))
     show_dev_instance = tm->show_dev_instance_by_real_dev_instance[i];
@@ -618,14 +652,13 @@
  * @return rc - u32
  *
  */
-static u32 tapcli_flag_change (vnet_main_t * vnm,
-                               vnet_hw_interface_t * hw,
-                               u32 flags)
+static u32
+tapcli_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hw, u32 flags)
 {
   tapcli_main_t *tm = &tapcli_main;
   tapcli_interface_t *ti;
 
-   ti = vec_elt_at_index (tm->tapcli_interfaces, hw->dev_instance);
+  ti = vec_elt_at_index (tm->tapcli_interfaces, hw->dev_instance);
 
   if (flags & ETHERNET_INTERFACE_FLAG_MTU)
     {
@@ -633,7 +666,7 @@
       tm->mtu_bytes = hw->max_packet_bytes;
       tm->mtu_buffers = (tm->mtu_bytes + (buffer_size - 1)) / buffer_size;
     }
-   else
+  else
     {
       struct ifreq ifr;
       u32 want_promisc;
@@ -642,27 +675,27 @@
 
       /* get flags, modify to bring up interface... */
       if (ioctl (ti->provision_fd, SIOCGIFFLAGS, &ifr) < 0)
-        {
-          clib_unix_warning ("Couldn't get interface flags for %s", hw->name);
-          return 0;
-        }
+	{
+	  clib_unix_warning ("Couldn't get interface flags for %s", hw->name);
+	  return 0;
+	}
 
       want_promisc = (flags & ETHERNET_INTERFACE_FLAG_ACCEPT_ALL) != 0;
 
       if (want_promisc == ti->is_promisc)
-        return 0;
+	return 0;
 
       if (flags & ETHERNET_INTERFACE_FLAG_ACCEPT_ALL)
-        ifr.ifr_flags |= IFF_PROMISC;
+	ifr.ifr_flags |= IFF_PROMISC;
       else
-        ifr.ifr_flags &= ~(IFF_PROMISC);
+	ifr.ifr_flags &= ~(IFF_PROMISC);
 
       /* get flags, modify to bring up interface... */
       if (ioctl (ti->provision_fd, SIOCSIFFLAGS, &ifr) < 0)
-        {
-          clib_unix_warning ("Couldn't set interface flags for %s", hw->name);
-          return 0;
-        }
+	{
+	  clib_unix_warning ("Couldn't set interface flags for %s", hw->name);
+	  return 0;
+	}
 
       ti->is_promisc = want_promisc;
     }
@@ -678,9 +711,9 @@
  * @param node_index - u32
  *
  */
-static void tapcli_set_interface_next_node (vnet_main_t *vnm,
-                                            u32 hw_if_index,
-                                            u32 node_index)
+static void
+tapcli_set_interface_next_node (vnet_main_t * vnm,
+				u32 hw_if_index, u32 node_index)
 {
   tapcli_main_t *tm = &tapcli_main;
   tapcli_interface_t *ti;
@@ -725,6 +758,7 @@
   return 0;
 }
 
+/* *INDENT-OFF* */
 VNET_DEVICE_CLASS (tapcli_dev_class,static) = {
   .name = "tapcli",
   .tx_function = tapcli_tx,
@@ -733,6 +767,7 @@
   .name_renumber = tap_name_renumber,
   .admin_up_down_function = tapcli_interface_admin_up_down,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Dump TAP interfaces
@@ -742,20 +777,23 @@
  * @return rc - int
  *
  */
-int vnet_tap_dump_ifs (tapcli_interface_details_t **out_tapids)
+int
+vnet_tap_dump_ifs (tapcli_interface_details_t ** out_tapids)
 {
-  tapcli_main_t * tm = &tapcli_main;
-  tapcli_interface_t * ti;
+  tapcli_main_t *tm = &tapcli_main;
+  tapcli_interface_t *ti;
 
-  tapcli_interface_details_t * r_tapids = NULL;
-  tapcli_interface_details_t * tapid = NULL;
+  tapcli_interface_details_t *r_tapids = NULL;
+  tapcli_interface_details_t *tapid = NULL;
 
-  vec_foreach (ti, tm->tapcli_interfaces) {
+  vec_foreach (ti, tm->tapcli_interfaces)
+  {
     if (!ti->active)
-        continue;
-    vec_add2(r_tapids, tapid, 1);
+      continue;
+    vec_add2 (r_tapids, tapid, 1);
     tapid->sw_if_index = ti->sw_if_index;
-    strncpy((char *)tapid->dev_name, ti->ifr.ifr_name, sizeof (ti->ifr.ifr_name)-1);
+    strncpy ((char *) tapid->dev_name, ti->ifr.ifr_name,
+	     sizeof (ti->ifr.ifr_name) - 1);
   }
 
   *out_tapids = r_tapids;
@@ -769,23 +807,26 @@
  * @return interface - tapcli_interface_t
  *
  */
-static tapcli_interface_t *tapcli_get_new_tapif()
+static tapcli_interface_t *
+tapcli_get_new_tapif ()
 {
-  tapcli_main_t * tm = &tapcli_main;
+  tapcli_main_t *tm = &tapcli_main;
   tapcli_interface_t *ti = NULL;
 
-  int inactive_cnt = vec_len(tm->tapcli_inactive_interfaces);
+  int inactive_cnt = vec_len (tm->tapcli_inactive_interfaces);
   // if there are any inactive ifaces
-  if (inactive_cnt > 0) {
-    // take last
-    u32 ti_idx = tm->tapcli_inactive_interfaces[inactive_cnt - 1];
-    if (vec_len(tm->tapcli_interfaces) > ti_idx) {
-      ti = vec_elt_at_index (tm->tapcli_interfaces, ti_idx);
-      clib_warning("reusing tap interface");
+  if (inactive_cnt > 0)
+    {
+      // take last
+      u32 ti_idx = tm->tapcli_inactive_interfaces[inactive_cnt - 1];
+      if (vec_len (tm->tapcli_interfaces) > ti_idx)
+	{
+	  ti = vec_elt_at_index (tm->tapcli_interfaces, ti_idx);
+	  clib_warning ("reusing tap interface");
+	}
+      // "remove" from inactive list
+      _vec_len (tm->tapcli_inactive_interfaces) -= 1;
     }
-    // "remove" from inactive list
-    _vec_len(tm->tapcli_inactive_interfaces) -= 1;
-  }
 
   // ti was not retrieved from inactive ifaces - create new
   if (!ti)
@@ -794,32 +835,33 @@
   return ti;
 }
 
-typedef struct 
+typedef struct
 {
-    ip6_address_t addr;
-    u32 mask_width;
-    unsigned int ifindex;
+  ip6_address_t addr;
+  u32 mask_width;
+  unsigned int ifindex;
 } ip6_ifreq_t;
 
 /**
  * @brief Connect a TAP interface
  *
  * @param vm - vlib_main_t
- * @param ap - vnet_tap_connect_args_t 
+ * @param ap - vnet_tap_connect_args_t
  *
  * @return rc - int
  *
  */
-int vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t *ap)
+int
+vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
 {
-  tapcli_main_t * tm = &tapcli_main;
-  tapcli_interface_t * ti = NULL;
+  tapcli_main_t *tm = &tapcli_main;
+  tapcli_interface_t *ti = NULL;
   struct ifreq ifr;
   int flags;
   int dev_net_tun_fd;
   int dev_tap_fd = -1;
-  clib_error_t * error;
-  u8 hwaddr [6];
+  clib_error_t *error;
+  u8 hwaddr[6];
   int rv = 0;
 
   if (tm->is_disabled)
@@ -833,17 +875,16 @@
     return VNET_API_ERROR_SYSCALL_ERROR_1;
 
   memset (&ifr, 0, sizeof (ifr));
-  strncpy(ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name)-1);
+  strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name) - 1);
   ifr.ifr_flags = flags;
-  if (ioctl (dev_net_tun_fd, TUNSETIFF, (void *)&ifr) < 0)
+  if (ioctl (dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
     {
       rv = VNET_API_ERROR_SYSCALL_ERROR_2;
       goto error;
     }
-    
+
   /* Open a provisioning socket */
-  if ((dev_tap_fd = socket(PF_PACKET, SOCK_RAW,
-                           htons(ETH_P_ALL))) < 0 )
+  if ((dev_tap_fd = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0)
     {
       rv = VNET_API_ERROR_SYSCALL_ERROR_3;
       goto error;
@@ -854,24 +895,25 @@
     struct ifreq ifr;
     struct sockaddr_ll sll;
 
-    memset (&ifr, 0, sizeof(ifr));
-    strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name)-1);
-    if (ioctl (dev_tap_fd, SIOCGIFINDEX, &ifr) < 0 )
+    memset (&ifr, 0, sizeof (ifr));
+    strncpy (ifr.ifr_name, (char *) ap->intfc_name,
+	     sizeof (ifr.ifr_name) - 1);
+    if (ioctl (dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
       {
-        rv = VNET_API_ERROR_SYSCALL_ERROR_4;
-        goto error;
+	rv = VNET_API_ERROR_SYSCALL_ERROR_4;
+	goto error;
       }
 
     /* Bind the provisioning socket to the interface. */
-    memset(&sll, 0, sizeof(sll));
-    sll.sll_family   = AF_PACKET;
-    sll.sll_ifindex  = ifr.ifr_ifindex;
-    sll.sll_protocol = htons(ETH_P_ALL);
+    memset (&sll, 0, sizeof (sll));
+    sll.sll_family = AF_PACKET;
+    sll.sll_ifindex = ifr.ifr_ifindex;
+    sll.sll_protocol = htons (ETH_P_ALL);
 
-    if (bind(dev_tap_fd, (struct sockaddr*) &sll, sizeof(sll)) < 0)
+    if (bind (dev_tap_fd, (struct sockaddr *) &sll, sizeof (sll)) < 0)
       {
-        rv = VNET_API_ERROR_SYSCALL_ERROR_5;
-        goto error;
+	rv = VNET_API_ERROR_SYSCALL_ERROR_5;
+	goto error;
       }
   }
 
@@ -880,7 +922,7 @@
     int one = 1;
     if (ioctl (dev_net_tun_fd, FIONBIO, &one) < 0)
       {
-        rv = VNET_API_ERROR_SYSCALL_ERROR_6;
+	rv = VNET_API_ERROR_SYSCALL_ERROR_6;
 	goto error;
       }
   }
@@ -912,35 +954,35 @@
       /* ip4: mask defaults to /24 */
       u32 mask = clib_host_to_net_u32 (0xFFFFFF00);
 
-      memset(&sin, 0, sizeof(sin));
+      memset (&sin, 0, sizeof (sin));
       sin.sin_family = AF_INET;
       /* sin.sin_port = 0; */
       sin.sin_addr.s_addr = ap->ip4_address->as_u32;
       memcpy (&ifr.ifr_ifru.ifru_addr, &sin, sizeof (sin));
 
       if (ioctl (dev_tap_fd, SIOCSIFADDR, &ifr) < 0)
-        {
-          rv = VNET_API_ERROR_SYSCALL_ERROR_10;
-          goto error;
-        }
+	{
+	  rv = VNET_API_ERROR_SYSCALL_ERROR_10;
+	  goto error;
+	}
 
       if (ap->ip4_mask_width > 0 && ap->ip4_mask_width < 33)
-        {
-          mask = ~0;
-          mask <<= (32 - ap->ip4_mask_width);
-        }
+	{
+	  mask = ~0;
+	  mask <<= (32 - ap->ip4_mask_width);
+	}
 
-      mask = clib_host_to_net_u32(mask);
+      mask = clib_host_to_net_u32 (mask);
       sin.sin_family = AF_INET;
       sin.sin_port = 0;
       sin.sin_addr.s_addr = mask;
       memcpy (&ifr.ifr_ifru.ifru_addr, &sin, sizeof (sin));
 
       if (ioctl (dev_tap_fd, SIOCSIFNETMASK, &ifr) < 0)
-        {
-          rv = VNET_API_ERROR_SYSCALL_ERROR_10;
-          goto error;
-        }
+	{
+	  rv = VNET_API_ERROR_SYSCALL_ERROR_10;
+	  goto error;
+	}
     }
 
   if (ap->ip6_address_set)
@@ -949,61 +991,60 @@
       ip6_ifreq_t ifr6;
       int sockfd6;
 
-      sockfd6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP);
+      sockfd6 = socket (AF_INET6, SOCK_DGRAM, IPPROTO_IP);
       if (sockfd6 < 0)
-        {
-          rv = VNET_API_ERROR_SYSCALL_ERROR_10;
-          goto error;
-        }
+	{
+	  rv = VNET_API_ERROR_SYSCALL_ERROR_10;
+	  goto error;
+	}
 
-      memset (&ifr2, 0, sizeof(ifr));
-      strncpy (ifr2.ifr_name, (char *) ap->intfc_name, 
-               sizeof (ifr2.ifr_name)-1);
-      if (ioctl (sockfd6, SIOCGIFINDEX, &ifr2) < 0 )
-        {
-          close (sockfd6);
-          rv = VNET_API_ERROR_SYSCALL_ERROR_4;
-          goto error;
-        }
-      
+      memset (&ifr2, 0, sizeof (ifr));
+      strncpy (ifr2.ifr_name, (char *) ap->intfc_name,
+	       sizeof (ifr2.ifr_name) - 1);
+      if (ioctl (sockfd6, SIOCGIFINDEX, &ifr2) < 0)
+	{
+	  close (sockfd6);
+	  rv = VNET_API_ERROR_SYSCALL_ERROR_4;
+	  goto error;
+	}
+
       memcpy (&ifr6.addr, ap->ip6_address, sizeof (ip6_address_t));
       ifr6.mask_width = ap->ip6_mask_width;
       ifr6.ifindex = ifr2.ifr_ifindex;
-      
+
       if (ioctl (sockfd6, SIOCSIFADDR, &ifr6) < 0)
-        {
-          close (sockfd6);
-          clib_unix_warning ("ifr6");
-          rv = VNET_API_ERROR_SYSCALL_ERROR_10;
-          goto error;
-        }
+	{
+	  close (sockfd6);
+	  clib_unix_warning ("ifr6");
+	  rv = VNET_API_ERROR_SYSCALL_ERROR_10;
+	  goto error;
+	}
       close (sockfd6);
     }
 
-  ti = tapcli_get_new_tapif();
+  ti = tapcli_get_new_tapif ();
   ti->per_interface_next_index = ~0;
 
   if (ap->hwaddr_arg != 0)
-    clib_memcpy(hwaddr, ap->hwaddr_arg, 6);
+    clib_memcpy (hwaddr, ap->hwaddr_arg, 6);
   else
     {
-      f64 now = vlib_time_now(vm);
+      f64 now = vlib_time_now (vm);
       u32 rnd;
       rnd = (u32) (now * 1e6);
       rnd = random_u32 (&rnd);
 
-      memcpy (hwaddr+2, &rnd, sizeof(rnd));
+      memcpy (hwaddr + 2, &rnd, sizeof (rnd));
       hwaddr[0] = 2;
       hwaddr[1] = 0xfe;
     }
 
   error = ethernet_register_interface
-        (tm->vnet_main,
-         tapcli_dev_class.index,
-         ti - tm->tapcli_interfaces /* device instance */,
-         hwaddr /* ethernet address */,
-         &ti->hw_if_index, 
-         tapcli_flag_change);
+    (tm->vnet_main,
+     tapcli_dev_class.index,
+     ti - tm->tapcli_interfaces /* device instance */ ,
+     hwaddr /* ethernet address */ ,
+     &ti->hw_if_index, tapcli_flag_change);
 
   if (error)
     {
@@ -1013,7 +1054,7 @@
     }
 
   {
-    clib_file_t template = {0};
+    clib_file_t template = { 0 };
     template.read_function = tapcli_read_ready;
     template.file_descriptor = dev_net_tun_fd;
     ti->clib_file_index = clib_file_add (&file_main, &template);
@@ -1021,32 +1062,33 @@
     ti->provision_fd = dev_tap_fd;
     clib_memcpy (&ti->ifr, &ifr, sizeof (ifr));
   }
-  
+
   {
-    vnet_hw_interface_t * hw;
+    vnet_hw_interface_t *hw;
     hw = vnet_get_hw_interface (tm->vnet_main, ti->hw_if_index);
     hw->min_supported_packet_bytes = TAP_MTU_MIN;
     hw->max_supported_packet_bytes = TAP_MTU_MAX;
-    hw->max_l3_packet_bytes[VLIB_RX] = hw->max_l3_packet_bytes[VLIB_TX] = hw->max_supported_packet_bytes - sizeof(ethernet_header_t);
+    hw->max_l3_packet_bytes[VLIB_RX] = hw->max_l3_packet_bytes[VLIB_TX] =
+      hw->max_supported_packet_bytes - sizeof (ethernet_header_t);
     ti->sw_if_index = hw->sw_if_index;
     if (ap->sw_if_indexp)
       *(ap->sw_if_indexp) = hw->sw_if_index;
   }
 
   ti->active = 1;
-  
+
   hash_set (tm->tapcli_interface_index_by_sw_if_index, ti->sw_if_index,
-            ti - tm->tapcli_interfaces);
-  
+	    ti - tm->tapcli_interfaces);
+
   hash_set (tm->tapcli_interface_index_by_unix_fd, ti->unix_fd,
-            ti - tm->tapcli_interfaces);
-  
+	    ti - tm->tapcli_interfaces);
+
   return rv;
 
- error:
+error:
   close (dev_net_tun_fd);
   if (dev_tap_fd >= 0)
-      close (dev_tap_fd);
+    close (dev_tap_fd);
 
   return rv;
 }
@@ -1064,13 +1106,14 @@
  * @return rc - int
  *
  */
-int vnet_tap_connect_renumber (vlib_main_t * vm, 
-                               vnet_tap_connect_args_t *ap)
+int
+vnet_tap_connect_renumber (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
 {
-  int rv = vnet_tap_connect(vm, ap);
+  int rv = vnet_tap_connect (vm, ap);
 
   if (!rv && ap->renumber)
-    vnet_interface_name_renumber (*(ap->sw_if_indexp), ap->custom_dev_instance);
+    vnet_interface_name_renumber (*(ap->sw_if_indexp),
+				  ap->custom_dev_instance);
 
   return rv;
 }
@@ -1083,26 +1126,28 @@
  * @return rc - int
  *
  */
-static int tapcli_tap_disconnect (tapcli_interface_t *ti)
+static int
+tapcli_tap_disconnect (tapcli_interface_t * ti)
 {
   int rv = 0;
-  vnet_main_t * vnm = vnet_get_main();
-  tapcli_main_t * tm = &tapcli_main;
+  vnet_main_t *vnm = vnet_get_main ();
+  tapcli_main_t *tm = &tapcli_main;
   u32 sw_if_index = ti->sw_if_index;
 
   // bring interface down
   vnet_sw_interface_set_flags (vnm, sw_if_index, 0);
 
-  if (ti->clib_file_index != ~0) {
-    clib_file_del (&file_main, file_main.file_pool + ti->clib_file_index);
-    ti->clib_file_index = ~0;
-  }
+  if (ti->clib_file_index != ~0)
+    {
+      clib_file_del (&file_main, file_main.file_pool + ti->clib_file_index);
+      ti->clib_file_index = ~0;
+    }
   else
-    close(ti->unix_fd);
+    close (ti->unix_fd);
 
   hash_unset (tm->tapcli_interface_index_by_unix_fd, ti->unix_fd);
   hash_unset (tm->tapcli_interface_index_by_sw_if_index, ti->sw_if_index);
-  close(ti->provision_fd);
+  close (ti->provision_fd);
   ti->unix_fd = -1;
   ti->provision_fd = -1;
 
@@ -1118,26 +1163,27 @@
  * @return rc - int
  *
  */
-int vnet_tap_delete(vlib_main_t *vm, u32 sw_if_index)
+int
+vnet_tap_delete (vlib_main_t * vm, u32 sw_if_index)
 {
   int rv = 0;
-  tapcli_main_t * tm = &tapcli_main;
+  tapcli_main_t *tm = &tapcli_main;
   tapcli_interface_t *ti;
   uword *p = NULL;
 
-  p = hash_get (tm->tapcli_interface_index_by_sw_if_index,
-                sw_if_index);
-  if (p == 0) {
-    clib_warning ("sw_if_index %d unknown", sw_if_index);
-    return VNET_API_ERROR_INVALID_SW_IF_INDEX;
-  }
+  p = hash_get (tm->tapcli_interface_index_by_sw_if_index, sw_if_index);
+  if (p == 0)
+    {
+      clib_warning ("sw_if_index %d unknown", sw_if_index);
+      return VNET_API_ERROR_INVALID_SW_IF_INDEX;
+    }
   ti = vec_elt_at_index (tm->tapcli_interfaces, p[0]);
 
   // inactive
   ti->active = 0;
-  tapcli_tap_disconnect(ti);
+  tapcli_tap_disconnect (ti);
   // add to inactive list
-  vec_add1(tm->tapcli_inactive_interfaces, ti - tm->tapcli_interfaces);
+  vec_add1 (tm->tapcli_inactive_interfaces, ti - tm->tapcli_interfaces);
 
   // reset renumbered iface
   if (p[0] < vec_len (tm->show_dev_instance_by_real_dev_instance))
@@ -1159,10 +1205,9 @@
  */
 static clib_error_t *
 tap_delete_command_fn (vlib_main_t * vm,
-		 unformat_input_t * input,
-		 vlib_cli_command_t * cmd)
+		       unformat_input_t * input, vlib_cli_command_t * cmd)
 {
-  tapcli_main_t * tm = &tapcli_main;
+  tapcli_main_t *tm = &tapcli_main;
   u32 sw_if_index = ~0;
 
   if (tm->is_disabled)
@@ -1171,29 +1216,35 @@
     }
 
   if (unformat (input, "%U", unformat_vnet_sw_interface, tm->vnet_main,
-                &sw_if_index))
-      ;
+		&sw_if_index))
+    ;
   else
     return clib_error_return (0, "unknown input `%U'",
-                              format_unformat_error, input);
+			      format_unformat_error, input);
 
 
   int rc = vnet_tap_delete (vm, sw_if_index);
 
-  if (!rc) {
-    vlib_cli_output (vm, "Deleted.");
-  } else {
-    vlib_cli_output (vm, "Error during deletion of tap interface. (rc: %d)", rc);
-  }
+  if (!rc)
+    {
+      vlib_cli_output (vm, "Deleted.");
+    }
+  else
+    {
+      vlib_cli_output (vm, "Error during deletion of tap interface. (rc: %d)",
+		       rc);
+    }
 
   return 0;
 }
 
+/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_delete_command, static) = {
     .path = "tap delete",
     .short_help = "tap delete <vpp-tap-intfc-name>",
     .function = tap_delete_command_fn,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Modifies tap interface - can result in new interface being created
@@ -1209,16 +1260,17 @@
  * @return rc - int
  *
  */
-int vnet_tap_modify (vlib_main_t * vm, vnet_tap_connect_args_t *ap)
+int
+vnet_tap_modify (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
 {
-    int rv = vnet_tap_delete (vm, ap->orig_sw_if_index);
+  int rv = vnet_tap_delete (vm, ap->orig_sw_if_index);
 
-    if (rv)
-      return rv;
-
-    rv = vnet_tap_connect_renumber(vm, ap);
-
+  if (rv)
     return rv;
+
+  rv = vnet_tap_connect_renumber (vm, ap);
+
+  return rv;
 }
 
 /**
@@ -1233,16 +1285,15 @@
  */
 static clib_error_t *
 tap_modify_command_fn (vlib_main_t * vm,
-		 unformat_input_t * input,
-		 vlib_cli_command_t * cmd)
+		       unformat_input_t * input, vlib_cli_command_t * cmd)
 {
-  u8 * intfc_name;
-  tapcli_main_t * tm = &tapcli_main;
+  u8 *intfc_name;
+  tapcli_main_t *tm = &tapcli_main;
   u32 sw_if_index = ~0;
   u32 new_sw_if_index = ~0;
   int user_hwaddr = 0;
   u8 hwaddr[6];
-  vnet_tap_connect_args_t _a, *ap= &_a;
+  vnet_tap_connect_args_t _a, *ap = &_a;
 
   if (tm->is_disabled)
     {
@@ -1250,24 +1301,23 @@
     }
 
   if (unformat (input, "%U", unformat_vnet_sw_interface, tm->vnet_main,
-                &sw_if_index))
-      ;
+		&sw_if_index))
+    ;
   else
     return clib_error_return (0, "unknown input `%U'",
-                              format_unformat_error, input);
+			      format_unformat_error, input);
 
   if (unformat (input, "%s", &intfc_name))
     ;
   else
     return clib_error_return (0, "unknown input `%U'",
-                              format_unformat_error, input);
+			      format_unformat_error, input);
 
-  if (unformat(input, "hwaddr %U", unformat_ethernet_address,
-               &hwaddr))
+  if (unformat (input, "hwaddr %U", unformat_ethernet_address, &hwaddr))
     user_hwaddr = 1;
 
 
-  memset (ap, 0, sizeof(*ap));
+  memset (ap, 0, sizeof (*ap));
   ap->orig_sw_if_index = sw_if_index;
   ap->intfc_name = intfc_name;
   ap->sw_if_indexp = &new_sw_if_index;
@@ -1276,22 +1326,29 @@
 
   int rc = vnet_tap_modify (vm, ap);
 
-  if (!rc) {
-    vlib_cli_output (vm, "Modified %U for Linux tap '%s'",
-                   format_vnet_sw_if_index_name, tm->vnet_main, 
-                     *(ap->sw_if_indexp), ap->intfc_name);
-  } else {
-    vlib_cli_output (vm, "Error during modification of tap interface. (rc: %d)", rc);
-  }
+  if (!rc)
+    {
+      vlib_cli_output (vm, "Modified %U for Linux tap '%s'",
+		       format_vnet_sw_if_index_name, tm->vnet_main,
+		       *(ap->sw_if_indexp), ap->intfc_name);
+    }
+  else
+    {
+      vlib_cli_output (vm,
+		       "Error during modification of tap interface. (rc: %d)",
+		       rc);
+    }
 
   return 0;
 }
 
+/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_modify_command, static) = {
     .path = "tap modify",
     .short_help = "tap modify <vpp-tap-intfc-name> <linux-intfc-name> [hwaddr <addr>]",
     .function = tap_modify_command_fn,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief CLI function to connect TAP interface
@@ -1305,13 +1362,12 @@
  */
 static clib_error_t *
 tap_connect_command_fn (vlib_main_t * vm,
-		 unformat_input_t * input,
-		 vlib_cli_command_t * cmd)
+			unformat_input_t * input, vlib_cli_command_t * cmd)
 {
-  u8 * intfc_name = 0;
+  u8 *intfc_name = 0;
   unformat_input_t _line_input, *line_input = &_line_input;
-  vnet_tap_connect_args_t _a, *ap= &_a;
-  tapcli_main_t * tm = &tapcli_main;
+  vnet_tap_connect_args_t _a, *ap = &_a;
+  tapcli_main_t *tm = &tapcli_main;
   u8 hwaddr[6];
   u8 *hwaddr_arg = 0;
   u32 sw_if_index;
@@ -1331,32 +1387,32 @@
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat(line_input, "hwaddr %U", unformat_ethernet_address,
-                   &hwaddr))
-        hwaddr_arg = hwaddr;
-      
+      if (unformat (line_input, "hwaddr %U", unformat_ethernet_address,
+		    &hwaddr))
+	hwaddr_arg = hwaddr;
+
       /* It is here for backward compatibility */
-      else if (unformat(line_input, "hwaddr random"))
-        ;
-      
+      else if (unformat (line_input, "hwaddr random"))
+	;
+
       else if (unformat (line_input, "address %U/%d",
-                         unformat_ip4_address, &ip4_address, &ip4_mask_width))
-        ip4_address_set = 1;
-      
+			 unformat_ip4_address, &ip4_address, &ip4_mask_width))
+	ip4_address_set = 1;
+
       else if (unformat (line_input, "address %U/%d",
-                         unformat_ip6_address, &ip6_address, &ip6_mask_width))
-        ip6_address_set = 1;
-      
+			 unformat_ip6_address, &ip6_address, &ip6_mask_width))
+	ip6_address_set = 1;
+
       else if (unformat (line_input, "%s", &intfc_name))
-        ;
+	;
       else
-        {
-          error = clib_error_return (0, "unknown input `%U'",
-                                     format_unformat_error, line_input);
-          goto done;
-        }
+	{
+	  error = clib_error_return (0, "unknown input `%U'",
+				     format_unformat_error, line_input);
+	  goto done;
+	}
     }
-  
+
   if (intfc_name == 0)
     {
       error = clib_error_return (0, "interface name must be specified");
@@ -1382,64 +1438,65 @@
 
   ap->sw_if_indexp = &sw_if_index;
 
-  int rv = vnet_tap_connect(vm, ap);
+  int rv = vnet_tap_connect (vm, ap);
 
-  switch (rv) 
+  switch (rv)
     {
     case VNET_API_ERROR_SYSCALL_ERROR_1:
       error = clib_error_return (0, "Couldn't open /dev/net/tun");
       goto done;
-      
+
     case VNET_API_ERROR_SYSCALL_ERROR_2:
-      error = clib_error_return (0, "Error setting flags on '%s'", intfc_name);
+      error =
+	clib_error_return (0, "Error setting flags on '%s'", intfc_name);
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_3:
-      error = clib_error_return (0,  "Couldn't open provisioning socket");
+      error = clib_error_return (0, "Couldn't open provisioning socket");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_4:
-      error = clib_error_return (0,  "Couldn't get if_index");
+      error = clib_error_return (0, "Couldn't get if_index");
       goto done;
-    
+
     case VNET_API_ERROR_SYSCALL_ERROR_5:
-      error = clib_error_return (0,  "Couldn't bind provisioning socket");
+      error = clib_error_return (0, "Couldn't bind provisioning socket");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_6:
-      error = clib_error_return (0,  "Couldn't set device non-blocking flag");
+      error = clib_error_return (0, "Couldn't set device non-blocking flag");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_7:
-      error = clib_error_return (0,  "Couldn't set device MTU");
+      error = clib_error_return (0, "Couldn't set device MTU");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_8:
-      error = clib_error_return (0,  "Couldn't get interface flags");
+      error = clib_error_return (0, "Couldn't get interface flags");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_9:
-      error = clib_error_return (0,  "Couldn't set intfc admin state up");
+      error = clib_error_return (0, "Couldn't set intfc admin state up");
       goto done;
 
     case VNET_API_ERROR_SYSCALL_ERROR_10:
-      error = clib_error_return (0,  "Couldn't set intfc address/mask");
+      error = clib_error_return (0, "Couldn't set intfc address/mask");
       goto done;
 
     case VNET_API_ERROR_INVALID_REGISTRATION:
-      error = clib_error_return (0,  "Invalid registration");
+      error = clib_error_return (0, "Invalid registration");
       goto done;
 
     case 0:
       break;
 
     default:
-      error = clib_error_return (0,  "Unknown error: %d", rv);
+      error = clib_error_return (0, "Unknown error: %d", rv);
       goto done;
     }
 
-  vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, 
-                  vnet_get_main(), sw_if_index);
+  vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name,
+		   vnet_get_main (), sw_if_index);
 
 done:
   unformat_free (line_input);
@@ -1447,12 +1504,14 @@
   return error;
 }
 
+/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (tap_connect_command, static) = {
     .path = "tap connect",
     .short_help =
-	"tap connect <intfc-name> [address <ip-addr>/mw] [hwaddr <addr>]",
+        "tap connect <intfc-name> [address <ip-addr>/mw] [hwaddr <addr>]",
     .function = tap_connect_command_fn,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief TAPCLI main init
@@ -1465,27 +1524,35 @@
 clib_error_t *
 tapcli_init (vlib_main_t * vm)
 {
-  tapcli_main_t * tm = &tapcli_main;
-  vlib_thread_main_t * m = vlib_get_thread_main ();
-  tapcli_per_thread_t * thread;
+  tapcli_main_t *tm = &tapcli_main;
+  vlib_thread_main_t *m = vlib_get_thread_main ();
+  tapcli_per_thread_t *thread;
 
   tm->vlib_main = vm;
-  tm->vnet_main = vnet_get_main();
+  tm->vnet_main = vnet_get_main ();
   tm->mtu_bytes = TAP_MTU_DEFAULT;
-  tm->tapcli_interface_index_by_sw_if_index = hash_create (0, sizeof(uword));
+  tm->tapcli_interface_index_by_sw_if_index = hash_create (0, sizeof (uword));
   tm->tapcli_interface_index_by_unix_fd = hash_create (0, sizeof (uword));
   vm->os_punt_frame = tapcli_nopunt_frame;
   vec_validate_aligned (tm->threads, m->n_vlib_mains - 1,
 			CLIB_CACHE_LINE_BYTES);
   vec_foreach (thread, tm->threads)
-    {
-      thread->iovecs = 0;
-      thread->rx_buffers = 0;
-      vec_alloc(thread->rx_buffers, VLIB_FRAME_SIZE);
-      vec_reset_length(thread->rx_buffers);
-    }
+  {
+    thread->iovecs = 0;
+    thread->rx_buffers = 0;
+    vec_alloc (thread->rx_buffers, VLIB_FRAME_SIZE);
+    vec_reset_length (thread->rx_buffers);
+  }
 
   return 0;
 }
 
 VLIB_INIT_FUNCTION (tapcli_init);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/tapcli.h b/src/vnet/unix/tapcli.h
index fcd82db..55a5a15 100644
--- a/src/vnet/unix/tapcli.h
+++ b/src/vnet/unix/tapcli.h
@@ -30,23 +30,33 @@
  _(BUFFER_ALLOC, "buffer allocation error")             \
  _(UNKNOWN, "unknown error")
 
-typedef enum {
+typedef enum
+{
 #define _(sym,str) TAPCLI_ERROR_##sym,
   foreach_tapcli_error
 #undef _
-   TAPCLI_N_ERROR,
- } tapcli_error_t;
+    TAPCLI_N_ERROR,
+} tapcli_error_t;
 
 /** TAP CLI interface details struct */
-typedef struct {
+typedef struct
+{
   u32 sw_if_index;
   u8 dev_name[64];
 } tapcli_interface_details_t;
 
-int vnet_tap_dump_ifs (tapcli_interface_details_t **out_tapids);
+int vnet_tap_dump_ifs (tapcli_interface_details_t ** out_tapids);
 
 #define TAP_MTU_MIN 68
 #define TAP_MTU_MAX 65535
 #define TAP_MTU_DEFAULT 1500
 
 #endif /* __included_tapcli_h__ */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 6e2a53f..5d785ac 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -1,4 +1,4 @@
-/* 
+/*
  *------------------------------------------------------------------
  * tuntap.c - kernel stack (reverse) punt/inject path
  *
@@ -55,13 +55,14 @@
 static vnet_hw_interface_class_t tuntap_interface_class;
 
 static void tuntap_punt_frame (vlib_main_t * vm,
-                               vlib_node_runtime_t * node,
-                               vlib_frame_t * frame);
+			       vlib_node_runtime_t * node,
+			       vlib_frame_t * frame);
 static void tuntap_nopunt_frame (vlib_main_t * vm,
-                                 vlib_node_runtime_t * node,
-                                 vlib_frame_t * frame);
+				 vlib_node_runtime_t * node,
+				 vlib_frame_t * frame);
 
-typedef struct {
+typedef struct
+{
   u32 sw_if_index;
   u8 is_v6;
   u8 addr[16];
@@ -74,18 +75,19 @@
 {
   /** Vector of VLIB rx buffers to use.  We allocate them in blocks
      of VLIB_FRAME_SIZE (256). */
-  u32 * rx_buffers;
+  u32 *rx_buffers;
 
   /** Vector of iovecs for readv/writev calls. */
-  struct iovec * iovecs;  
+  struct iovec *iovecs;
 } tuntap_per_thread_t;
 
 /**
  * @brief TUNTAP node main state
  */
-typedef struct {
+typedef struct
+{
   /** per thread variables */
-  tuntap_per_thread_t * threads;
+  tuntap_per_thread_t *threads;
 
   /** File descriptors for /dev/net/tun and provisioning socket. */
   int dev_net_tun_fd, dev_tap_fd;
@@ -104,7 +106,7 @@
   u32 mtu_bytes, mtu_buffers;
 
   /** Linux interface name for tun device. */
-  char * tun_name;
+  char *tun_name;
 
   /** Pool of subinterface addresses */
   subif_address_t *subifs;
@@ -142,13 +144,11 @@
  *
  */
 static uword
-tuntap_tx (vlib_main_t * vm,
-	   vlib_node_runtime_t * node,
-	   vlib_frame_t * frame)
+tuntap_tx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  u32 * buffers = vlib_frame_args (frame);
+  u32 *buffers = vlib_frame_args (frame);
   uword n_packets = frame->n_vectors;
-  tuntap_main_t * tm = &tuntap_main;
+  tuntap_main_t *tm = &tuntap_main;
   vnet_main_t *vnm = vnet_get_main ();
   vnet_interface_main_t *im = &vnm->interface_main;
   u32 n_bytes = 0;
@@ -157,17 +157,17 @@
 
   for (i = 0; i < n_packets; i++)
     {
-      struct iovec * iov;
-      vlib_buffer_t * b;
+      struct iovec *iov;
+      vlib_buffer_t *b;
       uword l;
 
       b = vlib_get_buffer (vm, buffers[i]);
 
       if (tm->is_ether && (!tm->have_normal_interface))
-        {
-          vlib_buffer_reset(b);
-          clib_memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6);
-        }
+	{
+	  vlib_buffer_reset (b);
+	  clib_memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6);
+	}
 
       /* Re-set iovecs if present. */
       if (tm->threads[thread_index].iovecs)
@@ -180,15 +180,17 @@
 
       if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NEXT_PRESENT))
 	{
-	  do {
-	    b = vlib_get_buffer (vm, b->next_buffer);
+	  do
+	    {
+	      b = vlib_get_buffer (vm, b->next_buffer);
 
-	    vec_add2 (tm->threads[thread_index].iovecs, iov, 1);
+	      vec_add2 (tm->threads[thread_index].iovecs, iov, 1);
 
-	    iov->iov_base = b->data + b->current_data;
-	    iov->iov_len = b->current_length;
-	    l += b->current_length;
-	  } while (b->flags & VLIB_BUFFER_NEXT_PRESENT);
+	      iov->iov_base = b->data + b->current_data;
+	      iov->iov_len = b->current_length;
+	      l += b->current_length;
+	    }
+	  while (b->flags & VLIB_BUFFER_NEXT_PRESENT);
 	}
 
       if (writev (tm->dev_net_tun_fd, tm->threads[thread_index].iovecs,
@@ -214,12 +216,14 @@
   return n_packets;
 }
 
+/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (tuntap_tx_node,static) = {
   .function = tuntap_tx,
   .name = "tuntap-tx",
   .type = VLIB_NODE_TYPE_INTERNAL,
   .vector_size = 4,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief TUNTAP receive node
@@ -233,12 +237,10 @@
  *
  */
 static uword
-tuntap_rx (vlib_main_t * vm,
-	   vlib_node_runtime_t * node,
-	   vlib_frame_t * frame)
+tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  tuntap_main_t * tm = &tuntap_main;
-  vlib_buffer_t * b;
+  tuntap_main_t *tm = &tuntap_main;
+  vlib_buffer_t *b;
   u32 bi;
   const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
   u16 thread_index = vlib_get_thread_index ();
@@ -250,10 +252,13 @@
 
     if (n_left < VLIB_FRAME_SIZE / 2)
       {
-	if (! tm->threads[thread_index].rx_buffers)
+	if (!tm->threads[thread_index].rx_buffers)
 	  vec_alloc (tm->threads[thread_index].rx_buffers, VLIB_FRAME_SIZE);
 
-	n_alloc = vlib_buffer_alloc (vm, tm->threads[thread_index].rx_buffers + n_left, VLIB_FRAME_SIZE - n_left);
+	n_alloc =
+	  vlib_buffer_alloc (vm,
+			     tm->threads[thread_index].rx_buffers + n_left,
+			     VLIB_FRAME_SIZE - n_left);
 	_vec_len (tm->threads[thread_index].rx_buffers) = n_left + n_alloc;
       }
   }
@@ -262,27 +267,31 @@
      Turn them into iovecs to pass to readv. */
   {
     uword i_rx = vec_len (tm->threads[thread_index].rx_buffers) - 1;
-    vlib_buffer_t * b;
+    vlib_buffer_t *b;
     word i, n_bytes_left, n_bytes_in_packet;
 
     /** We should have enough buffers left for an MTU sized packet. */
-    ASSERT (vec_len (tm->threads[thread_index].rx_buffers) >= tm->mtu_buffers);
+    ASSERT (vec_len (tm->threads[thread_index].rx_buffers) >=
+	    tm->mtu_buffers);
 
     vec_validate (tm->threads[thread_index].iovecs, tm->mtu_buffers - 1);
     for (i = 0; i < tm->mtu_buffers; i++)
       {
-	b = vlib_get_buffer (vm, tm->threads[thread_index].rx_buffers[i_rx - i]);
+	b =
+	  vlib_get_buffer (vm,
+			   tm->threads[thread_index].rx_buffers[i_rx - i]);
 	tm->threads[thread_index].iovecs[i].iov_base = b->data;
 	tm->threads[thread_index].iovecs[i].iov_len = buffer_size;
       }
 
-    n_bytes_left = readv (tm->dev_net_tun_fd, tm->threads[thread_index].iovecs,
-			  tm->mtu_buffers);
+    n_bytes_left =
+      readv (tm->dev_net_tun_fd, tm->threads[thread_index].iovecs,
+	     tm->mtu_buffers);
     n_bytes_in_packet = n_bytes_left;
     if (n_bytes_left <= 0)
       {
-        if (errno != EAGAIN)
-          clib_unix_warning ("readv %d", n_bytes_left);
+	if (errno != EAGAIN)
+	  clib_unix_warning ("readv %d", n_bytes_left);
 	return 0;
       }
 
@@ -293,14 +302,15 @@
 	b = vlib_get_buffer (vm, tm->threads[thread_index].rx_buffers[i_rx]);
 	b->flags = 0;
 	b->current_data = 0;
-	b->current_length = n_bytes_left < buffer_size ? n_bytes_left : buffer_size;
+	b->current_length =
+	  n_bytes_left < buffer_size ? n_bytes_left : buffer_size;
 
 	n_bytes_left -= buffer_size;
 
 	if (n_bytes_left <= 0)
-          {
-            break;
-          }
+	  {
+	    break;
+	  }
 
 	i_rx--;
 	b->flags |= VLIB_BUFFER_NEXT_PRESENT;
@@ -309,11 +319,9 @@
 
     /** Interface counters for tuntap interface. */
     vlib_increment_combined_counter
-        (vnet_main.interface_main.combined_sw_if_counters
-         + VNET_INTERFACE_COUNTER_RX,
-         thread_index,
-         tm->sw_if_index,
-         1, n_bytes_in_packet);
+      (vnet_main.interface_main.combined_sw_if_counters
+       + VNET_INTERFACE_COUNTER_RX,
+       thread_index, tm->sw_if_index, 1, n_bytes_in_packet);
 
     _vec_len (tm->threads[thread_index].rx_buffers) = i_rx;
   }
@@ -325,7 +333,7 @@
     uword n_trace = vlib_get_trace_count (vm, node);
 
     vnet_buffer (b)->sw_if_index[VLIB_RX] = tm->sw_if_index;
-    vnet_buffer (b)->sw_if_index[VLIB_TX] = (u32)~0;
+    vnet_buffer (b)->sw_if_index[VLIB_TX] = (u32) ~ 0;
 
     /*
      * Turn this on if you run into
@@ -333,7 +341,7 @@
      * which nodes they've visited...
      */
     if (VLIB_BUFFER_TRACE_TRAJECTORY)
-        b->pre_data[0] = 0;
+      b->pre_data[0] = 0;
 
     b->error = node->errors[0];
 
@@ -343,26 +351,26 @@
       }
     else
       switch (b->data[0] & 0xf0)
-        {
-        case 0x40:
-          next_index = VNET_DEVICE_INPUT_NEXT_IP4_INPUT;
-          break;
-        case 0x60:
-          next_index = VNET_DEVICE_INPUT_NEXT_IP6_INPUT;
-          break;
-        default:
-          next_index = VNET_DEVICE_INPUT_NEXT_DROP;
-          break;
-        }
+	{
+	case 0x40:
+	  next_index = VNET_DEVICE_INPUT_NEXT_IP4_INPUT;
+	  break;
+	case 0x60:
+	  next_index = VNET_DEVICE_INPUT_NEXT_IP6_INPUT;
+	  break;
+	default:
+	  next_index = VNET_DEVICE_INPUT_NEXT_DROP;
+	  break;
+	}
 
     /* The linux kernel couldn't care less if our interface is up */
     if (tm->have_normal_interface)
       {
-        vnet_main_t *vnm = vnet_get_main();
-        vnet_sw_interface_t * si;
-        si = vnet_get_sw_interface (vnm, tm->sw_if_index);
-        if (!(si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP))
-          next_index = VNET_DEVICE_INPUT_NEXT_DROP;
+	vnet_main_t *vnm = vnet_get_main ();
+	vnet_sw_interface_t *si;
+	si = vnet_get_sw_interface (vnm, tm->sw_if_index);
+	if (!(si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP))
+	  next_index = VNET_DEVICE_INPUT_NEXT_DROP;
       }
 
     vnet_feature_start_device_input_x1 (tm->sw_if_index, &next_index, b);
@@ -371,9 +379,8 @@
 
     if (n_trace > 0)
       {
-        vlib_trace_buffer (vm, node, next_index,
-                           b, /* follow_chain */ 1);
-        vlib_set_trace_count (vm, node, n_trace - 1);
+	vlib_trace_buffer (vm, node, next_index, b, /* follow_chain */ 1);
+	vlib_set_trace_count (vm, node, n_trace - 1);
       }
   }
 
@@ -383,10 +390,11 @@
 /**
  * @brief TUNTAP_RX error strings
  */
-static char * tuntap_rx_error_strings[] = {
+static char *tuntap_rx_error_strings[] = {
   "unknown packet type",
 };
 
+/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (tuntap_rx_node,static) = {
   .function = tuntap_rx,
   .name = "tuntap-rx",
@@ -397,6 +405,7 @@
   .n_errors = 1,
   .error_strings = tuntap_rx_error_strings,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Gets called when file descriptor is ready from epoll.
@@ -405,9 +414,10 @@
  *
  * @return error - clib_error_t
  */
-static clib_error_t * tuntap_read_ready (clib_file_t * uf)
+static clib_error_t *
+tuntap_read_ready (clib_file_t * uf)
 {
-  vlib_main_t * vm = vlib_get_main();
+  vlib_main_t *vm = vlib_get_main ();
   vlib_node_set_interrupt_pending (vm, tuntap_rx_node.index);
   return 0;
 }
@@ -428,15 +438,15 @@
   int sfd;
 
   /* Not present. */
-  if (! tm->dev_net_tun_fd || tm->dev_net_tun_fd < 0)
+  if (!tm->dev_net_tun_fd || tm->dev_net_tun_fd < 0)
     return 0;
 
   sfd = socket (AF_INET, SOCK_STREAM, 0);
   if (sfd < 0)
-    clib_unix_warning("provisioning socket");
+    clib_unix_warning ("provisioning socket");
 
-  memset(&ifr, 0, sizeof (ifr));
-  strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name)-1);
+  memset (&ifr, 0, sizeof (ifr));
+  strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
 
   /* get flags, modify to bring down interface... */
   if (ioctl (sfd, SIOCGIFFLAGS, &ifr) < 0)
@@ -450,9 +460,9 @@
   /* Turn off persistence */
   if (ioctl (tm->dev_net_tun_fd, TUNSETPERSIST, 0) < 0)
     clib_unix_warning ("TUNSETPERSIST");
-  close(tm->dev_tap_fd);
+  close (tm->dev_tap_fd);
   if (tm->dev_net_tun_fd >= 0)
-    close(tm->dev_net_tun_fd);
+    close (tm->dev_net_tun_fd);
   if (sfd >= 0)
     close (sfd);
 
@@ -474,9 +484,9 @@
 tuntap_config (vlib_main_t * vm, unformat_input_t * input)
 {
   tuntap_main_t *tm = &tuntap_main;
-  clib_error_t * error = 0;
+  clib_error_t *error = 0;
   struct ifreq ifr;
-  u8 * name;
+  u8 *name;
   int flags = IFF_TUN | IFF_NO_PI;
   int is_enabled = 0, is_ether = 0, have_normal_interface = 0;
   const uword buffer_size = VLIB_BUFFER_DATA_SIZE;
@@ -486,15 +496,14 @@
       if (unformat (input, "mtu %d", &tm->mtu_bytes))
 	;
       else if (unformat (input, "enable"))
-        is_enabled = 1;
+	is_enabled = 1;
       else if (unformat (input, "disable"))
-        is_enabled = 0;
-      else if (unformat (input, "ethernet") ||
-               unformat (input, "ether"))
-        is_ether = 1;
+	is_enabled = 0;
+      else if (unformat (input, "ethernet") || unformat (input, "ether"))
+	is_ether = 1;
       else if (unformat (input, "have-normal-interface") ||
-               unformat (input, "have-normal"))
-        have_normal_interface = 1;
+	       unformat (input, "have-normal"))
+	have_normal_interface = 1;
       else if (unformat (input, "name %s", &name))
 	tm->tun_name = (char *) name;
       else
@@ -508,11 +517,11 @@
   if (is_enabled == 0)
     return 0;
 
-  if (geteuid()) 
+  if (geteuid ())
     {
       clib_warning ("tuntap disabled: must be superuser");
       return 0;
-    }    
+    }
 
   tm->is_ether = is_ether;
   tm->have_normal_interface = have_normal_interface;
@@ -527,14 +536,14 @@
     }
 
   memset (&ifr, 0, sizeof (ifr));
-  strncpy(ifr.ifr_name, tm->tun_name, sizeof(ifr.ifr_name)-1);
+  strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
   ifr.ifr_flags = flags;
-  if (ioctl (tm->dev_net_tun_fd, TUNSETIFF, (void *)&ifr) < 0)
+  if (ioctl (tm->dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
     {
       error = clib_error_return_unix (0, "ioctl TUNSETIFF");
       goto done;
     }
-    
+
   /* Make it persistent, at least until we split. */
   if (ioctl (tm->dev_net_tun_fd, TUNSETPERSIST, 1) < 0)
     {
@@ -543,8 +552,7 @@
     }
 
   /* Open a provisioning socket */
-  if ((tm->dev_tap_fd = socket(PF_PACKET, SOCK_RAW,
-			       htons(ETH_P_ALL))) < 0 )
+  if ((tm->dev_tap_fd = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL))) < 0)
     {
       error = clib_error_return_unix (0, "socket");
       goto done;
@@ -555,21 +563,21 @@
     struct ifreq ifr;
     struct sockaddr_ll sll;
 
-    memset (&ifr, 0, sizeof(ifr));
-    strncpy (ifr.ifr_name, tm->tun_name, sizeof(ifr.ifr_name)-1);
-    if (ioctl (tm->dev_tap_fd, SIOCGIFINDEX, &ifr) < 0 )
+    memset (&ifr, 0, sizeof (ifr));
+    strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
+    if (ioctl (tm->dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
       {
 	error = clib_error_return_unix (0, "ioctl SIOCGIFINDEX");
 	goto done;
       }
 
     /* Bind the provisioning socket to the interface. */
-    memset(&sll, 0, sizeof(sll));
-    sll.sll_family   = AF_PACKET;
-    sll.sll_ifindex  = ifr.ifr_ifindex;
-    sll.sll_protocol = htons(ETH_P_ALL);
+    memset (&sll, 0, sizeof (sll));
+    sll.sll_family = AF_PACKET;
+    sll.sll_ifindex = ifr.ifr_ifindex;
+    sll.sll_protocol = htons (ETH_P_ALL);
 
-    if (bind(tm->dev_tap_fd, (struct sockaddr*) &sll, sizeof(sll)) < 0)
+    if (bind (tm->dev_tap_fd, (struct sockaddr *) &sll, sizeof (sll)) < 0)
       {
 	error = clib_error_return_unix (0, "bind");
 	goto done;
@@ -613,58 +621,54 @@
   if (is_ether)
     {
       if (ioctl (tm->dev_tap_fd, SIOCGIFHWADDR, &ifr) < 0)
-        {
-          error = clib_error_return_unix (0, "ioctl SIOCGIFHWADDR");
-          goto done;
-        }
+	{
+	  error = clib_error_return_unix (0, "ioctl SIOCGIFHWADDR");
+	  goto done;
+	}
       else
-        clib_memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
+	clib_memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6);
     }
 
   if (have_normal_interface)
     {
-      vnet_main_t *vnm = vnet_get_main();
+      vnet_main_t *vnm = vnet_get_main ();
       error = ethernet_register_interface
-        (vnm,
-         tuntap_dev_class.index,
-         0 /* device instance */,
-         tm->ether_dst_mac /* ethernet address */,
-         &tm->hw_if_index, 
-         0 /* flag change */);
+	(vnm, tuntap_dev_class.index, 0 /* device instance */ ,
+	 tm->ether_dst_mac /* ethernet address */ ,
+	 &tm->hw_if_index, 0 /* flag change */ );
       if (error)
-        clib_error_report (error);
+	clib_error_report (error);
       tm->sw_if_index = tm->hw_if_index;
       vm->os_punt_frame = tuntap_nopunt_frame;
     }
   else
     {
-      vnet_main_t *vnm = vnet_get_main();
-      vnet_hw_interface_t * hi;
-      
+      vnet_main_t *vnm = vnet_get_main ();
+      vnet_hw_interface_t *hi;
+
       vm->os_punt_frame = tuntap_punt_frame;
-      
+
       tm->hw_if_index = vnet_register_interface
-        (vnm,
-         tuntap_dev_class.index, 0 /* device instance */,
-         tuntap_interface_class.index, 0);
+	(vnm, tuntap_dev_class.index, 0 /* device instance */ ,
+	 tuntap_interface_class.index, 0);
       hi = vnet_get_hw_interface (vnm, tm->hw_if_index);
       tm->sw_if_index = hi->sw_if_index;
-      
+
       /* Interface is always up. */
-      vnet_hw_interface_set_flags (vnm, tm->hw_if_index, 
-                                   VNET_HW_INTERFACE_FLAG_LINK_UP);
-      vnet_sw_interface_set_flags (vnm, tm->sw_if_index, 
-                                   VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+      vnet_hw_interface_set_flags (vnm, tm->hw_if_index,
+				   VNET_HW_INTERFACE_FLAG_LINK_UP);
+      vnet_sw_interface_set_flags (vnm, tm->sw_if_index,
+				   VNET_SW_INTERFACE_FLAG_ADMIN_UP);
     }
 
   {
-    clib_file_t template = {0};
+    clib_file_t template = { 0 };
     template.read_function = tuntap_read_ready;
     template.file_descriptor = tm->dev_net_tun_fd;
     tm->clib_file_index = clib_file_add (&file_main, &template);
   }
 
- done:
+done:
   if (error)
     {
       if (tm->dev_net_tun_fd >= 0)
@@ -694,27 +698,25 @@
 				      u32 sw_if_index,
 				      ip4_address_t * address,
 				      u32 address_length,
-				      u32 if_address_index,
-				      u32 is_delete)
+				      u32 if_address_index, u32 is_delete)
 {
-  tuntap_main_t * tm = &tuntap_main;
+  tuntap_main_t *tm = &tuntap_main;
   struct ifreq ifr;
-  subif_address_t subif_addr, * ap;
-  uword * p;
+  subif_address_t subif_addr, *ap;
+  uword *p;
 
   /** Tuntap disabled, or using a "normal" interface. */
-  if (tm->have_normal_interface ||  tm->dev_tap_fd < 0)
+  if (tm->have_normal_interface || tm->dev_tap_fd < 0)
     return;
 
   /* if the address is being applied to an interface that is not in
    * the same table/VRF as this tap, then ignore it.
    * If we don't do this overlapping address spaces in the diferent tables
    * breaks the linux host's routing tables */
-  if (fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP4,
-                                          sw_if_index) !=
-      fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP4,
-                                          tm->sw_if_index))
-      return;
+  if (fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP4,
+					   sw_if_index) !=
+      fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP4, tm->sw_if_index))
+    return;
 
   /** See if we already know about this subif */
   memset (&subif_addr, 0, sizeof (subif_addr));
@@ -734,8 +736,8 @@
 
   /* Use subif pool index to select alias device. */
   memset (&ifr, 0, sizeof (ifr));
-  snprintf (ifr.ifr_name, sizeof(ifr.ifr_name), 
-            "%s:%d", tm->tun_name, (int)(ap - tm->subifs));
+  snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
+	    "%s:%d", tm->tun_name, (int) (ap - tm->subifs));
 
   /* the tuntap punt/inject is enabled for IPv4 RX so long as
    * any vpp interface has an IPv4 address.
@@ -743,25 +745,25 @@
    */
   ip4_sw_interface_enable_disable (tm->sw_if_index, !is_delete);
 
-  if (! is_delete)
+  if (!is_delete)
     {
-      struct sockaddr_in * sin;
+      struct sockaddr_in *sin;
 
-      sin = (struct sockaddr_in *)&ifr.ifr_addr;
+      sin = (struct sockaddr_in *) &ifr.ifr_addr;
 
       /* Set ipv4 address, netmask. */
       sin->sin_family = AF_INET;
       clib_memcpy (&sin->sin_addr.s_addr, address, 4);
       if (ioctl (tm->dev_tap_fd, SIOCSIFADDR, &ifr) < 0)
 	clib_unix_warning ("ioctl SIOCSIFADDR");
-    
+
       sin->sin_addr.s_addr = im->fib_masks[address_length];
       if (ioctl (tm->dev_tap_fd, SIOCSIFNETMASK, &ifr) < 0)
 	clib_unix_warning ("ioctl SIOCSIFNETMASK");
     }
   else
     {
-      mhash_unset (&tm->subif_mhash, &subif_addr, 0 /* old value ptr */);
+      mhash_unset (&tm->subif_mhash, &subif_addr, 0 /* old value ptr */ );
       pool_put (tm->subifs, ap);
     }
 
@@ -783,10 +785,11 @@
  * including @c <linux/ipv6.h> causes multiple definitions if
  * @c <netinet/in.h is also included.
  */
-struct in6_ifreq {
-	struct in6_addr	ifr6_addr;
-        u32		ifr6_prefixlen;
-        int		ifr6_ifindex;
+struct in6_ifreq
+{
+  struct in6_addr ifr6_addr;
+  u32 ifr6_prefixlen;
+  int ifr6_ifindex;
 };
 
 /**
@@ -810,28 +813,26 @@
 				      u32 sw_if_index,
 				      ip6_address_t * address,
 				      u32 address_length,
-				      u32 if_address_index,
-				      u32 is_delete)
+				      u32 if_address_index, u32 is_delete)
 {
-  tuntap_main_t * tm = &tuntap_main;
+  tuntap_main_t *tm = &tuntap_main;
   struct ifreq ifr;
   struct in6_ifreq ifr6;
-  subif_address_t subif_addr, * ap;
-  uword * p;
+  subif_address_t subif_addr, *ap;
+  uword *p;
 
   /* Tuntap disabled, or using a "normal" interface. */
-  if (tm->have_normal_interface ||  tm->dev_tap_fd < 0)
+  if (tm->have_normal_interface || tm->dev_tap_fd < 0)
     return;
 
   /* if the address is being applied to an interface that is not in
    * the same table/VRF as this tap, then ignore it.
    * If we don't do this overlapping address spaces in the diferent tables
    * breaks the linux host's routing tables */
-  if (fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP6,
-                                          sw_if_index) !=
-      fib_table_get_index_for_sw_if_index(FIB_PROTOCOL_IP6,
-                                          tm->sw_if_index))
-      return;
+  if (fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP6,
+					   sw_if_index) !=
+      fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP6, tm->sw_if_index))
+    return;
 
   /* See if we already know about this subif */
   memset (&subif_addr, 0, sizeof (subif_addr));
@@ -853,8 +854,8 @@
   /* Use subif pool index to select alias device. */
   memset (&ifr, 0, sizeof (ifr));
   memset (&ifr6, 0, sizeof (ifr6));
-  snprintf (ifr.ifr_name, sizeof(ifr.ifr_name), 
-            "%s:%d", tm->tun_name, (int)(ap - tm->subifs));
+  snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
+	    "%s:%d", tm->tun_name, (int) (ap - tm->subifs));
 
   /* the tuntap punt/inject is enabled for IPv6 RX so long as
    * any vpp interface has an IPv6 address.
@@ -862,45 +863,45 @@
    */
   ip6_sw_interface_enable_disable (tm->sw_if_index, !is_delete);
 
-  if (! is_delete)
+  if (!is_delete)
     {
       int sockfd = socket (AF_INET6, SOCK_STREAM, 0);
       if (sockfd < 0)
-        clib_unix_warning ("get ifindex socket");
+	clib_unix_warning ("get ifindex socket");
 
       if (ioctl (sockfd, SIOGIFINDEX, &ifr) < 0)
-        clib_unix_warning ("get ifindex");
+	clib_unix_warning ("get ifindex");
 
       ifr6.ifr6_ifindex = ifr.ifr_ifindex;
       ifr6.ifr6_prefixlen = address_length;
       clib_memcpy (&ifr6.ifr6_addr, address, 16);
 
       if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0)
-        clib_unix_warning ("set address");
+	clib_unix_warning ("set address");
 
       if (sockfd >= 0)
-        close (sockfd);
+	close (sockfd);
     }
   else
     {
       int sockfd = socket (AF_INET6, SOCK_STREAM, 0);
       if (sockfd < 0)
-        clib_unix_warning ("get ifindex socket");
+	clib_unix_warning ("get ifindex socket");
 
       if (ioctl (sockfd, SIOGIFINDEX, &ifr) < 0)
-        clib_unix_warning ("get ifindex");
+	clib_unix_warning ("get ifindex");
 
       ifr6.ifr6_ifindex = ifr.ifr_ifindex;
       ifr6.ifr6_prefixlen = address_length;
       clib_memcpy (&ifr6.ifr6_addr, address, 16);
 
       if (ioctl (sockfd, SIOCDIFADDR, &ifr6) < 0)
-        clib_unix_warning ("del address");
+	clib_unix_warning ("del address");
 
       if (sockfd >= 0)
-        close (sockfd);
+	close (sockfd);
 
-      mhash_unset (&tm->subif_mhash, &subif_addr, 0 /* old value ptr */);
+      mhash_unset (&tm->subif_mhash, &subif_addr, 0 /* old value ptr */ );
       pool_put (tm->subifs, ap);
     }
 }
@@ -915,8 +916,7 @@
  */
 static void
 tuntap_punt_frame (vlib_main_t * vm,
-                   vlib_node_runtime_t * node,
-                   vlib_frame_t * frame)
+		   vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
   tuntap_tx (vm, node, frame);
   vlib_frame_free (vm, node, frame);
@@ -932,19 +932,20 @@
  */
 static void
 tuntap_nopunt_frame (vlib_main_t * vm,
-                   vlib_node_runtime_t * node,
-                   vlib_frame_t * frame)
+		     vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  u32 * buffers = vlib_frame_args (frame);
+  u32 *buffers = vlib_frame_args (frame);
   uword n_packets = frame->n_vectors;
   vlib_buffer_free (vm, buffers, n_packets);
   vlib_frame_free (vm, node, frame);
 }
 
+/* *INDENT-OFF* */
 VNET_HW_INTERFACE_CLASS (tuntap_interface_class,static) = {
   .name = "tuntap",
   .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief Format tun/tap interface name
@@ -955,7 +956,8 @@
  * @return *s - u8 - formatted string
  *
  */
-static u8 * format_tuntap_interface_name (u8 * s, va_list * args)
+static u8 *
+format_tuntap_interface_name (u8 * s, va_list * args)
 {
   u32 i = va_arg (*args, u32);
 
@@ -975,11 +977,10 @@
  */
 static uword
 tuntap_intfc_tx (vlib_main_t * vm,
-		 vlib_node_runtime_t * node,
-		 vlib_frame_t * frame)
+		 vlib_node_runtime_t * node, vlib_frame_t * frame)
 {
-  tuntap_main_t * tm = &tuntap_main;
-  u32 * buffers = vlib_frame_args (frame);
+  tuntap_main_t *tm = &tuntap_main;
+  u32 *buffers = vlib_frame_args (frame);
   uword n_buffers = frame->n_vectors;
 
   /* Normal interface transmit happens only on the normal interface... */
@@ -990,11 +991,13 @@
   return n_buffers;
 }
 
+/* *INDENT-OFF* */
 VNET_DEVICE_CLASS (tuntap_dev_class,static) = {
   .name = "tuntap",
   .tx_function = tuntap_intfc_tx,
   .format_device_name = format_tuntap_interface_name,
 };
+/* *INDENT-ON* */
 
 /**
  * @brief tun/tap node init
@@ -1007,19 +1010,19 @@
 static clib_error_t *
 tuntap_init (vlib_main_t * vm)
 {
-  clib_error_t * error;
-  ip4_main_t * im4 = &ip4_main;
-  ip6_main_t * im6 = &ip6_main;
+  clib_error_t *error;
+  ip4_main_t *im4 = &ip4_main;
+  ip6_main_t *im6 = &ip6_main;
   ip4_add_del_interface_address_callback_t cb4;
   ip6_add_del_interface_address_callback_t cb6;
-  tuntap_main_t * tm = &tuntap_main;
-  vlib_thread_main_t * m = vlib_get_thread_main ();
+  tuntap_main_t *tm = &tuntap_main;
+  vlib_thread_main_t *m = vlib_get_thread_main ();
 
   error = vlib_call_init_function (vm, ip4_init);
   if (error)
     return error;
 
-  mhash_init (&tm->subif_mhash, sizeof (u32), sizeof(subif_address_t));
+  mhash_init (&tm->subif_mhash, sizeof (u32), sizeof (subif_address_t));
 
   cb4.function = tuntap_ip4_add_del_interface_address;
   cb4.function_opaque = 0;
@@ -1035,3 +1038,11 @@
 }
 
 VLIB_INIT_FUNCTION (tuntap_init);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/unix/tuntap.h b/src/vnet/unix/tuntap.h
index 7c2d551..46e7a60 100644
--- a/src/vnet/unix/tuntap.h
+++ b/src/vnet/unix/tuntap.h
@@ -54,16 +54,24 @@
 } vnet_tap_connect_args_t;
 
 /** Connect a tap interface */
-int vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t *args);
+int vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * args);
 
 /** Connect / renumber a tap interface */
 int vnet_tap_connect_renumber (vlib_main_t * vm,
-                               vnet_tap_connect_args_t *args);
+			       vnet_tap_connect_args_t * args);
 
 /** Modify a tap interface */
-int vnet_tap_modify (vlib_main_t * vm, vnet_tap_connect_args_t *args);
+int vnet_tap_modify (vlib_main_t * vm, vnet_tap_connect_args_t * args);
 
 /** delete a tap interface */
-int vnet_tap_delete(vlib_main_t *vm, u32 sw_if_index);
+int vnet_tap_delete (vlib_main_t * vm, u32 sw_if_index);
 
 
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
