summaryrefslogtreecommitdiffstats
path: root/source/a/quota/quotad.fix.high.cpu.usage.diff
blob: 5dfafc9fd46c73684926cbe223543da1b3044270 (plain) (blame)
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
diff -up quota-4.04/svc_socket.c.orig quota-4.04/svc_socket.c
--- quota-4.04/svc_socket.c.orig        2017-09-05 10:04:16.000000000 -0400
+++ quota-4.04/svc_socket.c     2018-05-12 14:46:44.813388914 -0400
@@ -118,6 +118,15 @@ static int svc_create_sock(struct addrin
                return -1;
        }

+       if (ai->ai_family == AF_INET6) {
+               if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
+                               &optval, sizeof(optval)) < 0) {
+                       errstr(_("Cannot set ipv6 socket options: %s\n"), strerror(errno));
+                       close(fd);
+                       return -1;
+               }
+       }
+
        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
                errstr(_("Cannot set socket options: %s\n"), strerror(errno));
                close(fd);
@@ -129,6 +138,15 @@ static int svc_create_sock(struct addrin
                close(fd);
                return -1;
        }
+
+       if (ai->ai_protocol == IPPROTO_TCP) {
+               if (listen(fd, SOMAXCONN) < 0) {
+                       errstr(_("Cannot listen to address: %s\n"), strerror(errno));
+                       close(fd);
+                       return -1;
+               }
+       }
+
        return fd;
 }