Link the vpp application against libvnet.so, not libvnet.a
[vpp.git] / vnet / vnet / ip / lookup.c
index 80f0a33..d0ec494 100644 (file)
@@ -881,12 +881,6 @@ void ip_lookup_init (ip_lookup_main_t * lm, u32 is_ip6)
        lm->local_next_by_ip_protocol[i] = IP_LOCAL_NEXT_PUNT;
        lm->builtin_protocol_by_ip_protocol[i] = IP_BUILTIN_PROTOCOL_UNKNOWN;
       }
-#if 0
-    /* Eliot's TCP doesn't actually work */
-    lm->local_next_by_ip_protocol[IP_PROTOCOL_TCP] = IP_LOCAL_NEXT_TCP_LOOKUP;
-    lm->builtin_protocol_by_ip_protocol[IP_PROTOCOL_TCP] = 
-        IP_BUILTIN_PROTOCOL_TCP;
-#endif
 
     lm->local_next_by_ip_protocol[IP_PROTOCOL_UDP] = IP_LOCAL_NEXT_UDP_LOOKUP;
     lm->local_next_by_ip_protocol[is_ip6 ? IP_PROTOCOL_ICMP6 : IP_PROTOCOL_ICMP] = IP_LOCAL_NEXT_ICMP;
@@ -1814,6 +1808,16 @@ typedef CLIB_PACKED (struct {
   u32 index : 26;
 }) ip4_route_t;
 
+static int
+ip4_route_cmp (void * a1, void * a2)
+{
+  ip4_route_t * r1 = a1;
+  ip4_route_t * r2 = a2;
+
+  int cmp = ip4_address_compare (&r1->address, &r2->address);
+  return cmp ? cmp : ((int) r1->address_length - (int) r2->address_length);
+}
+
 static clib_error_t *
 ip4_show_fib (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
 {
@@ -1949,9 +1953,7 @@ ip4_show_fib (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * c
            }
        }
 
-      vec_sort (routes, r1, r2,
-               ({ int cmp = ip4_address_compare (&r1->address, &r2->address);
-                 cmp ? cmp : ((int) r1->address_length - (int) r2->address_length); }));
+      vec_sort_with_function (routes, ip4_route_cmp);
       if (vec_len(routes)) {
           if (include_empty_fibs == 0)
               vlib_cli_output (vm, "Table %d, fib_index %d, flow hash: %U", 
@@ -2104,6 +2106,15 @@ static void count_routes_in_fib_at_prefix_length
   ap->count_by_prefix_length[mask_width]++;
 }
 
+static int
+ip6_route_cmp (void * a1, void * a2)
+{
+  ip6_route_t * r1 = a1;
+  ip6_route_t * r2 = a2;
+
+  int cmp = ip6_address_compare (&r1->address, &r2->address);
+  return cmp ? cmp : ((int) r1->address_length - (int) r2->address_length);
+}
 
 static clib_error_t *
 ip6_show_fib (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -2172,9 +2183,7 @@ ip6_show_fib (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * c
 
       BV(clib_bihash_foreach_key_value_pair)(h, add_routes_in_fib, a);
       
-      vec_sort (routes, r1, r2,
-               ({ int cmp = ip6_address_compare (&r1->address, &r2->address);
-                 cmp ? cmp : ((int) r1->address_length - (int) r2->address_length); }));
+      vec_sort_with_function (routes, ip6_route_cmp);
 
       vlib_cli_output (vm, "%=45s%=16s%=16s%=16s",
                       "Destination", "Packets", "Bytes", "Adjacency");