+ u32 ns_index, fib_index;
+
+ ns_index = app->ns_index;
+
+ /* App is a transport proto, so fetch the calling app's ns */
+ if (app->flags & APP_OPTIONS_FLAGS_IS_TRANSPORT_APP)
+ {
+ app_worker_t *owner_wrk;
+ application_t *owner_app;
+
+ owner_wrk = app_worker_get (sep->app_wrk_index);
+ owner_app = application_get (owner_wrk->app_index);
+ ns_index = owner_app->ns_index;
+ }
+ app_ns = app_namespace_get (ns_index);
+ if (!app_ns)
+ return;
+
+ /* Ask transport and network to bind to/connect using local interface
+ * that "supports" app's namespace. This will fix our local connection
+ * endpoint.
+ */
+ fib_index = sep->is_ip4 ? app_ns->ip4_fib_index : app_ns->ip6_fib_index;
+ sep->peer.fib_index = fib_index;
+ sep->fib_index = fib_index;
+
+ if (!is_connect)