From 34b594aa8f8036633bded1295ac4a8ceca5f768f Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Jan 09 2012 20:44:03 +0000 Subject: - change how we skip the be-txn-post hook so that it doesn't produce a misleading debug message - set IPV6_V6ONLY to avoid logging an expected EADDRINUSE error --- diff --git a/src/back-shr.c b/src/back-shr.c index 5697a9e..044c694 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -1957,7 +1957,6 @@ backend_shr_internal_postop_init(Slapi_PBlock *pb, struct plugin_state *state) int backend_shr_be_txn_postop_init(Slapi_PBlock *pb, struct plugin_state *state) { -#if 0 if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_ADD_FN, backend_shr_add_cb) != 0) { slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, @@ -1982,7 +1981,6 @@ backend_shr_be_txn_postop_init(Slapi_PBlock *pb, struct plugin_state *state) "error hooking up be-txn-post delete callback\n"); return -1; } -#endif return 0; } #endif diff --git a/src/plug-nis.c b/src/plug-nis.c index 24098ae..ca3a253 100644 --- a/src/plug-nis.c +++ b/src/plug-nis.c @@ -299,7 +299,10 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) state->pmap_client_socket = sockfd; /* We need to bind on privileged ports for both datagram and connected - * listeners, over both IPv4 and IPv6. */ + * listeners, over both IPv4 and IPv6. We should be using + * getaddrinfo()'s AI_PASSIVE flag, and binding to every address it + * returns, but getaddrinfo() requires that we specify the port if we + * don't specify the host, and we don't always know either. */ state->n_listeners = 0; for (i = 0; i < 4; i++) { int pf, type, one, ret; @@ -331,6 +334,19 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) close(sockfd); continue; } + /* Mark the v6 sockets as v6-only so that we don't get an + * EADDRINUSE error when we try to bind to the same IPv4 port + * later. */ + if (pf == PF_INET6) { + if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, + &one, sizeof(one)) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + plugin_description.spd_id, + "error marking %s socket as " + "IPv6-only, continuing\n", + sock_desc); + } + } /* Bind to the server port, if one was specified, otherwise try * to find an unused one. */ memset(&sin, 0, sizeof(sin)); @@ -518,6 +534,7 @@ nis_plugin_init(Slapi_PBlock *pb) return -1; } #ifdef USE_SLAPI_BE_TXNS +#if 0 if (slapi_register_plugin("betxnpostoperation", TRUE, "nis_plugin_init_be_txn_postop", nis_plugin_init_be_txn_postop, @@ -528,6 +545,7 @@ nis_plugin_init(Slapi_PBlock *pb) return -1; } #endif +#endif slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "registered plugin hooks\n"); global_plugin_state = NULL; diff --git a/src/plug-sch.c b/src/plug-sch.c index 160aa3e..5315acd 100644 --- a/src/plug-sch.c +++ b/src/plug-sch.c @@ -229,6 +229,7 @@ schema_compat_plugin_init(Slapi_PBlock *pb) "error registering internal postoperation plugin\n"); return -1; } +#if 0 #ifdef USE_SLAPI_BE_TXNS if (slapi_register_plugin("betxnpostoperation", TRUE, "schema_compat_plugin_init_be_txn_postop", @@ -240,6 +241,7 @@ schema_compat_plugin_init(Slapi_PBlock *pb) return -1; } #endif +#endif slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "registered plugin hooks\n"); global_plugin_state = NULL;