slapd \- Stand-alone LDAP Daemon
.SH SYNOPSIS
.B LIBEXECDIR/slapd
+.B [\-[4|6]]
.B [\-d debug\-level]
.B [\-f slapd\-config\-file]
.B [\-h URLs]
.BR slapd .
.SH OPTIONS
.TP
+.B \-4
+Listen on IPv4 addresses only.
+.TP
+.B \-6
+Listen on IPv6 addresses only.
+.TP
.BI \-d " debug\-level"
Turn on debugging as defined by
.I debug\-level.
#define LDAPI_MOD_URLEXT "x-mod"
#endif /* LDAP_PF_LOCAL */
+int slap_inet4or6 = AF_UNSPEC;
+
/* globals */
time_t starttime;
ber_socket_t dtblsize;
memset( &hints, '\0', sizeof(hints) );
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = slap_inet4or6;
snprintf(serv, sizeof serv, "%d", port);
if ( (err = getaddrinfo(host, serv, &hints, &res)) ) {
fprintf( stderr,
"usage: %s options\n", name );
fprintf( stderr,
+ "\t-4\t\tIPv4 only\n"
+ "\t-6\t\tIPv6 only\n"
"\t-d level\tDebug level" "\n"
"\t-f filename\tConfiguration file\n"
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
while ( (i = getopt( argc, argv,
"d:f:h:s:n:t"
+#if LDAP_PF_INET6
+ "46"
+#endif
#ifdef HAVE_CHROOT
"r:"
#endif
#endif
)) != EOF ) {
switch ( i ) {
+#ifdef LDAP_PF_INET6
+ case '4':
+ slap_inet4or6 = AF_INET;
+ break;
+ case '6':
+ slap_inet4or6 = AF_INET6;
+ break;
+#endif
+
case 'h': /* listen URLs */
if ( urls != NULL ) free( urls );
urls = ch_strdup( optarg );
#endif
} Sockaddr;
+#ifdef LDAP_PF_INET6
+extern int slap_inet4or6;
+#endif
+
typedef struct slap_oid_macro {
struct berval som_oid;
char **som_names;