-#define _(N, j, n, s) \
- case NAT_PROTOCOL_##N: \
- while (1) \
- { \
- portnum = (port_per_thread * snat_thread_index) + \
- snat_random_port (0, port_per_thread - 1) + 1024; \
- if (a->busy_##n##_port_refcounts[portnum]) \
- continue; \
- ++a->busy_##n##_port_refcounts[portnum]; \
- a->busy_##n##_ports_per_thread[thread_index]++; \
- a->busy_##n##_ports++; \
- *addr = a->addr; \
- *port = clib_host_to_net_u16 (portnum); \
- return 0; \
- }
- break;
- foreach_nat_protocol
-#undef _
- default : nat_elog_info (sm, "unknown protocol");
- return 1;
+ a = addresses + i;
+ if (a->fib_index == i2o_fib_index)
+ {
+ return nat44_ed_alloc_i2o_port (
+ sm, a, s, i2o_addr, i2o_port, i2o_fib_index, proto,
+ thread_index, snat_thread_index, outside_addr, outside_port);
+ }
+ else if (a->fib_index == ~0)
+ {
+ ga = a;
+ }
+ }
+
+ if (ga)
+ {
+ return nat44_ed_alloc_i2o_port (
+ sm, a, s, i2o_addr, i2o_port, i2o_fib_index, proto, thread_index,
+ snat_thread_index, outside_addr, outside_port);