Package: policyd-weight / 0.1.15.2-12

11_fix_ipv6_socket_creation.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Description: fixes socket creation if local dns ip is IPv6 address
Origin: Werner Detter <werner@aloah-from-hell.de> 
Author: Werner Detter <werner@aloah-from-hell.de>
DEP: 3
Bug-Debian: http://bugs.debian.org/763986

--- a/policyd-weight
+++ b/policyd-weight
@@ -913,15 +913,31 @@
 if($res)
 {
     my $ns = (($res->nameserver)[0]);
-    if(!($s = IO::Socket::INET->new( 
-                                PeerAddr => $ns,
-                                PeerPort => '53',
-                                Proto    => 'udp'
-                              )
-    ))
+    if(Net::IP::ip_is_ipv6($ns) == 1)
     {
-        mylog(warning=>"could not open RBL Lookup Socket to $ns: $@ $!");
-        $USE_NET_DNS = 1;
+        if(!($s = IO::Socket::INET6->new(
+                        PeerAddr => $ns,
+			PeerPort => '53',
+			Proto    => 'udp'
+			)
+	))
+	{
+    	    mylog(warning=>"could not open IPv6 RBL Lookup Socket to $ns: $@ $!");
+    	    $USE_NET_DNS = 1;
+	}
+    }
+    else
+    {
+	if(!($s = IO::Socket::INET->new(
+			PeerAddr => $ns,
+			PeerPort => '53',
+			Proto    => 'udp'
+			)
+	))
+	{
+	    mylog(warning=>"could not open RBL Lookup Socket to $ns: $@ $!");
+   	    $USE_NET_DNS = 1;
+	}
     }
 }
 
@@ -1393,17 +1409,32 @@
                         $s->close; # don't use inherited DNS sockets
                     }
                     my $ns = (($res->nameserver)[0]);
-                    if(!($s = IO::Socket::INET->new( 
-                                     PeerAddr => $ns,
-                                     PeerPort => '53',
-                                     Proto    => 'udp'))
-                      )
-                    {
-                        mylog(warning=>
-                            "child: could not open RBL Lookup Socket to $ns: $@ $!");
-
-                        $USE_NET_DNS = 1;
-                    }
+		    if(Net::IP::ip_is_ipv6($ns) == 1)
+    		    {
+			if(!($s = IO::Socket::INET6->new(
+                        		PeerAddr => $ns,
+                                   	PeerPort => '53',
+                                    	Proto    => 'udp'
+                                    	)
+        		))
+        		{
+            	    	    mylog(warning=>"could not open IPv6 RBL Lookup Socket to $ns: $@ $!");
+            		    $USE_NET_DNS = 1;
+			}
+    		    }
+    	    	    else
+    		    {
+        		if(!($s = IO::Socket::INET->new(
+                       			PeerAddr => $ns,
+					PeerPort => '53',
+                       			Proto    => 'udp'
+                       			)
+        		))
+        		{
+                    	    mylog(warning=>"could not open RBL Lookup Socket to $ns: $@ $!");
+                    	    $USE_NET_DNS = 1;
+        		}
+		    }
                 }
 
                 my $readable_handles = new IO::Select();