Browse Source

pianod: Sync patches with upstream. Fix SNI support

Signed-off-by: Ted Hess <thess@kitschensync.net>
lilik-openwrt-22.03
Ted Hess 10 years ago
parent
commit
99d4c95ad3
4 changed files with 69 additions and 34 deletions
  1. +2
    -2
      sound/pianod/Makefile
  2. +60
    -14
      sound/pianod/patches/005-Fix_IPV6_socket_handling.patch
  3. +1
    -1
      sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch
  4. +6
    -17
      sound/pianod/patches/030-Waitress_add_polarssl_variant.patch

+ 2
- 2
sound/pianod/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=pianod PKG_NAME:=pianod
PKG_VERSION:=173 PKG_VERSION:=173
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://deviousfish.com/Downloads/pianod/ PKG_SOURCE_URL:=http://deviousfish.com/Downloads/pianod/
@ -63,7 +63,7 @@ CONFIGURE_ARGS+= --with-polarssl
PIANOD_CLIENT:=pianod-client-compiled-51.tar.gz PIANOD_CLIENT:=pianod-client-compiled-51.tar.gz
define Download/pianod-client define Download/pianod-client
URL:=$(PKG_SOURCE_URL)/Devel
URL:=$(PKG_SOURCE_URL)
FILE:=$(PIANOD_CLIENT) FILE:=$(PIANOD_CLIENT)
MD5SUM:=abbdee5627bcee6a00c8304da8b4e2e7 MD5SUM:=abbdee5627bcee6a00c8304da8b4e2e7
endef endef


+ 60
- 14
sound/pianod/patches/005-Fix_IPV6_socket_handling.patch View File

@ -1,21 +1,67 @@
--- a/src/libwaitress/waitress.c --- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c
@@ -813,7 +813,14 @@ static WaitressReturn_t WaitressConnect
sizeof (sockopt));
@@ -805,34 +805,37 @@ static WaitressReturn_t WaitressConnect
int pollres;
/* non-blocking connect will return immediately */
- connect (sock, gacurr->ai_addr, gacurr->ai_addrlen);
+ if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) == -1) {
+ // Error if not in-progress or immediate success
+ if (errno != EINPROGRESS) {
+ // Close socket and try alternatives
+ close (sock);
+ continue;
+ }
+ }
/* we need shorter timeouts for connect() */
- fcntl (sock, F_SETFL, O_NONBLOCK);
+ pollres = fcntl (sock, F_SETFL, O_NONBLOCK);
+ assert (pollres != -1);
pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
if (pollres == 0) {
- /* increase socket receive buffer */
- const int sockopt = 256*1024;
- setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
- sizeof (sockopt));
-
- /* non-blocking connect will return immediately */
- connect (sock, gacurr->ai_addr, gacurr->ai_addrlen);
-
- pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
- if (pollres == 0) {
- ret = WAITRESS_RET_TIMEOUT;
- } else if (pollres == -1) {
- ret = WAITRESS_RET_ERR;
- } else {
- /* check connect () return value */
- socklen_t pollresSize = sizeof (pollres);
- getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
- &pollresSize);
- if (pollres != 0) {
- ret = WAITRESS_RET_CONNECT_REFUSED;
+ if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) != -1) {
+ /* working */
+ waith->request.sockfd = sock;
+ break;
+ } else if (errno == EINPROGRESS) {
+ /* wait for connect to succeed */
+ pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
+ if (pollres == 0) {
+ ret = WAITRESS_RET_TIMEOUT;
+ } else if (pollres == -1) {
+ ret = WAITRESS_RET_ERR;
} else {
- /* this one is working */
- waith->request.sockfd = sock;
- break;
+ /* check connect () return value */
+ socklen_t pollresSize = sizeof (pollres);
+ getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
+ &pollresSize);
+ if (pollres != 0) {
+ ret = WAITRESS_RET_CONNECT_REFUSED;
+ } else {
+ /* this one is working */
+ waith->request.sockfd = sock;
+ break;
+ }
}
+ } else {
+ ret = WAITRESS_RET_ERR;
}
+
close (sock);
}
}
--- a/src/libfootball/fb_service.c --- a/src/libfootball/fb_service.c
+++ b/src/libfootball/fb_service.c +++ b/src/libfootball/fb_service.c
@@ -111,6 +111,8 @@ static bool fb_setup_socket (FB_SERVICE @@ -111,6 +111,8 @@ static bool fb_setup_socket (FB_SERVICE


+ 1
- 1
sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch View File

@ -19,7 +19,7 @@
--- a/src/libwaitress/waitress.c --- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c
@@ -922,14 +922,14 @@ static WaitressReturn_t WaitressSendRequ
@@ -918,14 +918,14 @@ static WaitressReturn_t WaitressSendRequ
if (WaitressProxyEnabled (waith) && !waith->url.tls) { if (WaitressProxyEnabled (waith) && !waith->url.tls) {
snprintf (buf, WAITRESS_BUFFER_SIZE, snprintf (buf, WAITRESS_BUFFER_SIZE,
"%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n" "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n"


+ 6
- 17
sound/pianod/patches/030-Waitress_add_polarssl_variant.patch View File

@ -247,23 +247,12 @@
return WAITRESS_RET_OK; return WAITRESS_RET_OK;
} }
@@ -807,11 +878,6 @@ static WaitressReturn_t WaitressConnect
/* we need shorter timeouts for connect() */
fcntl (sock, F_SETFL, O_NONBLOCK);
- /* increase socket receive buffer */
- const int sockopt = 256*1024;
- setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
- sizeof (sockopt));
-
/* non-blocking connect will return immediately */
if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) == -1) {
// Error if not in-progress or immediate success
@@ -880,6 +946,11 @@ static WaitressReturn_t WaitressConnect
@@ -876,6 +947,12 @@ static WaitressReturn_t WaitressConnect
} }
} }
+#if defined(USE_POLARSSL) +#if defined(USE_POLARSSL)
+ ssl_set_hostname (&waith->request.sslCtx->ssl, waith->url.host);
+ if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) { + if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) {
+ return WAITRESS_RET_TLS_HANDSHAKE_ERR; + return WAITRESS_RET_TLS_HANDSHAKE_ERR;
+ } + }
@ -271,7 +260,7 @@
/* Ignore return code as connection will likely still succeed */ /* Ignore return code as connection will likely still succeed */
gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS, gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS,
waith->url.host, strlen (waith->url.host)); waith->url.host, strlen (waith->url.host));
@@ -887,14 +958,15 @@ static WaitressReturn_t WaitressConnect
@@ -883,14 +960,15 @@ static WaitressReturn_t WaitressConnect
if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) { if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) {
return WAITRESS_RET_TLS_HANDSHAKE_ERR; return WAITRESS_RET_TLS_HANDSHAKE_ERR;
} }
@ -289,7 +278,7 @@
} }
return WAITRESS_RET_OK; return WAITRESS_RET_OK;
@@ -1120,6 +1192,21 @@ WaitressReturn_t WaitressFetchCall (Wait
@@ -1116,6 +1194,21 @@ WaitressReturn_t WaitressFetchCall (Wait
waith->request.contentLengthKnown = false; waith->request.contentLengthKnown = false;
if (waith->url.tls) { if (waith->url.tls) {
@ -311,7 +300,7 @@
gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT); gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT);
gnutls_set_default_priority (waith->request.tlsSession); gnutls_set_default_priority (waith->request.tlsSession);
@@ -1137,6 +1224,7 @@ WaitressReturn_t WaitressFetchCall (Wait
@@ -1133,6 +1226,7 @@ WaitressReturn_t WaitressFetchCall (Wait
WaitressPollRead); WaitressPollRead);
gnutls_transport_set_push_function (waith->request.tlsSession, gnutls_transport_set_push_function (waith->request.tlsSession,
WaitressPollWrite); WaitressPollWrite);
@ -319,7 +308,7 @@
} }
/* buffer is required for connect already */ /* buffer is required for connect already */
@@ -1148,15 +1236,22 @@ WaitressReturn_t WaitressFetchCall (Wait
@@ -1144,15 +1238,22 @@ WaitressReturn_t WaitressFetchCall (Wait
if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) { if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) {
wRet = WaitressReceiveResponse (waith); wRet = WaitressReceiveResponse (waith);
} }


Loading…
Cancel
Save