diff --git a/src/vnet/ip/icmp6.c b/src/vnet/ip/icmp6.c
index ab871b3..fd5d0ec 100644
--- a/src/vnet/ip/icmp6.c
+++ b/src/vnet/ip/icmp6.c
@@ -341,58 +341,14 @@
 	  ip0->hop_limit = im->host_config.ttl;
 	  ip1->hop_limit = im->host_config.ttl;
 
-	  if (ip6_address_is_link_local_unicast (&ip0->dst_address))
-	    {
-	      ethernet_header_t *eth0;
-	      u8 tmp_mac[6];
-	      /* For link local, reuse current MAC header by sawpping
-	       *  SMAC to DMAC instead of IP6 lookup since link local
-	       *  is not in the IP6 FIB */
-	      vlib_buffer_reset (p0);
-	      eth0 = vlib_buffer_get_current (p0);
-	      clib_memcpy (tmp_mac, eth0->dst_address, 6);
-	      clib_memcpy (eth0->dst_address, eth0->src_address, 6);
-	      clib_memcpy (eth0->src_address, tmp_mac, 6);
-	      vnet_buffer (p0)->sw_if_index[VLIB_TX] =
-		vnet_buffer (p0)->sw_if_index[VLIB_RX];
-	      next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
-	    }
-	  else
-	    {
-	      /* Determine the correct lookup fib indices... */
-	      fib_index0 = vec_elt (im->fib_index_by_sw_if_index,
-				    vnet_buffer (p0)->sw_if_index[VLIB_RX]);
-	      vnet_buffer (p0)->sw_if_index[VLIB_TX] = fib_index0;
-	    }
-
-	  if (ip6_address_is_link_local_unicast (&ip1->dst_address))
-	    {
-	      ethernet_header_t *eth1;
-	      u8 tmp_mac[6];
-	      /* For link local, reuse current MAC header by sawpping
-	       *  SMAC to DMAC instead of IP6 lookup since link local
-	       *  is not in the IP6 FIB */
-	      vlib_buffer_reset (p1);
-	      eth1 = vlib_buffer_get_current (p1);
-	      clib_memcpy (tmp_mac, eth1->dst_address, 6);
-	      clib_memcpy (eth1->dst_address, eth1->src_address, 6);
-	      clib_memcpy (eth1->src_address, tmp_mac, 6);
-	      vnet_buffer (p1)->sw_if_index[VLIB_TX] =
-		vnet_buffer (p1)->sw_if_index[VLIB_RX];
-	      next1 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
-	    }
-	  else
-	    {
-	      /* Determine the correct lookup fib indices... */
-	      fib_index1 = vec_elt (im->fib_index_by_sw_if_index,
-				    vnet_buffer (p1)->sw_if_index[VLIB_RX]);
-	      vnet_buffer (p1)->sw_if_index[VLIB_TX] = fib_index1;
-	    }
-
-	  vnet_buffer (p0)->sw_if_index[VLIB_RX]
-	    = vnet_main.local_interface_sw_if_index;
-	  vnet_buffer (p1)->sw_if_index[VLIB_RX]
-	    = vnet_main.local_interface_sw_if_index;
+	  /* Determine the correct lookup fib indices... */
+	  fib_index0 = vec_elt (im->fib_index_by_sw_if_index,
+				vnet_buffer (p0)->sw_if_index[VLIB_RX]);
+	  vnet_buffer (p0)->sw_if_index[VLIB_TX] = fib_index0;
+	  /* Determine the correct lookup fib indices... */
+	  fib_index1 = vec_elt (im->fib_index_by_sw_if_index,
+				vnet_buffer (p1)->sw_if_index[VLIB_RX]);
+	  vnet_buffer (p1)->sw_if_index[VLIB_TX] = fib_index1;
 
 	  /* verify speculative enqueues, maybe switch current next frame */
 	  /* if next0==next1==next_index then nothing special needs to be done */
@@ -441,30 +397,11 @@
 
 	  ip0->hop_limit = im->host_config.ttl;
 
-	  if (ip6_address_is_link_local_unicast (&ip0->dst_address))
-	    {
-	      ethernet_header_t *eth0;
-	      u8 tmp_mac[6];
-	      /* For link local, reuse current MAC header by sawpping
-	       *  SMAC to DMAC instead of IP6 lookup since link local
-	       *  is not in the IP6 FIB */
-	      vlib_buffer_reset (p0);
-	      eth0 = vlib_buffer_get_current (p0);
-	      clib_memcpy (tmp_mac, eth0->dst_address, 6);
-	      clib_memcpy (eth0->dst_address, eth0->src_address, 6);
-	      clib_memcpy (eth0->src_address, tmp_mac, 6);
-	      vnet_buffer (p0)->sw_if_index[VLIB_TX] =
-		vnet_buffer (p0)->sw_if_index[VLIB_RX];
-	      next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT;
-	    }
-	  else
-	    {
-	      fib_index0 = vec_elt (im->fib_index_by_sw_if_index,
-				    vnet_buffer (p0)->sw_if_index[VLIB_RX]);
-	      vnet_buffer (p0)->sw_if_index[VLIB_TX] = fib_index0;
-	    }
-	  vnet_buffer (p0)->sw_if_index[VLIB_RX]
-	    = vnet_main.local_interface_sw_if_index;
+	  /* if the packet is link local, we'll bounce through the link-local
+	   * table with the RX interface correctly set */
+	  fib_index0 = vec_elt (im->fib_index_by_sw_if_index,
+				vnet_buffer (p0)->sw_if_index[VLIB_RX]);
+	  vnet_buffer (p0)->sw_if_index[VLIB_TX] = fib_index0;
 
 	  /* Verify speculative enqueue, maybe switch current next frame */
 	  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h
index 033ecfc..959d72c 100644
--- a/src/vnet/ip/ip6.h
+++ b/src/vnet/ip/ip6.h
@@ -276,25 +276,36 @@
   return 1;
 }
 
+extern int ip6_get_ll_address (u32 sw_if_index, ip6_address_t * addr);
+
 always_inline int
 ip6_src_address_for_packet (ip_lookup_main_t * lm,
-			    u32 sw_if_index, ip6_address_t * src)
+			    u32 sw_if_index,
+			    const ip6_address_t * dst, ip6_address_t * src)
 {
-  u32 if_add_index = lm->if_address_pool_index_by_sw_if_index[sw_if_index];
-  if (PREDICT_TRUE (if_add_index != ~0))
+  if (ip6_address_is_link_local_unicast (dst))
     {
-      ip_interface_address_t *if_add =
-	pool_elt_at_index (lm->if_address_pool, if_add_index);
-      ip6_address_t *if_ip = ip_interface_address_get_address (lm, if_add);
-      *src = *if_ip;
-      return (0);
+      return ip6_get_ll_address (sw_if_index, src);
     }
   else
     {
-      src->as_u64[0] = 0;
-      src->as_u64[1] = 0;
+      u32 if_add_index =
+	lm->if_address_pool_index_by_sw_if_index[sw_if_index];
+      if (PREDICT_TRUE (if_add_index != ~0))
+	{
+	  ip_interface_address_t *if_add =
+	    pool_elt_at_index (lm->if_address_pool, if_add_index);
+	  ip6_address_t *if_ip =
+	    ip_interface_address_get_address (lm, if_add);
+	  *src = *if_ip;
+	  return (!0);
+	}
     }
-  return (!0);
+
+  src->as_u64[0] = 0;
+  src->as_u64[1] = 0;
+
+  return (0);
 }
 
 /* Find interface address which matches destination. */
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 30b717f..eb7667b 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1548,9 +1548,10 @@
 	     * Choose source address based on destination lookup
 	     * adjacency.
 	     */
-	    if (ip6_src_address_for_packet (lm,
-					    sw_if_index0,
-					    &h0->ip.src_address))
+	    if (!ip6_src_address_for_packet (lm,
+					     sw_if_index0,
+					     &ip0->dst_address,
+					     &h0->ip.src_address))
 	      {
 		/* There is no address on the interface */
 		p0->error =
diff --git a/src/vnet/ip/ip6_ll_table.c b/src/vnet/ip/ip6_ll_table.c
new file mode 100644
index 0000000..67d05ed
--- /dev/null
+++ b/src/vnet/ip/ip6_ll_table.c
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vlib/vlib.h>
+#include <vnet/dpo/drop_dpo.h>
+#include <vnet/fib/ip6_fib.h>
+
+#include <vnet/ip/ip6_ll_table.h>
+
+/**
+ * There's only one IP6 link local table
+ */
+static ip6_ll_table_t ip6_ll_table;
+
+u32
+ip6_ll_fib_get (u32 sw_if_index)
+{
+  ASSERT (vec_len (ip6_ll_table.ilt_fibs) > sw_if_index);
+
+  return (ip6_ll_table.ilt_fibs[sw_if_index]);
+}
+
+fib_node_index_t
+ip6_ll_table_lookup (const ip6_ll_prefix_t * prefix)
+{
+  return (ip6_fib_table_lookup (ip6_ll_fib_get (prefix->ilp_sw_if_index),
+				&prefix->ilp_addr, 128));
+}
+
+fib_node_index_t
+ip6_ll_table_lookup_exact_match (const ip6_ll_prefix_t * prefix)
+{
+  return (ip6_fib_table_lookup_exact_match
+	  (ip6_ll_fib_get (prefix->ilp_sw_if_index), &prefix->ilp_addr, 128));
+}
+
+static void
+ip6_ll_fib_create (u32 sw_if_index)
+{
+  vnet_main_t *vnm = vnet_get_main ();
+  u8 *desc;
+
+  desc = format (NULL, "IP6-link-local:%U",
+		 format_vnet_sw_interface_name,
+		 vnm, vnet_get_sw_interface (vnm, sw_if_index));
+
+  ip6_ll_table.ilt_fibs[sw_if_index] =
+    ip6_fib_table_create_and_lock (FIB_SOURCE_IP6_ND,
+				   FIB_TABLE_FLAG_IP6_LL, desc);
+
+  /*
+   * leave the default route as a drop, but fix fe::/10 to be a glean
+   * via the interface.
+   */
+    /* *INDENT-OFF* */
+    fib_prefix_t pfx = {
+	.fp_proto = FIB_PROTOCOL_IP6,
+	.fp_len = 10,
+	.fp_addr = {
+	    .ip6 = {
+		.as_u8 = {
+                    [0] = 0xFE,
+                    [1] = 0x80,
+                }
+	    },
+	}
+    };
+    fib_table_entry_update_one_path(
+        ip6_ll_table.ilt_fibs[sw_if_index],
+        &pfx,
+        FIB_SOURCE_SPECIAL,
+        (FIB_ENTRY_FLAG_ATTACHED |
+         FIB_ENTRY_FLAG_NO_ATTACHED_EXPORT),
+        DPO_PROTO_IP6,
+        NULL,
+        sw_if_index,
+        ~0,
+        1,
+        NULL,
+        FIB_ROUTE_PATH_FLAG_NONE);
+    /* *INDENT-ON* */
+}
+
+static void
+ip6_ll_prefix_to_fib (const ip6_ll_prefix_t * ilp, fib_prefix_t * fp)
+{
+  fp->fp_proto = FIB_PROTOCOL_IP6;
+  fp->fp_len = 128;
+  fp->fp_addr.ip6 = ilp->ilp_addr;
+}
+
+fib_node_index_t
+ip6_ll_table_entry_update (const ip6_ll_prefix_t * ilp,
+			   fib_route_path_flags_t flags)
+{
+  fib_node_index_t ip6_ll_entry_index;
+  fib_route_path_t *rpaths, rpath = {
+    .frp_flags = flags,
+    .frp_sw_if_index = ilp->ilp_sw_if_index,
+    .frp_proto = DPO_PROTO_IP6,
+  };
+  fib_prefix_t fp;
+
+  vec_validate (ip6_ll_table.ilt_fibs, ilp->ilp_sw_if_index);
+
+  if (0 == ip6_ll_fib_get (ilp->ilp_sw_if_index))
+    {
+      ip6_ll_fib_create (ilp->ilp_sw_if_index);
+    }
+
+  rpaths = NULL;
+  vec_add1 (rpaths, rpath);
+
+  ip6_ll_prefix_to_fib (ilp, &fp);
+  ip6_ll_entry_index =
+    fib_table_entry_update (ip6_ll_fib_get (ilp->ilp_sw_if_index), &fp,
+			    FIB_SOURCE_IP6_ND,
+			    (flags & FIB_ROUTE_PATH_LOCAL ?
+			     FIB_ENTRY_FLAG_LOCAL : FIB_ENTRY_FLAG_NONE),
+			    rpaths);
+  vec_free (rpaths);
+
+  return (ip6_ll_entry_index);
+}
+
+void
+ip6_ll_table_entry_delete (const ip6_ll_prefix_t * ilp)
+{
+  fib_node_index_t ip6_ll_entry_index;
+  u32 fib_index;
+
+  ip6_ll_entry_index = ip6_ll_table_lookup_exact_match (ilp);
+
+  if (FIB_NODE_INDEX_INVALID != ip6_ll_entry_index)
+    fib_table_entry_delete_index (ip6_ll_entry_index, FIB_SOURCE_IP6_ND);
+
+  /*
+   * if there are no ND sourced prefixes left, then we can clean up this FIB
+   */
+  fib_index = ip6_ll_fib_get (ilp->ilp_sw_if_index);
+  if (0 == fib_table_get_num_entries (fib_index,
+				      FIB_PROTOCOL_IP6, FIB_SOURCE_IP6_ND))
+    {
+      fib_table_unlock (fib_index, FIB_PROTOCOL_IP6, FIB_SOURCE_IP6_ND);
+      ip6_ll_table.ilt_fibs[ilp->ilp_sw_if_index] = 0;
+    }
+}
+
+static void
+ip6_ll_table_show_one (vlib_main_t * vm, ip6_ll_prefix_t * ilp, int detail)
+{
+  vlib_cli_output (vm, "%U",
+		   format_fib_entry,
+		   ip6_ll_table_lookup (ilp),
+		   (detail ?
+		    FIB_ENTRY_FORMAT_DETAIL2 : FIB_ENTRY_FORMAT_DETAIL));
+}
+
+typedef struct ip6_ll_show_ctx_t_
+{
+  fib_node_index_t *entries;
+} ip6_ll_show_ctx_t;
+
+static fib_table_walk_rc_t
+ip6_ll_table_show_walk (fib_node_index_t fib_entry_index, void *arg)
+{
+  ip6_ll_show_ctx_t *ctx = arg;
+
+  vec_add1 (ctx->entries, fib_entry_index);
+
+  return (FIB_TABLE_WALK_CONTINUE);
+}
+
+static void
+ip6_ll_table_show_all (vlib_main_t * vm, u32 fib_index)
+{
+  fib_node_index_t *fib_entry_index;
+  ip6_ll_show_ctx_t ctx = {
+    .entries = NULL,
+  };
+
+  fib_table_walk (fib_index, FIB_PROTOCOL_IP6, ip6_ll_table_show_walk, &ctx);
+  vec_sort_with_function (ctx.entries, fib_entry_cmp_for_sort);
+
+  vec_foreach (fib_entry_index, ctx.entries)
+  {
+    vlib_cli_output (vm, "%U",
+		     format_fib_entry,
+		     *fib_entry_index, FIB_ENTRY_FORMAT_BRIEF);
+  }
+
+  vec_free (ctx.entries);
+}
+
+typedef struct
+{
+  u32 fib_index;
+  u64 count_by_prefix_length[129];
+} count_routes_in_fib_at_prefix_length_arg_t;
+
+static void
+count_routes_in_fib_at_prefix_length (BVT (clib_bihash_kv) * kvp, void *arg)
+{
+  count_routes_in_fib_at_prefix_length_arg_t *ap = arg;
+  int mask_width;
+
+  if ((kvp->key[2] >> 32) != ap->fib_index)
+    return;
+
+  mask_width = kvp->key[2] & 0xFF;
+
+  ap->count_by_prefix_length[mask_width]++;
+}
+
+static clib_error_t *
+ip6_ll_show_fib (vlib_main_t * vm,
+		 unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+  count_routes_in_fib_at_prefix_length_arg_t _ca, *ca = &_ca;
+  ip6_main_t *im6 = &ip6_main;
+  fib_table_t *fib_table;
+  int verbose, matching;
+  ip6_address_t matching_address;
+  u32 mask_len = 128;
+  u32 sw_if_index = ~0;
+  int detail = 0;
+  vnet_main_t *vnm = vnet_get_main ();
+  u32 fib_index;
+
+  verbose = 1;
+  matching = 0;
+
+  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (input, "brief") ||
+	  unformat (input, "summary") || unformat (input, "sum"))
+	verbose = 0;
+
+      else if (unformat (input, "detail") || unformat (input, "det"))
+	detail = 1;
+
+      else if (unformat (input, "%U/%d",
+			 unformat_ip6_address, &matching_address, &mask_len))
+	matching = 1;
+
+      else
+	if (unformat (input, "%U", unformat_ip6_address, &matching_address))
+	matching = 1;
+      else if (unformat (input, "%U",
+			 unformat_vnet_sw_interface, vnm, &sw_if_index))
+	;
+      else
+	break;
+    }
+
+  vec_foreach_index (sw_if_index, ip6_ll_table.ilt_fibs)
+  {
+    fib_source_t source;
+    u8 *s = NULL;
+
+    fib_index = ip6_ll_table.ilt_fibs[sw_if_index];
+
+    if (0 == fib_index)
+      continue;
+
+    fib_table = fib_table_get (fib_index, FIB_PROTOCOL_IP6);
+
+    if (!(fib_table->ft_flags & FIB_TABLE_FLAG_IP6_LL))
+      continue;
+
+    s = format (s, "%U, fib_index:%d, locks:[",
+		format_fib_table_name, fib_index,
+		FIB_PROTOCOL_IP6, fib_index);
+    FOR_EACH_FIB_SOURCE (source)
+    {
+      if (0 != fib_table->ft_locks[source])
+	{
+	  s = format (s, "%U:%d, ",
+		      format_fib_source, source, fib_table->ft_locks[source]);
+	}
+    }
+    s = format (s, "]");
+    vlib_cli_output (vm, "%v", s);
+    vec_free (s);
+
+    /* Show summary? */
+    if (!verbose)
+      {
+	BVT (clib_bihash) * h =
+	  &im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash;
+	int len;
+
+	vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
+
+	memset (ca, 0, sizeof (*ca));
+	ca->fib_index = fib_index;
+
+	BV (clib_bihash_foreach_key_value_pair)
+	  (h, count_routes_in_fib_at_prefix_length, ca);
+
+	for (len = 128; len >= 0; len--)
+	  {
+	    if (ca->count_by_prefix_length[len])
+	      vlib_cli_output (vm, "%=20d%=16lld",
+			       len, ca->count_by_prefix_length[len]);
+	  }
+	continue;
+      }
+
+    if (!matching)
+      {
+	ip6_ll_table_show_all (vm, fib_index);
+      }
+    else
+      {
+	if (~0 == sw_if_index)
+	  {
+	    vlib_cli_output (vm, "specify the interface");
+	  }
+	else
+	  {
+	    ip6_ll_prefix_t ilp = {
+	      .ilp_addr = matching_address,
+	      .ilp_sw_if_index = sw_if_index,
+	    };
+	    ip6_ll_table_show_one (vm, &ilp, detail);
+	  }
+      }
+  };
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (ip6_show_fib_command, static) = {
+    .path = "show ip6-ll",
+    .short_help = "show ip6-ll [summary] [interface] [<ip6-addr>[/<width>]] [detail]",
+    .function = ip6_ll_show_fib,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+ip6_ll_module_init (vlib_main_t * vm)
+{
+  clib_error_t *error;
+
+  error = vlib_call_init_function (vm, ip6_lookup_init);
+
+  return (error);
+}
+
+VLIB_INIT_FUNCTION (ip6_ll_module_init);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/ip/ip6_ll_table.h b/src/vnet/ip/ip6_ll_table.h
new file mode 100644
index 0000000..0667cf9
--- /dev/null
+++ b/src/vnet/ip/ip6_ll_table.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __IP6_LL_TABLE_H__
+#define __IP6_LL_TABLE_H__
+
+#include <vnet/ip/ip.h>
+
+#include <vnet/ip/ip6_ll_types.h>
+
+/**
+ * @brief
+ *   A protocol Independent IP multicast FIB table
+ */
+typedef struct ip6_ll_table_t_
+{
+  /**
+   * A vector, indexed by sw_if_index, of unicast IPv6 FIBs
+   */
+  u32 *ilt_fibs;
+
+  /**
+   * Total route counters
+   */
+  u32 ilt_total_route_counts;
+
+} ip6_ll_table_t;
+
+/**
+ * @brief
+ *  Perfom a longest prefix match in the non-forwarding table
+ *
+ * @param prefix
+ *  The prefix to lookup
+ *
+ * @return
+ *  The index of the fib_entry_t for the best match, which may be the default route
+ */
+extern fib_node_index_t ip6_ll_table_lookup (const ip6_ll_prefix_t * prefix);
+
+/**
+ * @brief
+ *  Perfom an exact match in the non-forwarding table
+ *
+ * @param prefix
+ *  The prefix to lookup
+ *
+ * @return
+ *  The index of the fib_entry_t for the exact match, or INVALID
+ *  is there is no match.
+ */
+extern fib_node_index_t ip6_ll_table_lookup_exact_match
+  (const ip6_ll_prefix_t * prefix);
+
+/**
+ * @brief
+ * Update an entry in the table. The falgs determine if the entry is
+ * LOCAL, in which case it's a receive, or not, in which case the entry
+ * will link to an adjacency.
+ *
+ * @param prefix
+ *  The prefix for the entry to add
+ *
+ * @return
+ *  the index of the fib_entry_t that is created (or existed already).
+ */
+extern fib_node_index_t ip6_ll_table_entry_update
+  (const ip6_ll_prefix_t * prefix, fib_route_path_flags_t flags);
+
+/**
+ * @brief
+ *  Delete a IP6 link-local entry.
+ *
+ * @param prefix
+ *  The prefix for the entry to remove
+ */
+extern void ip6_ll_table_entry_delete (const ip6_ll_prefix_t * prefix);
+
+/**
+ * @brief For use in the data plane. Get the underlying ip6 FIB
+ */
+extern u32 ip6_ll_fib_get (u32 sw_if_index);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+
+#endif
diff --git a/src/vnet/ip/ip6_ll_types.c b/src/vnet/ip/ip6_ll_types.c
new file mode 100644
index 0000000..a7ac164
--- /dev/null
+++ b/src/vnet/ip/ip6_ll_types.c
@@ -0,0 +1,40 @@
+ /*
+  * Copyright (c) 2018 Cisco and/or its affiliates.
+  * Licensed under the Apache License, Version 2.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+
+#include <vnet/ip/ip6_ll_types.h>
+
+#include <vnet/ip/ip.h>
+
+u8 *
+format_ip6_ll_prefix (u8 * s, va_list * args)
+{
+  ip6_ll_prefix_t *ilp = va_arg (*args, ip6_ll_prefix_t *);
+  vnet_main_t *vnm = vnet_get_main ();
+
+  s = format (s, "(%U, %U)",
+	      format_ip6_address, &ilp->ilp_addr,
+	      format_vnet_sw_interface_name,
+	      vnm, vnet_get_sw_interface (vnm, ilp->ilp_sw_if_index));
+
+  return (s);
+}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/ip/ip6_ll_types.h b/src/vnet/ip/ip6_ll_types.h
new file mode 100644
index 0000000..3c7e100
--- /dev/null
+++ b/src/vnet/ip/ip6_ll_types.h
@@ -0,0 +1,47 @@
+ /*
+  * Copyright (c) 2018 Cisco and/or its affiliates.
+  * Licensed under the Apache License, Version 2.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at:
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+
+#ifndef __IP6_LL_TYPES_H__
+#define __IP6_LL_TYPES_H__
+
+#include <vnet/ip/ip6_packet.h>
+
+/**
+ * Aggregrate type for a prefix in the IPv6 Link-local table
+ */
+typedef struct ip6_ll_prefix_t_
+{
+  /**
+   * The interface
+   */
+  u32 ilp_sw_if_index;
+
+  /**
+   * the IP6 address
+   */
+  ip6_address_t ilp_addr;
+} ip6_ll_prefix_t;
+
+extern u8 *format_ip6_ll_prefix (u8 * s, va_list * args);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+
+#endif
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 22f640c..d637966 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -25,6 +25,7 @@
 #include <vnet/fib/fib_table.h>
 #include <vnet/fib/ip6_fib.h>
 #include <vnet/mfib/ip6_mfib.h>
+#include <vnet/ip/ip6_ll_table.h>
 
 /**
  * @file
@@ -273,7 +274,7 @@
   u8 *flags = 0;
 
   if (!n)
-    return format (s, "%=12s%=20s%=6s%=20s%=40s", "Time", "Address", "Flags",
+    return format (s, "%=12s%=25s%=6s%=20s%=40s", "Time", "Address", "Flags",
 		   "Link layer", "Interface");
 
   if (n->flags & IP6_NEIGHBOR_FLAG_DYNAMIC)
@@ -286,7 +287,7 @@
     flags = format (flags, "N");
 
   si = vnet_get_sw_interface (vnm, n->key.sw_if_index);
-  s = format (s, "%=12U%=20U%=6s%=20U%=40U",
+  s = format (s, "%=12U%=25U%=6s%=20U%=40U",
 	      format_vlib_cpu_time, vm, n->cpu_time_last_updated,
 	      format_ip6_address, &n->key.ip6_address,
 	      flags ? (char *) flags : "",
@@ -302,18 +303,29 @@
 {
   if (FIB_NODE_INDEX_INVALID != n->fib_entry_index)
     {
-      fib_prefix_t pfx = {
-	.fp_len = 128,
-	.fp_proto = FIB_PROTOCOL_IP6,
-	.fp_addr.ip6 = n->key.ip6_address,
-      };
-      fib_table_entry_path_remove (fib_index,
-				   &pfx,
-				   FIB_SOURCE_ADJ,
-				   DPO_PROTO_IP6,
-				   &pfx.fp_addr,
-				   n->key.sw_if_index, ~0,
-				   1, FIB_ROUTE_PATH_FLAG_NONE);
+      if (ip6_address_is_link_local_unicast (&n->key.ip6_address))
+	{
+	  ip6_ll_prefix_t pfx = {
+	    .ilp_addr = n->key.ip6_address,
+	    .ilp_sw_if_index = n->key.sw_if_index,
+	  };
+	  ip6_ll_table_entry_delete (&pfx);
+	}
+      else
+	{
+	  fib_prefix_t pfx = {
+	    .fp_len = 128,
+	    .fp_proto = FIB_PROTOCOL_IP6,
+	    .fp_addr.ip6 = n->key.ip6_address,
+	  };
+	  fib_table_entry_path_remove (fib_index,
+				       &pfx,
+				       FIB_SOURCE_ADJ,
+				       DPO_PROTO_IP6,
+				       &pfx.fp_addr,
+				       n->key.sw_if_index, ~0,
+				       1, FIB_ROUTE_PATH_FLAG_NONE);
+	}
     }
 }
 
@@ -640,18 +652,30 @@
 static void
 ip6_neighbor_adj_fib_add (ip6_neighbor_t * n, u32 fib_index)
 {
-  fib_prefix_t pfx = {
-    .fp_len = 128,
-    .fp_proto = FIB_PROTOCOL_IP6,
-    .fp_addr.ip6 = n->key.ip6_address,
-  };
+  if (ip6_address_is_link_local_unicast (&n->key.ip6_address))
+    {
+      ip6_ll_prefix_t pfx = {
+	.ilp_addr = n->key.ip6_address,
+	.ilp_sw_if_index = n->key.sw_if_index,
+      };
+      n->fib_entry_index =
+	ip6_ll_table_entry_update (&pfx, FIB_ROUTE_PATH_FLAG_NONE);
+    }
+  else
+    {
+      fib_prefix_t pfx = {
+	.fp_len = 128,
+	.fp_proto = FIB_PROTOCOL_IP6,
+	.fp_addr.ip6 = n->key.ip6_address,
+      };
 
-  n->fib_entry_index =
-    fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
-			      FIB_ENTRY_FLAG_ATTACHED,
-			      DPO_PROTO_IP6, &pfx.fp_addr,
-			      n->key.sw_if_index, ~0, 1, NULL,
-			      FIB_ROUTE_PATH_FLAG_NONE);
+      n->fib_entry_index =
+	fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
+				  FIB_ENTRY_FLAG_ATTACHED,
+				  DPO_PROTO_IP6, &pfx.fp_addr,
+				  n->key.sw_if_index, ~0, 1, NULL,
+				  FIB_ROUTE_PATH_FLAG_NONE);
+    }
 }
 
 int
@@ -708,9 +732,8 @@
        */
       if (!is_no_fib_entry)
 	{
-	  ip6_neighbor_adj_fib_add (n,
-				    ip6_fib_table_get_index_for_sw_if_index
-				    (n->key.sw_if_index));
+	  ip6_neighbor_adj_fib_add
+	    (n, ip6_fib_table_get_index_for_sw_if_index (n->key.sw_if_index));
 	}
       else
 	{
@@ -1135,7 +1158,7 @@
 					      &h0->target_address,
 					      o0->ethernet_address,
 					      sizeof (o0->ethernet_address),
-					      0, ip6_sadd_link_local);
+					      0, 0);
 	    }
 
 	  if (is_solicitation && error0 == ICMP6_ERROR_NONE)
@@ -1153,9 +1176,18 @@
 		}
 	      else
 		{
-		  fei = ip6_fib_table_lookup_exact_match (fib_index,
-							  &h0->target_address,
-							  128);
+		  if (ip6_address_is_link_local_unicast (&h0->target_address))
+		    {
+		      fei = ip6_fib_table_lookup_exact_match
+			(ip6_ll_fib_get (sw_if_index0),
+			 &h0->target_address, 128);
+		    }
+		  else
+		    {
+		      fei = ip6_fib_table_lookup_exact_match (fib_index,
+							      &h0->target_address,
+							      128);
+		    }
 
 		  if (FIB_NODE_INDEX_INVALID == fei)
 		    {
@@ -1174,7 +1206,8 @@
 			}
 		      else
 			if (fib_entry_is_sourced
-			    (fei, FIB_SOURCE_IP6_ND_PROXY))
+			    (fei, FIB_SOURCE_IP6_ND_PROXY) ||
+			    fib_entry_is_sourced (fei, FIB_SOURCE_IP6_ND))
 			{
 			  /* The address was added by IPv6 Proxy ND config.
 			   * We should only respond to these if the NS arrived on
@@ -3273,6 +3306,10 @@
 	      vec_free (unknown_scope);
 	    }
 
+	  vlib_cli_output (vm, "\tLink-local address(es):\n");
+	  vlib_cli_output (vm, "\t\t%U\n", format_ip6_address,
+			   &radv_info->link_local_address);
+
 	  vlib_cli_output (vm, "\tJoined group address(es):\n");
 	  ip6_mldp_group_t *m;
 	  /* *INDENT-OFF* */
@@ -3395,7 +3432,6 @@
   /* if not created - do nothing */
   if (ri != ~0)
     {
-      vnet_main_t *vnm = vnet_get_main ();
       ip6_radv_t *radv_info;
 
       radv_info = pool_elt_at_index (nm->if_radv_pool, ri);
@@ -3405,14 +3441,15 @@
       if (radv_info->ref_count == 0)
 	{
 	  /* essentially "disables" ipv6 on this interface */
-	  error = ip6_add_del_interface_address (vm, sw_if_index,
-						 &radv_info->
-						 link_local_address, 128,
-						 1 /* is_del */ );
-
-	  ip6_neighbor_sw_interface_add_del (vnm, sw_if_index,
-					     0 /* is_add */ );
+	  ip6_ll_prefix_t ilp = {
+	    .ilp_addr = radv_info->link_local_address,
+	    .ilp_sw_if_index = sw_if_index,
+	  };
+	  ip6_ll_table_entry_delete (&ilp);
+	  ip6_sw_interface_enable_disable (sw_if_index, 0);
 	  ip6_mfib_interface_enable_disable (sw_if_index, 0);
+	  ip6_neighbor_sw_interface_add_del (vnet_get_main (), sw_if_index,
+					     0);
 	}
     }
   return error;
@@ -3499,20 +3536,20 @@
 		      /* clear u bit */
 		      link_local_address.as_u8[8] &= 0xfd;
 		    }
+		  {
+		    ip6_ll_prefix_t ilp = {
+		      .ilp_addr = link_local_address,
+		      .ilp_sw_if_index = sw_if_index,
+		    };
 
-		  ip6_mfib_interface_enable_disable (sw_if_index, 1);
+		    ip6_ll_table_entry_update (&ilp, FIB_ROUTE_PATH_LOCAL);
+		  }
 
 		  /* essentially "enables" ipv6 on this interface */
-		  error = ip6_add_del_interface_address (vm, sw_if_index,
-							 &link_local_address,
-							 128
-							 /* address width */ ,
-							 0 /* is_del */ );
+		  ip6_mfib_interface_enable_disable (sw_if_index, 1);
+		  ip6_sw_interface_enable_disable (sw_if_index, 1);
 
-		  if (error)
-		    ip6_neighbor_sw_interface_add_del (vnm, sw_if_index,
-						       !is_add);
-		  else
+		  if (!error)
 		    {
 		      radv_info->link_local_address = link_local_address;
 		    }
@@ -3523,6 +3560,27 @@
   return error;
 }
 
+int
+ip6_get_ll_address (u32 sw_if_index, ip6_address_t * addr)
+{
+  ip6_neighbor_main_t *nm = &ip6_neighbor_main;
+  ip6_radv_t *radv_info;
+  u32 ri;
+
+  if (vec_len (nm->if_radv_pool_index_by_sw_if_index) < sw_if_index)
+    return 0;
+
+  ri = nm->if_radv_pool_index_by_sw_if_index[sw_if_index];
+
+  if (ri == ~0)
+    return 0;
+
+  radv_info = pool_elt_at_index (nm->if_radv_pool, ri);
+  *addr = radv_info->link_local_address;
+
+  return (!0);
+}
+
 static clib_error_t *
 enable_ip6_interface_cmd (vlib_main_t * vm,
 			  unformat_input_t * input, vlib_cli_command_t * cmd)
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index 6b72437..76e3c1f 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -293,7 +293,7 @@
 
 /* Check for link local unicast fe80::/10. */
 always_inline uword
-ip6_address_is_link_local_unicast (ip6_address_t * a)
+ip6_address_is_link_local_unicast (const ip6_address_t * a)
 {
   return a->as_u8[0] == 0xfe && (a->as_u8[1] & 0xc0) == 0x80;
 }
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index a142754..a929a0c 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -314,13 +314,14 @@
   h0->ip6.src_address = *pa6;
 
   /* Fill in the correct source now */
-  ip6_address_t *a = ip6_interface_first_address (im, sw_if_index);
-  if (!a)
+  if (!ip6_src_address_for_packet (&im->lookup_main,
+				   sw_if_index,
+				   &h0->ip6.dst_address,
+				   &h0->ip6.src_address))
     {
       vlib_buffer_free (vm, &bi0, 1);
       return SEND_PING_NO_SRC_ADDRESS;
     }
-  h0->ip6.src_address = a[0];
 
   /* Fill in icmp fields */
   h0->icmp.type = ICMP6_echo_request;
