Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Fix avahi-daemon when running on kernel < 3.9 (patch taken from Ubuntu). |
| 2 | |
| 3 | Upstream-Status: Pending (unmaintained upstream) |
| 4 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 5 | |
| 6 | Description: SO_REUSEPORT may not exist in running kernel |
| 7 | When userspace defines SO_REUSEPORT we will attempt to enable socket |
| 8 | port number reuse. However if the running kernel does not support |
| 9 | this call it will fail preventing daemon startup. If this call is |
| 10 | present but fails ENOPROTOOPT then we know that actually the kernel |
| 11 | does not support it and we should continue as if we did not have the |
| 12 | call at all. (LP: #1228204) |
| 13 | . |
| 14 | This patch could be removed from the debian package after jessie release. |
| 15 | Author: Andy Whitcroft <apw@canonical.com> |
| 16 | |
| 17 | Index: avahi-0.6.31/avahi-core/socket.c |
| 18 | =================================================================== |
| 19 | --- avahi-0.6.31.orig/avahi-core/socket.c 2013-09-20 16:36:50.000000000 +0100 |
| 20 | +++ avahi-0.6.31/avahi-core/socket.c 2013-09-20 16:38:23.781863644 +0100 |
| 21 | @@ -177,7 +177,8 @@ |
| 22 | yes = 1; |
| 23 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) < 0) { |
| 24 | avahi_log_warn("SO_REUSEPORT failed: %s", strerror(errno)); |
| 25 | - return -1; |
| 26 | + if (errno != ENOPROTOOPT) |
| 27 | + return -1; |
| 28 | } |
| 29 | #endif |
| 30 | |