summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/session/application.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 56a514192af..2f6bfa97892 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -101,6 +101,8 @@ app_listener_lookup (application_t * app, session_endpoint_cfg_t * sep_ext)
session_endpoint_t *sep;
session_handle_t handle;
session_t *ls;
+ void *iface_ip;
+ ip46_address_t original_ip;
sep = (session_endpoint_t *) sep_ext;
if (application_has_local_scope (app) && session_endpoint_is_local (sep))
@@ -123,6 +125,30 @@ app_listener_lookup (application_t * app, session_endpoint_cfg_t * sep_ext)
return app_listener_get_w_session ((session_t *) ls);
}
+ /*
+ * When binds to "inaddr_any", we add zero address in the local lookup table
+ * and interface address in the global lookup table. If local scope disable,
+ * the latter is the only clue to find the listener.
+ */
+ if (!application_has_local_scope (app) &&
+ ip_is_zero (&sep_ext->ip, sep_ext->is_ip4) &&
+ sep_ext->sw_if_index != ENDPOINT_INVALID_INDEX)
+ {
+ if ((iface_ip = ip_interface_get_first_ip (sep_ext->sw_if_index,
+ sep_ext->is_ip4)))
+ {
+ ip_copy (&original_ip, &sep_ext->ip, sep_ext->is_ip4);
+ ip_set (&sep_ext->ip, iface_ip, sep_ext->is_ip4);
+ handle = session_lookup_endpoint_listener (table_index, sep, 1);
+ ip_copy (&sep_ext->ip, &original_ip, sep_ext->is_ip4);
+ if (handle != SESSION_INVALID_HANDLE)
+ {
+ ls = listen_session_get_from_handle (handle);
+ return app_listener_get_w_session ((session_t *) ls);
+ }
+ }
+ }
+
return 0;
}