diff -up nss/cmd/httpserv/httpserv.c.539183 nss/cmd/httpserv/httpserv.c
--- nss/cmd/httpserv/httpserv.c.539183	2013-05-28 14:43:24.000000000 -0700
+++ nss/cmd/httpserv/httpserv.c	2013-05-30 22:16:46.685373471 -0700
@@ -661,14 +661,18 @@ getBoundListenSocket(unsigned short port
     PRStatus	       prStatus;
     PRNetAddr          addr;
     PRSocketOptionData opt;
+    PRUint16           socketDomain = PR_AF_INET;
 
-    addr.inet.family = PR_AF_INET;
-    addr.inet.ip     = PR_INADDR_ANY;
-    addr.inet.port   = PR_htons(port);
+    if (PR_SetNetAddr(PR_IpAddrAny, PR_AF_INET6, port, &addr) != PR_SUCCESS) {
+	errExit("PR_SetNetAddr");
+    }
 
-    listen_sock = PR_NewTCPSocket();
+    if (PR_GetEnv("NSS_USE_SDP")) {
+        socketDomain = PR_AF_INET_SDP;
+    }
+    listen_sock = PR_OpenTCPSocket(PR_AF_INET6);
     if (listen_sock == NULL) {
-	errExit("PR_NewTCPSocket");
+	errExit("PR_OpenTCPSocket error");
     }
 
     opt.option = PR_SockOpt_Nonblocking;
diff -up nss/cmd/selfserv/selfserv.c.539183 nss/cmd/selfserv/selfserv.c
--- nss/cmd/selfserv/selfserv.c.539183	2013-05-28 14:43:24.000000000 -0700
+++ nss/cmd/selfserv/selfserv.c	2013-05-30 22:16:46.688373495 -0700
@@ -1687,14 +1687,18 @@ getBoundListenSocket(unsigned short port
     PRStatus	       prStatus;
     PRNetAddr          addr;
     PRSocketOptionData opt;
+    PRUint16           socketDomain = PR_AF_INET;
 
-    addr.inet.family = PR_AF_INET;
-    addr.inet.ip     = PR_INADDR_ANY;
-    addr.inet.port   = PR_htons(port);
+    if (PR_SetNetAddr(PR_IpAddrAny, PR_AF_INET6, port, &addr) != PR_SUCCESS) {
+	errExit("PR_SetNetAddr");
+    }
 
-    listen_sock = PR_NewTCPSocket();
+    if (PR_GetEnv("NSS_USE_SDP")) {
+        socketDomain = PR_AF_INET_SDP;
+    }
+    listen_sock = PR_OpenTCPSocket(PR_AF_INET6);
     if (listen_sock == NULL) {
-	errExit("PR_NewTCPSocket");
+        errExit("PR_OpenTCPSocket error");
     }
 
     opt.option = PR_SockOpt_Nonblocking;
