-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.17.0
-
Component/s: network
-
(copied to CRM)
This is a a request to validate and incorporate a custom source routing feature in the driver. If possible we ask to incorporate this in the standard driver distribution for supportability purposes.
Based on mongocxx-driver version 3.6.0, the corresponding custom function was added to the driver the source. The source IP binding was performed only in the mongoc_client_connect_tcp function and the mongoc_topology_scanner_tcp_initiate function. Please validate if there are any other cases to consider.
Unable to find source-code formatter for language: mongo-c-driver-1.17.0/src/libmongoc/src/mongoc/mongoc-uri-private.h. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
extern char global_local_uri[16];
Unable to find source-code formatter for language: mongo-c-driver-1.17.0/src/libmongoc/src/mongoc/mongoc-uri.c. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
char global_local_uri[16]; void mongoc_uri_set_local_uri (const char *local_uri) { if (0 < strlen (local_uri)) { strcpy(global_local_uri, local_uri); } else { strcpy(global_local_uri, ""); } } static bool mongoc_uri_apply_options (mongoc_uri_t *uri, const bson_t *options, bool from_dns, bson_error_t *error) { ... } else if (!strcmp (key, MONGOC_URI_LOCALURI)) { mongoc_uri_set_local_uri (value); } ... }
Unable to find source-code formatter for language: mongo-c-driver-1.17.0/src/libmongoc/src/mongoc/mongoc-client.c. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
mongoc_stream_t * mongoc_client_connect_tcp (int32_t connecttimeoutms, const mongoc_host_list_t *host, bson_error_t *error) { ... if (strlen(global_local_uri) > 0) { struct sockaddr_in server_addr_in = {0}; memset (&server_addr_in, 0, sizeof (server_addr_in)); server_addr_in.sin_family = AF_INET; server_addr_in.sin_addr.s_addr = inet_addr(global_local_uri); mongoc_socket_bind (sock, (struct sockaddr *) &server_addr_in, sizeof (server_addr_in)); } ... }
Unable to find source-code formatter for language: mongo-c-driver-1.17.0/src/libmongoc/src/mongoc/mongoc-topology-scanner.c. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
mongoc_stream_t *
_mongoc_topology_scanner_tcp_initiate (mongoc_async_cmd_t *acmd)
{
...
if (strlen(global_local_uri) > 0)
{
struct sockaddr_in server_addr_in = {0};
memset (&server_addr_in, 0, sizeof (server_addr_in));
server_addr_in.sin_family = AF_INET;
server_addr_in.sin_addr.s_addr = inet_addr(global_local_uri);
mongoc_socket_bind (sock,
(struct sockaddr *) &server_addr_in,
sizeof (server_addr_in));
}
...
}