Bug 971152: Revert the alternative test for IPv6 support on Linux
authorWan-Teh Chang <wtc@google.com>
Fri, 21 Feb 2014 15:09:33 -0800
changeset 4521 ad00f36fa4601d54d1ee7ae042e7308feb1409ee
parent 4520 439404406e4b3b912da0c9dd2490f1a22901e31d
child 4522 b68b651fb7c39f2e2544b584696927ff0ffbd12d
push id69
push userwtc@google.com
push dateFri, 21 Feb 2014 23:09:39 +0000
bugs971152
Bug 971152: Revert the alternative test for IPv6 support on Linux because access to /proc is prohibited for normal users in a Linux kernel with grsecurity patches. r=jld.
pr/src/pthreads/ptio.c
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -3395,46 +3395,42 @@ failed:
 }  /* PR_AllocFileDesc */
 
 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)
 PR_EXTERN(PRStatus) _pr_push_ipv6toipv4_layer(PRFileDesc *fd);
 #if defined(_PR_INET6_PROBE)
 extern PRBool _pr_ipv6_is_present(void);
 PR_IMPLEMENT(PRBool) _pr_test_ipv6_socket()
 {
+    int osfd;
+
 #if defined(DARWIN)
     /*
      * Disable IPv6 if Darwin version is less than 7.0.0 (OS X 10.3).  IPv6 on
      * lesser versions is not ready for general use (see bug 222031).
      */
     {
         struct utsname u;
         if (uname(&u) != 0 || atoi(u.release) < 7)
             return PR_FALSE;
     }
 #endif
 
-#if defined(LINUX)
-    /* If /proc/net/if_inet6 exists, the Linux kernel supports IPv6. */
-    int rv = access("/proc/net/if_inet6", F_OK);
-    return (rv == 0);
-#else
     /*
      * HP-UX only: HP-UX IPv6 Porting Guide (dated February 2001)
      * suggests that we call open("/dev/ip6", O_RDWR) to determine
      * whether IPv6 APIs and the IPv6 stack are on the system.
      * Our portable test below seems to work fine, so I am using it.
      */
-    PRInt32 osfd = socket(AF_INET6, SOCK_STREAM, 0);
+    osfd = socket(AF_INET6, SOCK_STREAM, 0);
     if (osfd != -1) {
         close(osfd);
         return PR_TRUE;
     }
     return PR_FALSE;
-#endif
 }
 #endif	/* _PR_INET6_PROBE */
 #endif
 
 PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
 {
     PRIntn osfd;
     PRDescType ftype;