diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index 085ac8c..60d0db5 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -163,16 +163,16 @@
     {
       u8 *s = NULL;
 
-      if (ctx->learn && result.fields.age_not)
+      if (ctx->learn && l2fib_entry_result_is_set_AGE_NOT (&result))
 	return;			/* skip provisioned macs */
 
-      if (ctx->add && !result.fields.age_not)
+      if (ctx->add && !l2fib_entry_result_is_set_AGE_NOT (&result))
 	return;			/* skip learned macs */
 
       bd_config = vec_elt_at_index (l2input_main.bd_configs,
 				    key.fields.bd_index);
 
-      if (result.fields.age_not)
+      if (l2fib_entry_result_is_set_AGE_NOT (&result))
 	s = format (s, "no");
       else if (bd_config->mac_age == 0)
 	s = format (s, "-");
@@ -189,10 +189,10 @@
 		       key.fields.bd_index,
 		       result.fields.sw_if_index == ~0
 		       ? -1 : result.fields.sw_if_index,
-		       result.fields.sn.bd, result.fields.sn.swif,
-		       s, result.fields.static_mac ? "*" : "-",
-		       result.fields.filter ? "*" : "-",
-		       result.fields.bvi ? "*" : "-",
+		       result.fields.sn.bd, result.fields.sn.swif, s,
+		       l2fib_entry_result_is_set_STATIC (&result) ? "*" : "-",
+		       l2fib_entry_result_is_set_FILTER (&result) ? "*" : "-",
+		       l2fib_entry_result_is_set_BVI (&result) ? "*" : "-",
 		       format_vnet_sw_if_index_name_with_NA,
 		       ctx->vnm, result.fields.sw_if_index);
       vec_free (s);
@@ -377,7 +377,7 @@
  */
 void
 l2fib_add_entry (u8 * mac, u32 bd_index,
-		 u32 sw_if_index, u8 static_mac, u8 filter_mac, u8 bvi_mac)
+		 u32 sw_if_index, l2fib_entry_result_flags_t flags)
 {
   l2fib_entry_key_t key;
   l2fib_entry_result_t result;
@@ -394,17 +394,18 @@
     {
       /* decrement counter if overwriting a learned mac  */
       result.raw = kv.value;
-      if ((result.fields.age_not == 0) && (lm->global_learn_count))
+      if ((!l2fib_entry_result_is_set_AGE_NOT (&result))
+	  && (lm->global_learn_count))
 	lm->global_learn_count--;
     }
 
   /* set up result */
   result.raw = 0;		/* clear all fields */
   result.fields.sw_if_index = sw_if_index;
-  result.fields.static_mac = static_mac;
-  result.fields.filter = filter_mac;
-  result.fields.bvi = bvi_mac;
-  result.fields.age_not = 1;	/* no aging for provisioned entry */
+  result.fields.flags = flags;
+
+  /* no aging for provisioned entry */
+  l2fib_entry_result_set_AGE_NOT (&result);
 
   kv.key = key.raw;
   kv.value = result.raw;
@@ -430,9 +431,10 @@
   u32 bd_id;
   u32 bd_index;
   u32 sw_if_index = ~0;
-  u32 static_mac = 0;
-  u32 bvi_mac = 0;
   uword *p;
+  l2fib_entry_result_flags_t flags;
+
+  flags = L2FIB_ENTRY_RESULT_FLAG_NONE;
 
   if (!unformat (input, "%U", unformat_ethernet_address, mac))
     {
@@ -470,14 +472,9 @@
     }
 
   if (unformat (input, "static"))
-    {
-      static_mac = 1;
-    }
+    flags |= L2FIB_ENTRY_RESULT_FLAG_STATIC;
   else if (unformat (input, "bvi"))
-    {
-      bvi_mac = 1;
-      static_mac = 1;
-    }
+    flags |= (L2FIB_ENTRY_RESULT_FLAG_STATIC | L2FIB_ENTRY_RESULT_FLAG_BVI);
 
   if (vec_len (l2input_main.configs) <= sw_if_index)
     {
@@ -486,7 +483,7 @@
       goto done;
     }
 
-  l2fib_add_fwd_entry (mac, bd_index, sw_if_index, static_mac, bvi_mac);
+  l2fib_add_entry (mac, bd_index, sw_if_index, flags);
 
 done:
   return error;
@@ -536,7 +533,6 @@
   u8 mac[6], save_mac[6];
   u32 bd_index = 0;
   u32 sw_if_index = 8;
-  u32 bvi_mac = 0;
   u32 is_add = 0;
   u32 is_del = 0;
   u32 is_check = 0;
@@ -573,7 +569,8 @@
     {
       for (i = 0; i < count; i++)
 	{
-	  l2fib_add_fwd_entry (mac, bd_index, sw_if_index, *mac, bvi_mac);
+	  l2fib_add_entry (mac, bd_index, sw_if_index,
+			   L2FIB_ENTRY_RESULT_FLAG_NONE);
 	  incr_mac_address (mac);
 	}
     }
@@ -682,7 +679,8 @@
     return 1;
 
   /* decrement counter if dynamically learned mac */
-  if ((result.fields.age_not == 0) && (l2learn_main.global_learn_count))
+  if ((!l2fib_entry_result_is_set_AGE_NOT (&result)) &&
+      (l2learn_main.global_learn_count))
     l2learn_main.global_learn_count--;
 
   /* Remove entry from hash table */
@@ -1025,7 +1023,7 @@
 	      l2fib_entry_key_t key = {.raw = v->kvp[k].key };
 	      l2fib_entry_result_t result = {.raw = v->kvp[k].value };
 
-	      if (result.fields.age_not == 0)
+	      if (!l2fib_entry_result_is_set_AGE_NOT (&result))
 		learn_count++;
 
 	      if (client)
@@ -1049,18 +1047,19 @@
 		      evt_idx = 0;
 		    }
 
-		  if (result.fields.lrn_evt)
+		  if (l2fib_entry_result_is_set_LRN_EVT (&result))
 		    {
 		      /* copy mac entry to event msg */
 		      clib_memcpy (mp->mac[evt_idx].mac_addr, key.fields.mac,
 				   6);
-		      mp->mac[evt_idx].action = result.fields.lrn_mov ?
+		      mp->mac[evt_idx].action =
+			l2fib_entry_result_is_set_LRN_MOV (&result) ?
 			MAC_EVENT_ACTION_MOVE : MAC_EVENT_ACTION_ADD;
 		      mp->mac[evt_idx].sw_if_index =
 			htonl (result.fields.sw_if_index);
 		      /* clear event bits and update mac entry */
-		      result.fields.lrn_evt = 0;
-		      result.fields.lrn_mov = 0;
+		      l2fib_entry_result_clear_LRN_EVT (&result);
+		      l2fib_entry_result_clear_LRN_MOV (&result);
 		      BVT (clib_bihash_kv) kv;
 		      kv.key = key.raw;
 		      kv.value = result.raw;
@@ -1070,7 +1069,7 @@
 		    }
 		}
 
-	      if (event_only || result.fields.age_not)
+	      if (event_only || l2fib_entry_result_is_set_AGE_NOT (&result))
 		continue;	/* skip aging - static_mac alsways age_not */
 
 	      /* start aging processing */
