tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: conditionally applying a patch



On Tue, May 24, 2016 at 06:49:05PM +0200, Edgar Fuß wrote:
> > Only limited, example would be mail/mutt.
> That would probably work.
> 
> > CPPFLAGS+= -DSO_ACCEPTFILTER
> > 
> > doesn't work?
> I want do DISable Accept Filters despite SO_ACCEPTFILTER being defined, not the other way round.

Ah, ok. Try something like the attached patch then. Only compile-tested
:) Adds a new option server.use-acceptfilter to control the use.

Joerg
Index: www/lighttpd/distinfo
==================================================================
--- www/lighttpd/distinfo
+++ www/lighttpd/distinfo
@@ -3,7 +3,10 @@
 SHA1 (lighttpd-1.4.39.tar.xz) = 60ade7189044f1965b2b49e0d632e63437a263b0
 RMD160 (lighttpd-1.4.39.tar.xz) = 1b6eed1ed6ee7f8aa390efc93c1a9eff8f52e4c5
 SHA512 (lighttpd-1.4.39.tar.xz) = 69bf56afe2bec381566defdc20961554e405e5e7f77b0067e1a29a04e65167b9283cf08655b8dae1c2b6fdddde31245253b5506a532a83f363dce066811b61b3
 Size (lighttpd-1.4.39.tar.xz) = 579180 bytes
 SHA1 (patch-doc_config_lighttpd.conf) = de14fd0aa0ed2cac5846d810b5c89af4036f1b70
+SHA1 (patch-src_base.h) = baa7019074cb779cda0137c0ec261ae07ed6e16e
+SHA1 (patch-src_configfile.c) = 1505697c8081ec499fcee003841c8229e459be39
 SHA1 (patch-src_fdevent_poll.c) = f5fe62f0b227d64dc717661a256567b4bd97f075
+SHA1 (patch-src_network.c) = d64a67c252dee32f8b2b6ed8267ff7c394917eac
 SHA1 (patch-src_plugin.c) = 27b7a193c1f5867b5a1d2e2c5b289a0bf6368b39

ADDED    www/lighttpd/patches/patch-src_base.h
Index: www/lighttpd/patches/patch-src_base.h
==================================================================
--- www/lighttpd/patches/patch-src_base.h
+++ www/lighttpd/patches/patch-src_base.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/base.h.orig	2016-05-24 17:06:52.087192378 +0000
++++ src/base.h
+@@ -289,6 +289,7 @@ typedef struct {
+ 
+ 	unsigned short use_ipv6, set_v6only; /* set_v6only is only a temporary option */
+ 	unsigned short defer_accept;
++	unsigned short use_acceptfilter; /* Use SO_ACCEPTFILTER, limited to *BSD */
+ 	unsigned short ssl_enabled; /* only interesting for setting up listening sockets. don't use at runtime */
+ 	unsigned short allow_http11;
+ 	unsigned short etag_use_inode;

ADDED    www/lighttpd/patches/patch-src_configfile.c
Index: www/lighttpd/patches/patch-src_configfile.c
==================================================================
--- www/lighttpd/patches/patch-src_configfile.c
+++ www/lighttpd/patches/patch-src_configfile.c
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/configfile.c.orig	2016-05-24 17:06:50.153414516 +0000
++++ src/configfile.c
+@@ -108,6 +108,7 @@ static int config_insert(server *srv) {
+ 		{ "ssl.honor-cipher-order",            NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 66 */
+ 		{ "ssl.empty-fragments",               NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 67 */
+ 		{ "server.upload-temp-file-size",      NULL, T_CONFIG_INT,     T_CONFIG_SCOPE_SERVER     }, /* 68 */
++		{ "server.use-acceptfilter",           NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 69 */
+ 
+ 		{ "server.host",
+ 			"use server.bind instead",
+@@ -206,6 +207,11 @@ static int config_insert(server *srv) {
+ 		s->use_ipv6      = 0;
+ 		s->set_v6only    = 1;
+ 		s->defer_accept  = 0;
++#ifdef SO_ACCEPTFILTER
++		s->use_acceptfilter = 1;
++#else
++		s->use_acceptfilter = 0;
++#endif
+ #ifdef HAVE_LSTAT
+ 		s->follow_symlink = 1;
+ #endif
+@@ -281,6 +287,7 @@ static int config_insert(server *srv) {
+ 		cv[65].destination = &(s->ssl_disable_client_renegotiation);
+ 		cv[66].destination = &(s->ssl_honor_cipher_order);
+ 		cv[67].destination = &(s->ssl_empty_fragments);
++		cv[69].destination = &(s->use_acceptfilter);
+ 
+ 		srv->config_storage[i] = s;
+ 

ADDED    www/lighttpd/patches/patch-src_network.c
Index: www/lighttpd/patches/patch-src_network.c
==================================================================
--- www/lighttpd/patches/patch-src_network.c
+++ www/lighttpd/patches/patch-src_network.c
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/network.c.orig	2016-05-24 17:06:13.777177781 +0000
++++ src/network.c
+@@ -440,7 +440,7 @@ static int network_server_init(server *s
+ 			log_error_write(srv, __FILE__, __LINE__, "ss", "can't set TCP_DEFER_ACCEPT: ", strerror(errno));
+ 		}
+ #endif
+-	} else {
++	} else if (s->use_acceptfilter) {
+ #ifdef SO_ACCEPTFILTER
+ 		/* FreeBSD accf_http filter */
+ 		struct accept_filter_arg afa;



Home | Main Index | Thread Index | Old Index