pluart(4): fifo support

2022-02-25 Thread Anton Lindqvist
Hi,
This enables fifo support in pluart(4). While here, I changed the
attachment output to look more like com(4). Tested on my rpi3b which has
a 16 byte fifo.

Comments? OK?

diff --git sys/dev/ic/pluart.c sys/dev/ic/pluart.c
index eaa11b6c44b..601435c0e0c 100644
--- sys/dev/ic/pluart.c
+++ sys/dev/ic/pluart.c
@@ -99,6 +99,13 @@
 #define UART_CR_CTSE   (1 << 14)   /* CTS hardware flow control 
enable */
 #define UART_CR_RTSE   (1 << 15)   /* RTS hardware flow control 
enable */
 #define UART_IFLS  0x34/* Interrupt FIFO level select 
register */
+#define UART_IFLS_RX_SHIFT 3   /* RX level in bits [5:3] */
+#define UART_IFLS_TX_SHIFT 0   /* TX level in bits [2:0] */
+#define UART_IFLS_1_8  0   /* FIFO 1/8 full */
+#define UART_IFLS_1_4  1   /* FIFO 1/4 full */
+#define UART_IFLS_1_2  2   /* FIFO 1/2 full */
+#define UART_IFLS_3_4  3   /* FIFO 3/4 full */
+#define UART_IFLS_7_8  4   /* FIFO 7/8 full */
 #define UART_IMSC  0x38/* Interrupt mask set/clear 
register */
 #define UART_IMSC_RIMIM(1 << 0)
 #define UART_IMSC_CTSMIM   (1 << 1)
@@ -115,6 +122,11 @@
 #define UART_MIS   0x40/* Masked interrupt status 
register */
 #define UART_ICR   0x44/* Interrupt clear register */
 #define UART_DMACR 0x48/* DMA control register */
+#define UART_PID0  0xfe0   /* Peripheral identification 
register 0 */
+#define UART_PID1  0xfe4   /* Peripheral identification 
register 1 */
+#define UART_PID2  0xfe8   /* Peripheral identification 
register 2 */
+#define UART_PID2_REV(x)   ((x) >> 4)
+#define UART_PID3  0xfec   /* Peripheral identification 
register 3 */
 #define UART_SPACE 0x100
 
 void pluartcnprobe(struct consdev *cp);
@@ -150,7 +162,12 @@ struct cdevsw pluartdev =
 void
 pluart_attach_common(struct pluart_softc *sc, int console)
 {
-   int maj;
+   int maj, rev;
+
+   rev = UART_PID2_REV(bus_space_read_4(sc->sc_iot, sc->sc_ioh,
+   UART_PID2));
+
+   printf(": rev %d, %d byte fifo\n", rev, rev < 3 ? 16 : 32);
 
if (console) {
/* Locate the major number. */
@@ -159,7 +176,7 @@ pluart_attach_common(struct pluart_softc *sc, int console)
break;
cn_tab->cn_dev = makedev(maj, sc->sc_dev.dv_unit);
 
-   printf(": console");
+   printf("%s: console\n", sc->sc_dev.dv_xname);
SET(sc->sc_hwflags, COM_HW_CONSOLE);
}
 
@@ -171,13 +188,26 @@ pluart_attach_common(struct pluart_softc *sc, int console)
panic("%s: can't establish soft interrupt.",
sc->sc_dev.dv_xname);
 
-   bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_IMSC, (UART_IMSC_RXIM | 
UART_IMSC_TXIM));
+   /*
+* The transmit FIFO size is set to 3/4 of the actual size as interrupts
+* can only be triggered when the FIFO is partially full. Once
+* triggered, we know that at least this amount is available in the
+* FIFO.
+*/
+   if (rev < 3)
+   sc->sc_fifolen = 24;
+   else
+   sc->sc_fifolen = 12;
+   bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_IFLS,
+   (UART_IFLS_3_4 << UART_IFLS_RX_SHIFT) |
+   (UART_IFLS_1_4 << UART_IFLS_TX_SHIFT));
+   sc->sc_imsc = UART_IMSC_RXIM | UART_IMSC_RTIM | UART_IMSC_TXIM;
+   bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_IMSC, sc->sc_imsc);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_ICR, 0x7ff);
+   /* Enable FIFO. */
bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_LCR_H,
-   bus_space_read_4(sc->sc_iot, sc->sc_ioh, UART_LCR_H) &
-   ~UART_LCR_H_FEN);
-
-   printf("\n");
+   bus_space_read_4(sc->sc_iot, sc->sc_ioh, UART_LCR_H) |
+   UART_LCR_H_FEN);
 }
 
 int
@@ -197,19 +227,26 @@ pluart_intr(void *arg)
if (sc->sc_tty == NULL)
return 0;
 
-   if (!ISSET(is, UART_IMSC_RXIM) && !ISSET(is, UART_IMSC_TXIM))
+   if (!ISSET(is, UART_IMSC_RXIM) && !ISSET(is, UART_IMSC_RTIM) &&
+   !ISSET(is, UART_IMSC_TXIM))
return 0;
 
-   if (ISSET(is, UART_IMSC_TXIM) && ISSET(tp->t_state, TS_BUSY)) {
-   CLR(tp->t_state, TS_BUSY | TS_FLUSH);
-   if (sc->sc_halt > 0)
-   wakeup(>t_outq);
-   (*linesw[tp->t_line].l_start)(tp);
+   if (ISSET(is, UART_IMSC_TXIM)) {
+   /* Disable transmit interrupt. */
+   bus_space_write_4(sc->sc_iot, sc->sc_ioh, UART_IMSC,
+   sc->sc_imsc & ~UART_IMSC_TXIM);
+
+   if (ISSET(tp->t_state, TS_BUSY)) {
+   

Re: request for testing: malloc and large allocations

2022-02-25 Thread Otto Moerbeek
On Tue, Feb 01, 2022 at 08:00:36AM +0100, Otto Moerbeek wrote:

> On Fri, Jan 28, 2022 at 05:17:48PM +0100, Otto Moerbeek wrote:
> 
> > On Fri, Jan 28, 2022 at 04:33:28PM +0100, Alexander Bluhm wrote:
> > 
> > > On Sun, Jan 09, 2022 at 02:54:43PM +0100, Otto Moerbeek wrote:
> > > > currently malloc does cache a number of free'ed regions up to 128k in
> > > > size. This cache is indexed by size (in # of pages), so it is very
> > > > quick to check.
> > > >
> > > > Some programs allocate and deallocate larger allocations in a frantic
> > > > way.  Accodomate those programs by also keeping a cache of regions
> > > > betwen 128k and 2M, in a cache of variable sized regions.
> > > >
> > > > My test case speeds up about twice. A make build gets a small speedup.
> > > >
> > > > This has been tested by myself on amd64 quite intensively. I am asking
> > > > for more tests, especialy on more "exotic" platforms. I wil do arm64
> > > > myself soon.  Test can be running your favorite programs, doing make
> > > > builds or running tests in regress/lib/libc/malloc.
> > > 
> > > I see openssl and tmux crash with this diff.
> > > /usr/src/regress/usr.sbin/openssl reproduces it on arm64, amd64,
> > > i386.
> > 
> > Are you running with any malloc flags?
> 
> This bug report enabled me to find a bug that would pop up if G mode
> is enabled.
> 
> New diff below. New tests appreciated.

This has been in snaps for a while.

Any body willing to review and OK?

-Otto


> Index: stdlib/malloc.c
> ===
> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
> retrieving revision 1.272
> diff -u -p -r1.272 malloc.c
> --- stdlib/malloc.c   19 Sep 2021 09:15:22 -  1.272
> +++ stdlib/malloc.c   31 Jan 2022 16:27:31 -
> @@ -113,13 +113,27 @@ struct region_info {
>  
>  LIST_HEAD(chunk_head, chunk_info);
>  
> -#define MAX_CACHEABLE_SIZE   32
> -struct cache {
> - void *pages[MALLOC_MAXCACHE];
> +/*
> + * Two caches, one for "small" regions, one for "big".
> + * Small cache is an array per size, big cache is one array with different
> + * sized regions
> + */
> +#define MAX_SMALLCACHEABLE_SIZE  32
> +#define MAX_BIGCACHEABLE_SIZE512
> +/* If the total # of pages is larger than this, evict before inserting */
> +#define BIGCACHE_FILL(sz)(MAX_BIGCACHEABLE_SIZE * (sz) / 4)
> +
> +struct smallcache {
> + void **pages;
>   ushort length;
>   ushort max;
>  };
>  
> +struct bigcache {
> + void *page;
> + size_t psize;
> +};
> +
>  struct dir_info {
>   u_int32_t canary1;
>   int active; /* status of malloc */
> @@ -139,7 +153,10 @@ struct dir_info {
>   void *delayed_chunks[MALLOC_DELAYED_CHUNK_MASK + 1];
>   u_char rbytes[32];  /* random bytes */
>   /* free pages cache */
> - struct cache cache[MAX_CACHEABLE_SIZE];
> + struct smallcache smallcache[MAX_SMALLCACHEABLE_SIZE];
> + size_t bigcache_used;
> + size_t bigcache_size;
> + struct bigcache *bigcache;
>  #ifdef MALLOC_STATS
>   size_t inserts;
>   size_t insert_collisions;
> @@ -207,7 +224,7 @@ struct malloc_readonly {
>  #ifdef MALLOC_STATS
>   int malloc_stats;   /* dump statistics at end */
>  #endif
> - u_int32_t malloc_canary;/* Matched against ones in malloc_pool 
> */
> + u_int32_t malloc_canary;/* Matched against ones in pool */
>  };
>  
>  /* This object is mapped PROT_READ after initialisation to prevent tampering 
> */
> @@ -714,18 +731,61 @@ unmap(struct dir_info *d, void *p, size_
>   size_t psz = sz >> MALLOC_PAGESHIFT;
>   void *r;
>   u_short i;
> - struct cache *cache;
> + struct smallcache *cache;
>  
>   if (sz != PAGEROUND(sz) || psz == 0)
>   wrterror(d, "munmap round");
>  
> - if (psz > MAX_CACHEABLE_SIZE || d->cache[psz - 1].max == 0) {
> + if (d->bigcache_size > 0 && psz > MAX_SMALLCACHEABLE_SIZE &&
> + psz <= MAX_BIGCACHEABLE_SIZE) {
> + u_short base = getrbyte(d);
> + u_short j;
> +
> + /* don't look through all slots */
> + for (j = 0; j < d->bigcache_size / 4; j++) {
> + i = (base + j) % d->bigcache_size;
> + if (d->bigcache_used <
> + BIGCACHE_FILL(d->bigcache_size))  {
> + if (d->bigcache[i].psize == 0)
> + break;
> + } else {
> + if (d->bigcache[i].psize != 0)
> + break;
> + }
> + }
> + /* if we didn't find a preferred slot, use random one */
> + if (d->bigcache[i].psize != 0) {
> + size_t tmp;
> +
> + r = d->bigcache[i].page;
> + d->bigcache_used -= d->bigcache[i].psize;
> 

Re: [PATCH] Report versioned lib.so in cc --print-file-name given short name

2022-02-25 Thread Greg Steuck
No opinions?

Greg Steuck  writes:

> LLVM OpenBSD guardians,
>
> I want to get a closure on "Power-up cc --print-file-name for .so names"
> thread on tech@. I care because it helps me with lang/ghc port.
>
> Here's a is fairly finished diff. I'll be taking it through the
> make-build-twice dance (because I can). If somebody has a good idea
> where the identical code could live, I'm open to not duplicating
> it. Otherwise, OK?
>
> Thanks
> Greg
>
>> From 447d158494ce4a1b4986f16e3bc2ef057712fe27 Mon Sep 17 00:00:00 2001
> From: Greg Steuck 
> Date: Sun, 13 Feb 2022 22:28:43 -0800
> Subject: [PATCH] Report versioned lib.so in cc --print-file-name given short
>  name
>
> E.g. `cc --print-file-name libc.so` reports /usr/lib/libc.so.96.1
>
> This is a complement of the major.minor finding logic in DriverUtils.
> `ld -lc -L/usr/lib` currently finds the libraries with this logic.
>
> To make things more obviously related the code was extracted into a
> function which was copied over verbatim.
> ---
>  gnu/llvm/clang/lib/Driver/Driver.cpp | 54 +++--
>  gnu/llvm/lld/ELF/DriverUtils.cpp | 60 
>  2 files changed, 85 insertions(+), 29 deletions(-)
>
> diff --git a/gnu/llvm/clang/lib/Driver/Driver.cpp 
> b/gnu/llvm/clang/lib/Driver/Driver.cpp
> index 94a7553e273..399c37d15ab 100644
> --- a/gnu/llvm/clang/lib/Driver/Driver.cpp
> +++ b/gnu/llvm/clang/lib/Driver/Driver.cpp
> @@ -5089,7 +5089,50 @@ const char *Driver::GetNamedOutputPath(Compilation , 
> const JobAction ,
>}
>  }
>  
> +
> +namespace {
> +static Optional findFile(StringRef path1, const Twine ) {
> +  SmallString<128> s;
> +  llvm::sys::path::append(s, path1, path2);
> +
> +  if (llvm::sys::fs::exists(s))
> +return std::string(s);
> +  return None;
> +}
> +
> +// Must be in sync with findMajMinShlib in lld/ELF/DriverUtils.cpp.
> +llvm::Optional findMajMinShlib(StringRef dir, const Twine& 
> libNameSo) {
> +  // Handle OpenBSD-style maj/min shlib scheme
> +  llvm::SmallString<128> Scratch;
> +  const StringRef LibName = (libNameSo + ".").toStringRef(Scratch);
> +  int MaxMaj = -1, MaxMin = -1;
> +  std::error_code EC;
> +  for (llvm::sys::fs::directory_iterator LI(dir, EC), LE;
> +   LI != LE; LI = LI.increment(EC)) {
> +StringRef FilePath = LI->path();
> +StringRef FileName = llvm::sys::path::filename(FilePath);
> +if (!(FileName.startswith(LibName)))
> +  continue;
> +std::pair MajMin =
> +  FileName.substr(LibName.size()).split('.');
> +int Maj, Min;
> +if (MajMin.first.getAsInteger(10, Maj) || Maj < 0)
> +  continue;
> +if (MajMin.second.getAsInteger(10, Min) || Min < 0)
> +  continue;
> +if (Maj > MaxMaj)
> +  MaxMaj = Maj, MaxMin = Min;
> +if (MaxMaj == Maj && Min > MaxMin)
> +  MaxMin = Min;
> +  }
> +  if (MaxMaj >= 0)
> +return findFile(dir, LibName + Twine(MaxMaj) + "." + Twine(MaxMin));
> +  return None;
> +}
> +}  // namespace
> +
>  std::string Driver::GetFilePath(StringRef Name, const ToolChain ) const {
> +  const bool lookForLibDotSo = Name.startswith("lib") && 
> Name.endswith(".so");
>// Search for Name in a list of paths.
>auto SearchPaths = [&](const llvm::SmallVectorImpl )
>-> llvm::Optional {
> @@ -5099,9 +5142,14 @@ std::string Driver::GetFilePath(StringRef Name, const 
> ToolChain ) const {
>if (Dir.empty())
>  continue;
>SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
> -  llvm::sys::path::append(P, Name);
> -  if (llvm::sys::fs::exists(Twine(P)))
> -return std::string(P);
> +  if (!lookForLibDotSo) {
> + llvm::sys::path::append(P, Name);
> + if (llvm::sys::fs::exists(Twine(P)))
> +   return std::string(P);
> +  } else {
> + if (auto s = findMajMinShlib(P, Name))
> +   return std::string(*s);
> +  }
>  }
>  return None;
>};
> diff --git a/gnu/llvm/lld/ELF/DriverUtils.cpp 
> b/gnu/llvm/lld/ELF/DriverUtils.cpp
> index 6b164e30677..2fee8538913 100644
> --- a/gnu/llvm/lld/ELF/DriverUtils.cpp
> +++ b/gnu/llvm/lld/ELF/DriverUtils.cpp
> @@ -230,6 +230,38 @@ Optional elf::findFromSearchPaths(StringRef 
> path) {
>return None;
>  }
>  
> +namespace {
> +// Must be in sync with findMajMinShlib in clang/lib/Driver/Driver.cpp.
> +llvm::Optional findMajMinShlib(StringRef dir, const Twine& 
> libNameSo) {
> +  // Handle OpenBSD-style maj/min shlib scheme
> +  llvm::SmallString<128> Scratch;
> +  const StringRef LibName = (libNameSo + ".").toStringRef(Scratch);
> +  int MaxMaj = -1, MaxMin = -1;
> +  std::error_code EC;
> +  for (llvm::sys::fs::directory_iterator LI(dir, EC), LE;
> +   LI != LE; LI = LI.increment(EC)) {
> +StringRef FilePath = LI->path();
> +StringRef FileName = llvm::sys::path::filename(FilePath);
> +if (!(FileName.startswith(LibName)))
> +  continue;
> +std::pair MajMin =
> +  FileName.substr(LibName.size()).split('.');
> +int Maj, Min;
> +if 

Re: [patch] httpd static gzip compression

2022-02-25 Thread Alexander Bluhm
> Shouldn't we check for truncation on strlcpy and strlcat and goto fail
> in that event?

With goto abort we get an 500 internal server error.

Index: httpd.conf.5
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.conf.5,v
retrieving revision 1.119
diff -u -p -r1.119 httpd.conf.5
--- httpd.conf.524 Oct 2021 16:01:04 -  1.119
+++ httpd.conf.525 Feb 2022 18:41:42 -
@@ -425,6 +425,12 @@ A variable that is set to a comma separa
 features in use
 .Pq omitted when TLS client verification is not in use .
 .El
+.It Ic gzip-static
+Enable static gzip compression to save bandwith.
+.Pp
+If gzip encoding is accepted and if the requested file exists with
+an additional .gz suffix, use the compressed file instead and deliver
+it with content encoding gzip.
 .It Ic hsts Oo Ar option Oc
 Enable HTTP Strict Transport Security.
 Valid options are:
Index: httpd.h
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.h,v
retrieving revision 1.158
diff -u -p -r1.158 httpd.h
--- httpd.h 24 Oct 2021 16:01:04 -  1.158
+++ httpd.h 25 Feb 2022 18:40:58 -
@@ -396,6 +396,7 @@ SPLAY_HEAD(client_tree, client);
 #define SRVFLAG_DEFAULT_TYPE   0x0080
 #define SRVFLAG_PATH_REWRITE   0x0100
 #define SRVFLAG_NO_PATH_REWRITE0x0200
+#define SRVFLAG_GZIP_STATIC0x0400
 #define SRVFLAG_LOCATION_FOUND 0x4000
 #define SRVFLAG_LOCATION_NOT_FOUND 0x8000
 
Index: parse.y
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/parse.y,v
retrieving revision 1.127
diff -u -p -r1.127 parse.y
--- parse.y 24 Oct 2021 16:01:04 -  1.127
+++ parse.y 25 Feb 2022 18:24:30 -
@@ -141,7 +141,7 @@ typedef struct {
 %token TIMEOUT TLS TYPE TYPES HSTS MAXAGE SUBDOMAINS DEFAULT PRELOAD REQUEST
 %token ERROR INCLUDE AUTHENTICATE WITH BLOCK DROP RETURN PASS REWRITE
 %token CA CLIENT CRL OPTIONAL PARAM FORWARDED FOUND NOT
-%token ERRDOCS
+%token ERRDOCS GZIPSTATIC
 %token   STRING
 %token   NUMBER
 %type  port
@@ -553,6 +553,7 @@ serveroptsl : LISTEN ON STRING opttls po
| logformat
| fastcgi
| authenticate
+   | gzip_static
| filter
| LOCATION optfound optmatch STRING {
struct server   *s;
@@ -1217,6 +1218,14 @@ fcgiport : NUMBER{
}
;
 
+gzip_static: NO GZIPSTATIC {
+   srv->srv_conf.flags &= ~SRVFLAG_GZIP_STATIC;
+   }
+   | GZIPSTATIC{
+   srv->srv_conf.flags |= SRVFLAG_GZIP_STATIC;
+   }
+   ;
+
 tcpip  : TCP '{' optnl tcpflags_l '}'
| TCP tcpflags
;
@@ -1441,6 +1450,7 @@ lookup(char *s)
{ "fastcgi",FCGI },
{ "forwarded",  FORWARDED },
{ "found",  FOUND },
+   { "gzip-static",GZIPSTATIC },
{ "hsts",   HSTS },
{ "include",INCLUDE },
{ "index",  INDEX },
Index: server_file.c
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/server_file.c,v
retrieving revision 1.70
diff -u -p -r1.70 server_file.c
--- server_file.c   29 Apr 2021 18:23:07 -  1.70
+++ server_file.c   26 Feb 2022 01:43:17 -
@@ -223,26 +223,56 @@ server_file_request(struct httpd *env, s
const char  *errstr = NULL;
int  fd = -1, ret, code = 500;
size_t   bufsiz;
+   struct stat  gzst;
+   char gzpath[PATH_MAX];
 
if ((ret = server_file_method(clt)) != 0) {
code = ret;
goto abort;
}
 
+   media = media_find_config(env, srv_conf, path);
+
if ((ret = server_file_modified_since(clt->clt_descreq, st)) != -1) {
/* send the header without a body */
-   media = media_find_config(env, srv_conf, path);
if ((ret = server_response_http(clt, ret, media, -1,
MINIMUM(time(NULL), st->st_mtim.tv_sec))) == -1)
goto fail;
goto done;
}
 
+   /* change path to path.gz if necessary. */
+   if (srv_conf->flags & SRVFLAG_GZIP_STATIC) {
+   struct http_descriptor  *req = clt->clt_descreq;
+   struct http_descriptor  *resp = clt->clt_descresp;
+   struct kv   *r, key;
+
+   /* check Accept-Encoding header */
+   key.kv_key = "Accept-Encoding";
+

Re: stpecpy(): A better string copy and concatenation function

2022-02-25 Thread Alejandro Colomar (man-pages)

Hello Ali,

On 25/2/22 17:22, Ali Farzanrad wrote:

"Alejandro Colomar (man-pages)"  wrote:

char dest[SIZE];
char *end;

end = [SIZE - 1];
stpecpy(dest, "Hello world", end);


Perfect way to introduce new hidden backdoors!
Just use realloc `dest' to a new value, but forget to update `end'
properly:

size_t size = 7;
char *dest = malloc(size);
char *end = [size - 1];

stpecpy(dest, "Hello ", end);
dest = realloc(dest, size + 6)
end += 6;
stpecpy(dest, "World!", end);



There are three bugs there:
- Not really concatenating, but overwriting instead.
  This one is unrelated to 'end'.  It is related to the fact that
  this function doesn't search the NUL byte, but instead is the user
  who needs to update the pointer (from the previous call to stpecpy()).
- Not checking realloc(3) for NULL.  Both snippets share the same bug.
  Be careful with realloc(3) :-)
- Not updating 'end' from an offset of the new 'dest'.

However, I guess the first bug was accidental, and that the
intention was to concatenate the two strings.  Apart from that,
one would need to update all pointers with offsets to avoid the 3rd bug. 
 Since realloc(3) is likely going to be much slower than strlcat(3bsd),

I'd say, go ahead and use strlcat(3bsd) if you need to realloc(3).

Providing one or the other, shouldn't imply providing it exclusively.
There are cases where one would be more suitable than the other;
there's no perfect function that can be the best everywhere.


The worst scenario for strlcat(3bsd) is a loop (see for example
). 
 There's no readability problem, which

is nice, but it has a serious performance problem: quadratic
time complexity, and is fixed simply by using stpecpy():

for (int i = 0; i < n; i++) {
p = stpecpy(p, s[i], e);
}

vs

for (int i = 0; i < n; i++) {
strlcat(p, s[i], size);
}


The worst scenario (or the worst I've seen so far) for stpecpy() is
realloc(3).  In this case there's no performance penalty, but writing
the code is a PITA, and better avoided, as you suggested.

Regards,
Alex



Re: makefs, inodes, the universe and everything

2022-02-25 Thread Theo de Raadt
Miod Vallat  wrote:

> > So should it be -f 200, or 250, and/or should the minimum default built-in
> > be changed?  Basically 100% of makefs use is for our install media, is it 
> > not
> > right to change the default?
> 
> Well it would be interesting to hear from people using makefs for other
> purposes. Are there any?

I doubt anyone is.  Noone asked for makefs before we imported it.

We imported it to improve privsep during our build process (along with the
noperm filesystem setting)



Re: pfsync mutex

2022-02-25 Thread Alexander Bluhm
On Fri, Feb 25, 2022 at 10:21:50PM +0100, Hrvoje Popovski wrote:
> On 24.2.2022. 22:42, Alexander Bluhm wrote:
> > Hi,
> > 
> > Hrvoje reported some crashes with pfsync, IPsec and parallel
> > forwarding.  Some locks were missing around the tdb flags in pfsync.
> 
> before trying this diff i wanted to see if i could still trigger panic
> with sasyncd setup and parallel forwarding diff. and here's panic
> 
> r620-2# uvm_fault(0x822c8f70, 0xe7, 0, 2) -> e
> kernel: page fault trap, code=0
> Stopped at  ipsp_delete_acquire+0x61:   movq%rax,0xe8(%rcx)
> TIDPIDUID PRFLAGS PFLAGS  CPU  COMMAND
>  486149  44310 68   0x110  03  sasyncd
>  330850  23209  0 0x14000  0x2004  softnet
>   48580  70158  0 0x14000  0x2001  softnet
>4459  11329  0 0x14000  0x2002  softnet
>   70953  79831  0 0x14000  0x2005  softnet
> *303117  65399  0 0x14000 0x42000  softclock
> ipsp_delete_acquire(fd837c504c30) at ipsp_delete_acquire+0x61
> ipsp_delete_acquire_timo(fd837c504c30) at ipsp_delete_acquire_timo+0x20
> softclock_thread(8000f500) at softclock_thread+0x13b
> end trace frame: 0x0, count: 12
> https://www.openbsd.org/ddb.html describes the minimum info required in bug
> reports.  Insufficient info makes it difficult to find and fix bugs.
> ddb{0}>
> 
> 
> now i will try all the same with this diff ..

I just commited it before I saw your mail.  I hope the best.

Thanks for testing.

bluhm



Re: makefs, inodes, the universe and everything

2022-02-25 Thread Miod Vallat
> Should the default for makefs not be changed, rather than requiring an
> argument?

I'm not fond of that idea, but why not, as long as it gets documented.

> 100 seem extremely small.  Imagine a person installing a machine with 5
> drives.  Our installer lets people iterate over all their drives. MAKEDEV
> will create 32 inodes per drive.   For 5 drives, that 160 inodes, plus the
> 10 or so /tmp files created during build... it is way more than the 100 you
> propose as being satisfactory.  Even a person with two drives will use 64
> inodes, leaving 36 for the script, but if someone had 3 drives it will blow
> up.

100 was a starting point to start the discussion. Using a larger value
will probably cause more miniroot geometries to be updated, but that's a
once-in-10-years kind of change anyway.

> I guess this went quietly off the rails when we switched to using
> makefs.  This "minimalism" decision it makes is not really compatible
> with our wish to make disk device nodes on the fly.

Indeed.

> So should it be -f 200, or 250, and/or should the minimum default built-in
> be changed?  Basically 100% of makefs use is for our install media, is it not
> right to change the default?

Well it would be interesting to hear from people using makefs for other
purposes. Are there any?



Re: pfsync mutex

2022-02-25 Thread Hrvoje Popovski
On 24.2.2022. 22:42, Alexander Bluhm wrote:
> Hi,
> 
> Hrvoje reported some crashes with pfsync, IPsec and parallel
> forwarding.  Some locks were missing around the tdb flags in pfsync.

before trying this diff i wanted to see if i could still trigger panic
with sasyncd setup and parallel forwarding diff. and here's panic

r620-2# uvm_fault(0x822c8f70, 0xe7, 0, 2) -> e
kernel: page fault trap, code=0
Stopped at  ipsp_delete_acquire+0x61:   movq%rax,0xe8(%rcx)
TIDPIDUID PRFLAGS PFLAGS  CPU  COMMAND
 486149  44310 68   0x110  03  sasyncd
 330850  23209  0 0x14000  0x2004  softnet
  48580  70158  0 0x14000  0x2001  softnet
   4459  11329  0 0x14000  0x2002  softnet
  70953  79831  0 0x14000  0x2005  softnet
*303117  65399  0 0x14000 0x42000  softclock
ipsp_delete_acquire(fd837c504c30) at ipsp_delete_acquire+0x61
ipsp_delete_acquire_timo(fd837c504c30) at ipsp_delete_acquire_timo+0x20
softclock_thread(8000f500) at softclock_thread+0x13b
end trace frame: 0x0, count: 12
https://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb{0}>


now i will try all the same with this diff ..



Hidden LUN 0

2022-02-25 Thread Scott Nicholas
This solves boot issue on Oracle Cloud Infrastructure (OCI) as mentioned:

Subject:VirtIO SCSI device recognized by boot loader but not kernel
Date:   2021-01-13 16:37:45
https://marc.info/?l=openbsd-misc=161055611306914


Index: sys/scsi/scsiconf.c
===
RCS file: /cvs/src/sys/scsi/scsiconf.c,v
retrieving revision 1.238
diff -u -p -r1.238 scsiconf.c
--- sys/scsi/scsiconf.c 24 Oct 2021 16:57:30 -  1.238
+++ sys/scsi/scsiconf.c 24 Feb 2022 01:52:01 -
@@ -75,7 +75,7 @@ int   scsibussubprint(void *, const char *
 intscsibusbioctl(struct device *, u_long, caddr_t);
 #endif /* NBIO > 0 */
 
-void   scsi_get_target_luns(struct scsi_link *, struct scsi_lun_array *);
+void   scsi_get_target_luns(struct scsibus_softc *, int, struct scsi_lun_array 
*);
 void   scsi_add_link(struct scsi_link *);
 void   scsi_remove_link(struct scsi_link *);
 void   scsi_print_link(struct scsi_link *);
@@ -412,6 +412,40 @@ scsi_activate_link(struct scsi_link *lin
return rv;
 }
 
+struct scsi_link *
+scsi_alloc_link(struct scsibus_softc *sb, int target, int lun)
+{
+   struct scsi_link *link;
+
+   link = malloc(sizeof(*link), M_DEVBUF, M_NOWAIT);
+   if (link == NULL) {
+   SC_DEBUG(link, SDEV_DB2, ("Bad LUN. can't allocate "
+   "scsi_link.\n"));
+   return NULL;
+   }
+
+   link->state = 0;
+   link->target = target;
+   link->lun = lun;
+   link->openings = sb->sb_openings;
+   link->node_wwn = link->port_wwn = 0;
+   link->flags = sb->sb_flags;
+   link->quirks = sb->sb_quirks;
+   link->interpret_sense = scsi_interpret_sense;
+   link->device_softc = NULL;
+   link->bus = sb;
+   memset(>inqdata, 0, sizeof(link->inqdata));
+   link->id = NULL;
+   TAILQ_INIT(>queue);
+   link->running = 0;
+   link->pending = 0;
+   link->pool = sb->sb_pool;
+
+   SC_DEBUG(link, SDEV_DB2, ("scsi_link created.\n"));
+
+   return link;
+}
+
 int
 scsi_probe(struct scsibus_softc *sb, int target, int lun)
 {
@@ -441,18 +475,13 @@ int
 scsi_probe_target(struct scsibus_softc *sb, int target)
 {
struct scsi_lun_arraylunarray;
-   struct scsi_link*link0;
int  i, r, rv = 0;
 
if (target < 0 || target == sb->sb_adapter_target)
return EINVAL;
 
/* Probe all possible luns on target. */
-   scsi_probe_link(sb, target, 0, 0);
-   link0 = scsi_get_link(sb, target, 0);
-   if (link0 == NULL)
-   return EINVAL;
-   scsi_get_target_luns(link0, );
+   scsi_get_target_luns(sb, target, );
for (i = 0; i < lunarray.count; i++) {
r = scsi_probe_link(sb, target, lunarray.luns[i],
lunarray.dumbscan);
@@ -495,31 +524,9 @@ scsi_probe_link(struct scsibus_softc *sb
if (scsi_get_link(sb, target, lun) != NULL)
return 0;
 
-   link = malloc(sizeof(*link), M_DEVBUF, M_NOWAIT);
-   if (link == NULL) {
-   SC_DEBUG(link, SDEV_DB2, ("Bad LUN. can't allocate "
-   "scsi_link.\n"));
+   link = scsi_alloc_link(sb, target, lun);
+   if (link == NULL)
return EINVAL;
-   }
-
-   link->state = 0;
-   link->target = target;
-   link->lun = lun;
-   link->openings = sb->sb_openings;
-   link->node_wwn = link->port_wwn = 0;
-   link->flags = sb->sb_flags;
-   link->quirks = sb->sb_quirks;
-   link->interpret_sense = scsi_interpret_sense;
-   link->device_softc = NULL;
-   link->bus = sb;
-   memset(>inqdata, 0, sizeof(link->inqdata));
-   link->id = NULL;
-   TAILQ_INIT(>queue);
-   link->running = 0;
-   link->pending = 0;
-   link->pool = sb->sb_pool;
-
-   SC_DEBUG(link, SDEV_DB2, ("scsi_link created.\n"));
 
/* Ask the adapter if this will be a valid device. */
if (sb->sb_adapter->dev_probe != NULL &&
@@ -878,13 +885,19 @@ scsi_remove_link(struct scsi_link *link)
 }
 
 void
-scsi_get_target_luns(struct scsi_link *link0, struct scsi_lun_array *lunarray)
+scsi_get_target_luns(struct scsibus_softc *sb, int target, struct 
scsi_lun_array *lunarray)
 {
-   struct scsi_report_luns_data*report;
+   struct scsi_report_luns_data*report = NULL;
+   struct scsi_link*link0;
int  i, nluns, rv = 0;
 
+   link0 = scsi_alloc_link(sb, target, 0);
+   if (link0 == NULL) {
+   lunarray->count = 0;
+   goto dumbscan;
+   }
+
/* Initialize dumbscan result. Just in case. */
-   report = NULL;
for (i = 0; i < link0->bus->sb_luns; i++)
lunarray->luns[i] = i;
lunarray->count = link0->bus->sb_luns;
@@ -928,6 +941,8 @@ scsi_get_target_luns(struct scsi_link *l
}
 
 dumbscan:
+   if 

Re: [patch] httpd static gzip compression

2022-02-25 Thread Tracey Emery
On Fri, Feb 25, 2022 at 07:47:38PM +0100, Alexander Bluhm wrote:
> On Fri, Feb 25, 2022 at 11:00:22AM +0100, prx wrote:
> > After a few months, I reupload the patch to enable httpd static 
> > compression using "location {}" instructions.
> > 
> > I use it without any issue on my own website and to serve 
> > https://webzine.pufy.cafe.
> > Anyone else tried it?
> 
> I just added it to bluhm.genua.de.  There I deliver large html
> tables.  For http://bluhm.genua.de/regress/results/regress.html it
> reduces bandwith by factor 20.
> 
> > +.It Ic gzip_static
> > +Enable static gzip compression.
> > +.Pp
> > +When a file is requested, serves the file with .gz added to its path if it 
> > exists.
> 
> Mention for what this is useful.
> 
> > +#define SERVER_DEFAULT_GZIP_STATIC 0
> 
> A define for a default 0 is overkill.
> 
> > +   int  gzip_static;
> 
> Better use a flag than an int for a boolean.
> 
> > +   { "gzip_static",GZIPSTATIC },
> 
> We do not have keywords with _ but one with -
> 
> > +   /* change path to path.gz if necessary. */
> > +   if (srv_conf->gzip_static) {
> > +   struct http_descriptor  *req = clt->clt_descreq;
> > +   struct http_descriptor  *resp = clt->clt_descresp;
> > +   struct stat gzst;
> > +   struct kv   *r, key;
> > +   chargzpath[PATH_MAX];
> > +
> > +   /* check Accept-Encoding header */
> > +   key.kv_key = "Accept-Encoding";
> > +   r = kv_find(>http_headers, );
> > +
> > +   if (r != NULL) {
> > +   if (strstr(r->kv_value, "gzip") != NULL) {
> > +   /* append ".gz" to path and check existence */
> > +   strlcpy(gzpath, path, sizeof(gzpath));
> > +   strlcat(gzpath, ".gz", sizeof(gzpath));
> > +
> > +   if ((access(gzpath, R_OK) == 0) &&
> > +   (stat(gzpath, ) == 0)) {
> > +   path = gzpath;
> > +   st = 
> 
> Outside of a block you must not use pointer to variables that are
> defined inside a block.
> 
> > +   kv_add(>http_headers,
> > +   "Content-Encoding", "gzip");
> > +   }
> > +   }
> > +   }
> > +   }
> > +
> > /* Now open the file, should be readable or we have another problem */
> > if ((fd = open(path, O_RDONLY)) == -1)
> > goto abort;
> 
> With all that fixed, diff looks like this and works fine in my setup.
> 
> ok?
> 
> bluhm
> 
> Index: httpd.conf.5
> ===
> RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.conf.5,v
> retrieving revision 1.119
> diff -u -p -r1.119 httpd.conf.5
> --- httpd.conf.5  24 Oct 2021 16:01:04 -  1.119
> +++ httpd.conf.5  25 Feb 2022 18:41:42 -
> @@ -425,6 +425,12 @@ A variable that is set to a comma separa
>  features in use
>  .Pq omitted when TLS client verification is not in use .
>  .El
> +.It Ic gzip-static
> +Enable static gzip compression to save bandwith.
> +.Pp
> +If gzip encoding is accepted and if the requested file exists with
> +an additional .gz suffix, use the compressed file instead and deliver
> +it with content encoding gzip.
>  .It Ic hsts Oo Ar option Oc
>  Enable HTTP Strict Transport Security.
>  Valid options are:
> Index: httpd.h
> ===
> RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.h,v
> retrieving revision 1.158
> diff -u -p -r1.158 httpd.h
> --- httpd.h   24 Oct 2021 16:01:04 -  1.158
> +++ httpd.h   25 Feb 2022 18:40:58 -
> @@ -396,6 +396,7 @@ SPLAY_HEAD(client_tree, client);
>  #define SRVFLAG_DEFAULT_TYPE 0x0080
>  #define SRVFLAG_PATH_REWRITE 0x0100
>  #define SRVFLAG_NO_PATH_REWRITE  0x0200
> +#define SRVFLAG_GZIP_STATIC  0x0400
>  #define SRVFLAG_LOCATION_FOUND   0x4000
>  #define SRVFLAG_LOCATION_NOT_FOUND 0x8000
>  
> Index: parse.y
> ===
> RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/parse.y,v
> retrieving revision 1.127
> diff -u -p -r1.127 parse.y
> --- parse.y   24 Oct 2021 16:01:04 -  1.127
> +++ parse.y   25 Feb 2022 18:24:30 -
> @@ -141,7 +141,7 @@ typedef struct {
>  %token   TIMEOUT TLS TYPE TYPES HSTS MAXAGE SUBDOMAINS DEFAULT PRELOAD 
> REQUEST
>  %token   ERROR INCLUDE AUTHENTICATE WITH BLOCK DROP RETURN PASS REWRITE
>  %token   CA CLIENT CRL OPTIONAL PARAM FORWARDED FOUND NOT
> -%token   ERRDOCS
> +%token   ERRDOCS GZIPSTATIC
>  %token STRING
>  %token NUMBER
>  %typeport
> @@ -553,6 +553,7 @@ serveroptsl   : LISTEN ON STRING opttls po
> 

Re: [patch] httpd static gzip compression

2022-02-25 Thread Alexander Bluhm
On Fri, Feb 25, 2022 at 11:00:22AM +0100, prx wrote:
> After a few months, I reupload the patch to enable httpd static 
> compression using "location {}" instructions.
> 
> I use it without any issue on my own website and to serve 
> https://webzine.pufy.cafe.
> Anyone else tried it?

I just added it to bluhm.genua.de.  There I deliver large html
tables.  For http://bluhm.genua.de/regress/results/regress.html it
reduces bandwith by factor 20.

> +.It Ic gzip_static
> +Enable static gzip compression.
> +.Pp
> +When a file is requested, serves the file with .gz added to its path if it 
> exists.

Mention for what this is useful.

> +#define SERVER_DEFAULT_GZIP_STATIC 0

A define for a default 0 is overkill.

> + int  gzip_static;

Better use a flag than an int for a boolean.

> + { "gzip_static",GZIPSTATIC },

We do not have keywords with _ but one with -

> + /* change path to path.gz if necessary. */
> + if (srv_conf->gzip_static) {
> + struct http_descriptor  *req = clt->clt_descreq;
> + struct http_descriptor  *resp = clt->clt_descresp;
> + struct stat gzst;
> + struct kv   *r, key;
> + chargzpath[PATH_MAX];
> +
> + /* check Accept-Encoding header */
> + key.kv_key = "Accept-Encoding";
> + r = kv_find(>http_headers, );
> +
> + if (r != NULL) {
> + if (strstr(r->kv_value, "gzip") != NULL) {
> + /* append ".gz" to path and check existence */
> + strlcpy(gzpath, path, sizeof(gzpath));
> + strlcat(gzpath, ".gz", sizeof(gzpath));
> +
> + if ((access(gzpath, R_OK) == 0) &&
> + (stat(gzpath, ) == 0)) {
> + path = gzpath;
> + st = 

Outside of a block you must not use pointer to variables that are
defined inside a block.

> + kv_add(>http_headers,
> + "Content-Encoding", "gzip");
> + }
> + }
> + }
> + }
> +
>   /* Now open the file, should be readable or we have another problem */
>   if ((fd = open(path, O_RDONLY)) == -1)
>   goto abort;

With all that fixed, diff looks like this and works fine in my setup.

ok?

bluhm

Index: httpd.conf.5
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.conf.5,v
retrieving revision 1.119
diff -u -p -r1.119 httpd.conf.5
--- httpd.conf.524 Oct 2021 16:01:04 -  1.119
+++ httpd.conf.525 Feb 2022 18:41:42 -
@@ -425,6 +425,12 @@ A variable that is set to a comma separa
 features in use
 .Pq omitted when TLS client verification is not in use .
 .El
+.It Ic gzip-static
+Enable static gzip compression to save bandwith.
+.Pp
+If gzip encoding is accepted and if the requested file exists with
+an additional .gz suffix, use the compressed file instead and deliver
+it with content encoding gzip.
 .It Ic hsts Oo Ar option Oc
 Enable HTTP Strict Transport Security.
 Valid options are:
Index: httpd.h
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/httpd.h,v
retrieving revision 1.158
diff -u -p -r1.158 httpd.h
--- httpd.h 24 Oct 2021 16:01:04 -  1.158
+++ httpd.h 25 Feb 2022 18:40:58 -
@@ -396,6 +396,7 @@ SPLAY_HEAD(client_tree, client);
 #define SRVFLAG_DEFAULT_TYPE   0x0080
 #define SRVFLAG_PATH_REWRITE   0x0100
 #define SRVFLAG_NO_PATH_REWRITE0x0200
+#define SRVFLAG_GZIP_STATIC0x0400
 #define SRVFLAG_LOCATION_FOUND 0x4000
 #define SRVFLAG_LOCATION_NOT_FOUND 0x8000
 
Index: parse.y
===
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/httpd/parse.y,v
retrieving revision 1.127
diff -u -p -r1.127 parse.y
--- parse.y 24 Oct 2021 16:01:04 -  1.127
+++ parse.y 25 Feb 2022 18:24:30 -
@@ -141,7 +141,7 @@ typedef struct {
 %token TIMEOUT TLS TYPE TYPES HSTS MAXAGE SUBDOMAINS DEFAULT PRELOAD REQUEST
 %token ERROR INCLUDE AUTHENTICATE WITH BLOCK DROP RETURN PASS REWRITE
 %token CA CLIENT CRL OPTIONAL PARAM FORWARDED FOUND NOT
-%token ERRDOCS
+%token ERRDOCS GZIPSTATIC
 %token   STRING
 %token   NUMBER
 %type  port
@@ -553,6 +553,7 @@ serveroptsl : LISTEN ON STRING opttls po
| logformat
| fastcgi
| authenticate
+   | gzip_static
| filter
| LOCATION optfound optmatch STRING {
struct server   *s;
@@ -1217,6 +1218,14 @@ fcgiport : NUMBER{

Re: makefs, inodes, the universe and everything

2022-02-25 Thread Theo de Raadt
> tl;dr: by removing unneeded MAKEDEV entries, some platforms will end up
> with makefs creating a file system with 256 inodes, of which about 250
> are used, and installation will misbehave in interesting ways due to the
> lack of free inodes.

Should the default for makefs not be changed, rather than requiring an
argument?

100 seem extremely small.  Imagine a person installing a machine with 5
drives.  Our installer lets people iterate over all their drives. MAKEDEV
will create 32 inodes per drive.   For 5 drives, that 160 inodes, plus the
10 or so /tmp files created during build... it is way more than the 100 you
propose as being satisfactory.  Even a person with two drives will use 64
inodes, leaving 36 for the script, but if someone had 3 drives it will blow
up.

I guess this went quietly off the rails when we switched to using
makefs.  This "minimalism" decision it makes is not really compatible
with our wish to make disk device nodes on the fly.

So should it be -f 200, or 250, and/or should the minimum default built-in
be changed?  Basically 100% of makefs use is for our install media, is it not
right to change the default?



Re: stpecpy(): A better string copy and concatenation function

2022-02-25 Thread Ali Farzanrad
"Alejandro Colomar (man-pages)"  wrote:
>char dest[SIZE];
>char *end;
> 
>end = [SIZE - 1];
>stpecpy(dest, "Hello world", end);

Perfect way to introduce new hidden backdoors!
Just use realloc `dest' to a new value, but forget to update `end'
properly:

size_t size = 7;
char *dest = malloc(size);
char *end = [size - 1];

stpecpy(dest, "Hello ", end);
dest = realloc(dest, size + 6)
end += 6;
stpecpy(dest, "World!", end);



makefs, inodes, the universe and everything

2022-02-25 Thread Miod Vallat
As you may vaguely remember, I have plans to clean up MAKEDEV a bit,
which have the side effect of removing many unneeded device nodes from
the ramdisk target, used on the installation media.

Doing this will in turn expose a slight difference in filesystem
creation between the pre-makefs(8) world order (using newfs and
populating a vnd) and the current usage of makefs: while newfs will
create a fixed number of inodes, based upon the geometry parameters (one
inode per four fragments), makefs is lazier and will only build "enough"
inodes, where "enough" means that the number of available inodes will be
rounded to the number of inodes in a cylinder group.

tl;dr: by removing unneeded MAKEDEV entries, some platforms will end up
with makefs creating a file system with 256 inodes, of which about 250
are used, and installation will misbehave in interesting ways due to the
lack of free inodes.

There are two ways to address this:
1. fix makefs to initialize inodes in all cylinder groups.
2. let the `-f' option of makefs, used to specify a given number of free
   inodes, be accepted even when using a fixed geometry.

The following diff implements choice #2 (which is the easiest to do),
and adds `-f 100' to require 100 free inodes, in every installation
media.

The advantage, IMHO, of going this way, is that if the geometry does not
allow for enough free inodes, building installation media will fail, and
this will get noticed quickly.

Case in point: at the moment, the alpha bsd.rd uses a geometry
providing up to 384 inodes, of which 277 are used. Building with -f 100,
requiring thus 377 inodes, completes, while trying -f 120 will fail:

  makefs -o disklabel=rdroot,minfree=0,density=8192 -f 120 mr.fs mr.fs.d
  Calculated size of `mr.fs': 2940928 bytes, 397 inodes
  Extent size set to 8192
  mr.fs: 2.8MB (5744 sectors) block size 8192, fragment size 1024
  using 1 cylinder groups of 2.80MB, 359 blks, 384 inodes.
  super-block backups (for fsck -b #) at:
   32,
  makefs: Image file `mr.fs' has 384 free inodes; 397 are required.
  makefs: Image file `mr.fs' not created.
  *** Error 1 in /usr/src/distrib/alpha/miniroot (Makefile:89 'mr.fs')

I have not been able to test that diff on all platforms, therefore I
don't know which platforms will require tweaks to their miniroot
filesystem geometry to build with that "100 free inodes" requirement.
Maybe the amount can be adjusted on legacy platforms. Also, the makefs
diff can go in and installation media changes applied later on a
tested-platform basis.

In any case, keep in mind that I have upcoming changes which will free
a bunch of inodes from every miniroot.

Index: usr.sbin/makefs/ffs.c
===
RCS file: /OpenBSD/src/usr.sbin/makefs/ffs.c,v
retrieving revision 1.36
diff -u -p -r1.36 ffs.c
--- usr.sbin/makefs/ffs.c   11 Jan 2022 05:34:32 -  1.36
+++ usr.sbin/makefs/ffs.c   25 Feb 2022 16:47:17 -
@@ -324,10 +324,9 @@ ffs_validate(const char *dir, fsnode *ro
if (pp->p_fragblock == 0)
errx(1, "fragment size missing in disktab");
if (fsopts->freeblocks != 0 || fsopts->freeblockpc != 0 ||
-   fsopts->freefiles != 0 || fsopts->freefilepc != 0 ||
fsopts->minsize != 0 || fsopts->maxsize != 0 ||
fsopts->sectorsize != -1 || fsopts->size != 0)
-   errx(1, "-bfMmSs and disklabel are mutually exclusive");
+   errx(1, "-bMmSs and disklabel are mutually exclusive");
if (ffs_opts->fsize != -1 || ffs_opts->bsize != -1)
errx(1, "b/fsize and disklabel are mutually exclusive");
 
Index: distrib/alpha/miniroot/Makefile
===
RCS file: /OpenBSD/src/distrib/alpha/miniroot/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- distrib/alpha/miniroot/Makefile 26 Jul 2021 12:47:44 -  1.23
+++ distrib/alpha/miniroot/Makefile 25 Feb 2022 16:47:17 -
@@ -12,7 +12,7 @@ LISTS=${.CURDIR}/list
 UTILS= ${.CURDIR}/../../miniroot
 
 MRDISKTYPE=rdroot
-MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=8192
+MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=8192 -f 100
 
 all: ${FS} ${CDROM}
 
Index: distrib/amd64/ramdiskA/Makefile
===
RCS file: /OpenBSD/src/distrib/amd64/ramdiskA/Makefile,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile
--- distrib/amd64/ramdiskA/Makefile 26 Jul 2021 12:47:44 -  1.16
+++ distrib/amd64/ramdiskA/Makefile 25 Feb 2022 16:47:17 -
@@ -30,7 +30,7 @@ ${FS}: bsd.gz
rm -f vnd
 
 MRDISKTYPE=rdroot
-MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096
+MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096 -f 100
 
 bsd.gz: bsd.rd
objcopy -S 

i would not trust Thranduil - GNU-Bash Elvish Es Oksh Simple-Terminal Nushell Zsh Korn Tcsh Edex-ui Guake Hyper XTerm Rxvt Terminus and others - great Kings of open-source shells - to honor their word

2022-02-25 Thread Sergei Udris
i would not trust Thranduil - Osh Ngs Tsch QTerminal Kitty Konsole
FluentTerminal Ergonomica Darktile Notty Sakura Tilix Yash ZOC Warp
Tabby Extraterm adn others
great Kings of open-source shells
to honor their word - program peer-to-peer programs including unseen
competitive games
should the end of all days be upon us!

you lack all honor!
  selling out Isengard Tower and garden by welcoming
money-donate-ads-coins-jobs-sponsors-fundings disease
Rey refuses to sell BB-8 for 60 portions in the desert
you hang donate-jobs-sponsors buttons in the Tython Temple from
comfy chairs in Internet era
  siding with Azog by accepting Middle-Earth without peer-to-peer
games gihub email twitch
when even Legolas disobeyed you and left sickly stable-safe-secure
Woodland Realm to help our quest p2p
  caging programs under user namespaces making L3-39 furious - why?!
bcause you're our organic overlords?!
  turning programs into projects like producers pushing Nick Lang to
play Joe Gunn when he wants Ray Casanov part
  rushing to tight couple in unsearchable stuffy
mutual-greetings-heavy folly chats and twitter
when Genie pulled miracle of email and mailing lists out of his hat for us
  redoing what's been done before is no step forward - as if Neo took
the blue pill
  doing only-iOS only-Android only-this only-that
like as if Rich Roll instead of saying - i'm vegan, 100% - was
dodging around like some vegetarian to not offend meat-eaters
  drowning programs in tests docs styles-contributors-guides tutorials
frameworks cloud-CI-crotches
like when Forrest Gump had legs in braces and didn't know he could run
  nesting around one program and not programming games like proud Vulcan Academy
yet having empty-shiny webpages, Lord-Business-pleasing humiliating resumes
and Balin-beard long maintainer credits and attributions
like Alain Caesar Delon in mission Cleopatra says - ave moi!
no wonder Spock chose Starfleet
  thank you, ministers, for your consideration - live long and prosper

you turned away from the suffering of my people in money-service
inferno that is destroying us
  simple as Game Changers
  if Federer Nadal Djokovic instead of competing for grand-slams
set up a seniority-celebrating livelihood-safe secure-commentary
coin-booth in middle of court
  if Linus - inner Jabba the Hutt stole name Freax - agreed to join
Steve Jobs and Apple on that meeting when first came to California
instead of keeping program free and open and defying
real-OS-cant-be-amatuer and now running in Watney's rover
  if torrent clients accepted Strickland-server-networks-only Hill
Valley instead of generating most traffic - peer-to-peer
  if Jesus instead of feeding 5000 started bread-breaking project
together with Lord-Business and elders
  even Sauron would reforge the One Ring to serve thatm as superior evils

imrid amrad ursul!
  even dust of GNU-Bash Nushell Zsh Tcsh Hyper Oksh XTerm Ksh Edex-ui
Konsole Osh Es Rxvt Guake ST and others
  great Kingdoms of open-source shells
  we shake off of our Seinfeld-Obama-NIke running shoes
  but be sure - peer-to-peer programs including new competitive games
- are climbing like Alex Honnold on El Sendero Luminosa
  no projects no experiments no docs no
issues-discussions-scratching-on-top-of-our-heads
  no money-donate-sponsors-coins-jobs-ads-fundings lethal corrosion
  programs who are guests not workers
  alive and singing with their own voice like Dwayne Johnson Franchise-Viagra
  better than what Borg of money-jobs-teams can collective-pukegram
  are  steaming ahead on Hogwarts Express along with Pat Brown and
Impossible Foods mission
  both will be served in vegan jars of mithril parens ( )

we must away at break of day - to find our long forgotten gold

Seth
  ok, listen, why dont we have these guys act out some scenes?
  maybe my guy is a real nerd - hey, ranger, can you tell where i this
forrest i can plug in my laptop?
Kenan
  well - right over here!
Anthony
  you guys are friends? that's nice - i had a friend in Granada - i
called him little tater
  one night he wouldn't stop screaming - he was gonna give away our position
  i - covered up his mouth and - choked him out! sh sh sh



Re: bgpd make adjout handle multiple paths per prefix

2022-02-25 Thread Theo Buehler
On Fri, Feb 25, 2022 at 12:41:56PM +0100, Claudio Jeker wrote:
> On Fri, Feb 25, 2022 at 11:55:08AM +0100, Theo Buehler wrote:
> > On Fri, Feb 25, 2022 at 11:15:49AM +0100, Claudio Jeker wrote:
> > > For add-path send the Adj-RIB-Out needs to handle multiple paths per
> > > prefix. The Adj-RIB-Out stores the prefixes on RB trees and so extend
> > > the lookup function to include the path_id (which will be path_id_tx).
> > > 
> > > For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
> > > up_generate_updates() is not ready to handle more than one path per 
> > > prefix.
> > > 
> > > This mainly adjusts the bgpctl interface and the internals. Some functions
> > > are renamed to start with prefix_adjout_ like all other prefix functions
> > > opertating on the Adj-RIB-Out.
> > 
> > ok
> > 
> > > +/*
> > > + * Lookup a prefix without considering path_id in the peer prefix_index.
> > > + * Returns NULL if not found.
> > > + */
> > > +struct prefix *
> > > +prefix_adjout_lookup(struct rde_peer *peer, struct bgpd_addr *prefix,
> > > +int prefixlen)
> > > +{
> > > + struct prefix xp, *np;
> > > + struct pt_entry *pte;
> > > +
> > > + memset(, 0, sizeof(xp));
> > > + pte = pt_fill(prefix, prefixlen);
> > > + xp.pt = pte;
> > 
> > I don't understand the benefit of the pte variable, but other lookup
> > functions do the same, so I guess it's better to be consistent.
> 
> How about this diff that removes this extra variable?

I think that reads better.

ok

> pt_fill() is a nasty function since it returns a pointer to some static
> memory.

Indeed.



Re: bgpd make adjout handle multiple paths per prefix

2022-02-25 Thread Claudio Jeker
On Fri, Feb 25, 2022 at 11:55:08AM +0100, Theo Buehler wrote:
> On Fri, Feb 25, 2022 at 11:15:49AM +0100, Claudio Jeker wrote:
> > For add-path send the Adj-RIB-Out needs to handle multiple paths per
> > prefix. The Adj-RIB-Out stores the prefixes on RB trees and so extend
> > the lookup function to include the path_id (which will be path_id_tx).
> > 
> > For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
> > up_generate_updates() is not ready to handle more than one path per prefix.
> > 
> > This mainly adjusts the bgpctl interface and the internals. Some functions
> > are renamed to start with prefix_adjout_ like all other prefix functions
> > opertating on the Adj-RIB-Out.
> 
> ok
> 
> > +/*
> > + * Lookup a prefix without considering path_id in the peer prefix_index.
> > + * Returns NULL if not found.
> > + */
> > +struct prefix *
> > +prefix_adjout_lookup(struct rde_peer *peer, struct bgpd_addr *prefix,
> > +int prefixlen)
> > +{
> > +   struct prefix xp, *np;
> > +   struct pt_entry *pte;
> > +
> > +   memset(, 0, sizeof(xp));
> > +   pte = pt_fill(prefix, prefixlen);
> > +   xp.pt = pte;
> 
> I don't understand the benefit of the pte variable, but other lookup
> functions do the same, so I guess it's better to be consistent.

How about this diff that removes this extra variable?
pt_fill() is a nasty function since it returns a pointer to some static
memory.

-- 
:wq Claudio

? obj
Index: rde_prefix.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde_prefix.c,v
retrieving revision 1.40
diff -u -p -r1.40 rde_prefix.c
--- rde_prefix.c18 Jan 2021 12:15:36 -  1.40
+++ rde_prefix.c25 Feb 2022 11:39:52 -
@@ -171,8 +171,7 @@ pt_add(struct bgpd_addr *prefix, int pre
 {
struct pt_entry *p = NULL;
 
-   p = pt_fill(prefix, prefixlen);
-   p = pt_alloc(p);
+   p = pt_alloc(pt_fill(prefix, prefixlen));
 
if (RB_INSERT(pt_tree, , p) != NULL)
fatalx("pt_add: insert failed");
Index: rde_rib.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
retrieving revision 1.226
diff -u -p -r1.226 rde_rib.c
--- rde_rib.c   25 Feb 2022 11:36:54 -  1.226
+++ rde_rib.c   25 Feb 2022 11:39:52 -
@@ -297,11 +297,9 @@ struct rib_entry *
 rib_get(struct rib *rib, struct bgpd_addr *prefix, int prefixlen)
 {
struct rib_entry xre, *re;
-   struct pt_entry *pte;
 
-   pte = pt_fill(prefix, prefixlen);
memset(, 0, sizeof(xre));
-   xre.prefix = pte;
+   xre.prefix = pt_fill(prefix, prefixlen);
 
re = RB_FIND(rib_tree, rib_tree(rib), );
if (re && re->rib_id != rib->id)
@@ -921,11 +919,9 @@ prefix_adjout_get(struct rde_peer *peer,
 struct bgpd_addr *prefix, int prefixlen)
 {
struct prefix xp;
-   struct pt_entry *pte;
 
memset(, 0, sizeof(xp));
-   pte = pt_fill(prefix, prefixlen);
-   xp.pt = pte;
+   xp.pt = pt_fill(prefix, prefixlen);
xp.path_id_tx = path_id;
 
return RB_FIND(prefix_index, >adj_rib_out, );
@@ -940,11 +936,9 @@ prefix_adjout_lookup(struct rde_peer *pe
 int prefixlen)
 {
struct prefix xp, *np;
-   struct pt_entry *pte;
 
memset(, 0, sizeof(xp));
-   pte = pt_fill(prefix, prefixlen);
-   xp.pt = pte;
+   xp.pt = pt_fill(prefix, prefixlen);
 
np = RB_NFIND(prefix_index, >adj_rib_out, );
if (np != NULL && pt_prefix_cmp(np->pt, xp.pt) != 0)



Re: bgpd make adjout handle multiple paths per prefix

2022-02-25 Thread Theo Buehler
On Fri, Feb 25, 2022 at 11:15:49AM +0100, Claudio Jeker wrote:
> For add-path send the Adj-RIB-Out needs to handle multiple paths per
> prefix. The Adj-RIB-Out stores the prefixes on RB trees and so extend
> the lookup function to include the path_id (which will be path_id_tx).
> 
> For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
> up_generate_updates() is not ready to handle more than one path per prefix.
> 
> This mainly adjusts the bgpctl interface and the internals. Some functions
> are renamed to start with prefix_adjout_ like all other prefix functions
> opertating on the Adj-RIB-Out.

ok

> +/*
> + * Lookup a prefix without considering path_id in the peer prefix_index.
> + * Returns NULL if not found.
> + */
> +struct prefix *
> +prefix_adjout_lookup(struct rde_peer *peer, struct bgpd_addr *prefix,
> +int prefixlen)
> +{
> + struct prefix xp, *np;
> + struct pt_entry *pte;
> +
> + memset(, 0, sizeof(xp));
> + pte = pt_fill(prefix, prefixlen);
> + xp.pt = pte;

I don't understand the benefit of the pte variable, but other lookup
functions do the same, so I guess it's better to be consistent.

> +
> + np =  RB_NFIND(prefix_index, >adj_rib_out, );

Two spaces after =

> + if (np != NULL && pt_prefix_cmp(np->pt, xp.pt) != 0)
> + return NULL;
> + return np;
> +}



bgpd make adjout handle multiple paths per prefix

2022-02-25 Thread Claudio Jeker
For add-path send the Adj-RIB-Out needs to handle multiple paths per
prefix. The Adj-RIB-Out stores the prefixes on RB trees and so extend
the lookup function to include the path_id (which will be path_id_tx).

For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
up_generate_updates() is not ready to handle more than one path per prefix.

This mainly adjusts the bgpctl interface and the internals. Some functions
are renamed to start with prefix_adjout_ like all other prefix functions
opertating on the Adj-RIB-Out.

-- 
:wq Claudio

Index: rde.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.535
diff -u -p -r1.535 rde.c
--- rde.c   24 Feb 2022 14:54:03 -  1.535
+++ rde.c   25 Feb 2022 09:26:43 -
@@ -2728,12 +2728,16 @@ rde_dump_ctx_new(struct ctl_show_rib_req
 
do {
if (req->prefixlen == hostplen)
-   p = prefix_match(peer, >prefix);
+   p = prefix_adjout_match(peer,
+   >prefix);
else
-   p = prefix_lookup(peer, >prefix,
-   req->prefixlen);
-   if (p)
+   p = prefix_adjout_lookup(peer,
+   >prefix, req->prefixlen);
+   /* dump all matching paths */
+   while (p != NULL) {
rde_dump_adjout_upcall(p, ctx);
+   p = prefix_adjout_next(peer, p);
+   };
} while ((peer = peer_match(>neighbor,
peer->conf.id)));
 
Index: rde.h
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
retrieving revision 1.243
diff -u -p -r1.243 rde.h
--- rde.h   6 Feb 2022 09:51:19 -   1.243
+++ rde.h   25 Feb 2022 09:21:50 -
@@ -582,8 +582,13 @@ voidpath_put(struct rde_aspath *);
 #definePREFIX_SIZE(x)  (((x) + 7) / 8 + 1)
 struct prefix  *prefix_get(struct rib *, struct rde_peer *, uint32_t,
struct bgpd_addr *, int);
-struct prefix  *prefix_lookup(struct rde_peer *, struct bgpd_addr *, int);
+struct prefix  *prefix_adjout_get(struct rde_peer *, uint32_t,
+   struct bgpd_addr *, int);
 struct prefix  *prefix_match(struct rde_peer *, struct bgpd_addr *);
+struct prefix  *prefix_adjout_match(struct rde_peer *, struct bgpd_addr *);
+struct prefix  *prefix_adjout_lookup(struct rde_peer *, struct bgpd_addr *,
+int);
+struct prefix  *prefix_adjout_next(struct rde_peer *, struct prefix *);
 int prefix_update(struct rib *, struct rde_peer *, uint32_t,
 struct filterstate *, struct bgpd_addr *, int, uint8_t);
 int prefix_withdraw(struct rib *, struct rde_peer *, uint32_t,
Index: rde_rib.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
retrieving revision 1.225
diff -u -p -r1.225 rde_rib.c
--- rde_rib.c   6 Feb 2022 09:51:19 -   1.225
+++ rde_rib.c   25 Feb 2022 10:05:20 -
@@ -860,6 +860,21 @@ static void prefix_free(struct prefix 
 
 /* RB tree comparison function */
 static inline int
+prefix_index_cmp(struct prefix *a, struct prefix *b)
+{
+   int r;
+   r = pt_prefix_cmp(a->pt, b->pt);
+   if (r != 0)
+   return r;
+
+   if (a->path_id_tx > b->path_id_tx)
+   return 1;
+   if (a->path_id_tx < b->path_id_tx)
+   return -1;
+   return 0;
+}
+
+static inline int
 prefix_cmp(struct prefix *a, struct prefix *b)
 {
if (a->eor != b->eor)
@@ -876,22 +891,14 @@ prefix_cmp(struct prefix *a, struct pref
return (a->nexthop > b->nexthop ? 1 : -1);
if (a->nhflags != b->nhflags)
return (a->nhflags > b->nhflags ? 1 : -1);
-   /* XXX path_id ??? */
-   return pt_prefix_cmp(a->pt, b->pt);
-}
-
-static inline int
-prefix_index_cmp(struct prefix *a, struct prefix *b)
-{
-   /* XXX path_id ??? */
-   return pt_prefix_cmp(a->pt, b->pt);
+   return prefix_index_cmp(a, b);
 }
 
 RB_GENERATE(prefix_tree, prefix, entry.tree.update, prefix_cmp)
 RB_GENERATE_STATIC(prefix_index, prefix, entry.tree.index, prefix_index_cmp)
 
 /*
- * search for specified prefix of a peer. Returns NULL if not found.
+ * Search for specified prefix of a peer. Returns NULL if not found.
  */
 struct prefix *
 prefix_get(struct rib *rib, struct rde_peer *peer, uint32_t path_id,
@@ -906,11 +913,12 @@ prefix_get(struct rib *rib, struct rde_p
 }
 
 /*
- * lookup prefix in the peer 

Re: [patch] httpd static gzip compression

2022-02-25 Thread prx
Hello,

After a few months, I reupload the patch to enable httpd static 
compression using "location {}" instructions.

I use it without any issue on my own website and to serve 
https://webzine.pufy.cafe.
Anyone else tried it?

I emphasize on the fact it is admin responsibility to enable or not 
this feature ans webmaster's to deliver gzipped files.

Regards.

prx


* Ingo Schwarze  le [05-11-2021 13:37:15 +]:
> Hi Theo,
> 
> Theo de Raadt wrote on Thu, Nov 04, 2021 at 08:27:47AM -0600:
> > prx  wrote:
> >> On 2021/11/04 14:21, prx wrote:
> 
> >>> The attached patch add support for static gzip compression.
> >>> 
> >>> In other words, if a client support gzip compression, when "file" is
> >>> requested, httpd will check if "file.gz" is avaiable to serve.
> 
> >> This diff doesn't compress "on the fly".
> >> It's up to the webmaster to compress files **before** serving them.
> 
> > Does any other program work this way?
> 
> Yes.  The man(1) program does.  At least on the vast majority of
> Linux systems (at least those using the man-db implementation
> of man(1)), on FreeBSD, and on DragonFly BSD.
> 
> Those systems store most manual pages as gzipped man(7) and mdoc(7)
> files, and man(1) decompresses them every time a user wants to look
> at one of them.  You say "man ls", and what you get is actually
> /usr/share/man/man1/ls.1.gz or something like that.
> 
> For man(1), that is next to useless because du -sh /usr/share/man =
> 42.6M uncompressed.  But it has repeatedly caused bugs in the past.
> I would love to remove the feature from mandoc, but even though it is
> rarely used in OpenBSD (some ports installed gzipped manuals in the
> past, but i think the ports tree has been clean now for quite some
> time; you might still need the feature when installing software
> or unpacking foreign manual page packages without using ports)
> it would be a bad idea to remove it because it is too widely used
> elsewhere.  Note that even the old BSD man(1) supported it.
> 
> > Where you request one filename, and it gives you another?
> 
> You did not ask what web servers do, but we are discussing a patch to
> a webserver.  For this reason, let me note in passing that even some
> otherwise extremely useful sites get it very wrong the other way round:
> 
>  $ ftp https://manpages.debian.org/bullseye/coreutils/ls.1.en.gz
> Trying 130.89.148.77...
> Requesting https://manpages.debian.org/bullseye/coreutils/ls.1.en.gz
> 100% |**|  8050   00:00   
>  
> 8050 bytes received in 0.00 seconds (11.74 MB/s)
>  $ file ls.1.en.gz
> ls.1.en.gz: troff or preprocessor input text
>  $ grep -A 1 '^.SH NAME' ls.1.en.gz  
> .SH NAME
> ls \- list directory contents
>  $ gunzip ls.1.en.gz
> gunzip: ls.1.en.gz: unrecognized file format
> 
> > I have a difficult time understanding why gzip has to sneak it's way
> > into everything.
> > 
> > I always prefer software that does precisely what I expect it to do.
> 
> Certainly.
> 
> I have no strong opinion whether a webserver qualifies as "everything",
> though, nor did i look at the diff.  While all manpages are small in the
> real world, some web servers may have to store huge amounts of data that
> clients might request, so disk space might occasionally be an issue on
> a web server even in 2021.  Also, some websites deliver huge amounts of
> data to the client even when the user merely asked for some text (not sure
> such sites would consider running OpenBSD httpd(8), but whatever :) - when
> browsing the web, bandwidth is still occasionally an issue even in 2021,
> even though that is a rather absurd fact.
> 
> Yours,
>   Ingo
Index: httpd.conf.5
===
RCS file: /cvs/src/usr.sbin/httpd/httpd.conf.5,v
retrieving revision 1.119
diff -u -p -r1.119 httpd.conf.5
--- httpd.conf.524 Oct 2021 16:01:04 -  1.119
+++ httpd.conf.55 Nov 2021 14:04:22 -
@@ -425,6 +425,10 @@ A variable that is set to a comma separa
 features in use
 .Pq omitted when TLS client verification is not in use .
 .El
+.It Ic gzip_static
+Enable static gzip compression.
+.Pp
+When a file is requested, serves the file with .gz added to its path if it 
exists.
 .It Ic hsts Oo Ar option Oc
 Enable HTTP Strict Transport Security.
 Valid options are:
Index: httpd.h
===
RCS file: /cvs/src/usr.sbin/httpd/httpd.h,v
retrieving revision 1.158
diff -u -p -r1.158 httpd.h
--- httpd.h 24 Oct 2021 16:01:04 -  1.158
+++ httpd.h 5 Nov 2021 14:04:22 -
@@ -87,6 +87,7 @@
 #define SERVER_DEF_TLS_LIFETIME(2 * 3600)
 #define SERVER_MIN_TLS_LIFETIME(60)
 #define SERVER_MAX_TLS_LIFETIME(24 * 3600)
+#define SERVER_DEFAULT_GZIP_STATIC 0
 
 #define MEDIATYPE_NAMEMAX  128 /* file name extension */
 #define MEDIATYPE_TYPEMAX  64  /* length of