Download raw body.
gotwebd.conf syntax change: "bind interface" -> "listen on"
On Sun, Aug 07, 2022 at 04:13:11PM +0200, Stefan Sperling wrote: > In gotwebd.conf, the argument for "bind interface" is a plain string. > The argument may in fact be an IP address or interface name. But the > syntax confused me into believing that only interface names could be used. > > I think if we used the same grammar as httpd.conf(8) is using, there Also bgpd.conf(5), smtpd.conf(5), relayd.conf(5), etc. > would be a lot less potential for confusion. Generally people will > be setting up httpd config and gotwebd.conf at the same time so it > would help if they used similar syntax. > > The gotwebd.cofn grammer even already contains an ON token, which > wasn't used yet. > > Lines such as these become a syntax error: > > bind interface em0 > bind interface 127.0.0.1 > > Instead, use: > > listen on em0 > listen on 127.0.0.1 > > ok? > > Currently, only one "listen on" statement is supported per gotwebd server. > This is a separate issue I intend to fix later, in order to allow configs > such as IPv4/IPv6 dual-stack server with specific addresses. OK kn > > diff 6381f44ae3383b12443d44a7a6a73459a809b069 bf757836b294600e5e0667c2ac0fddd1f9f3dac5 > commit - 6381f44ae3383b12443d44a7a6a73459a809b069 > commit + bf757836b294600e5e0667c2ac0fddd1f9f3dac5 > blob - ecce1768fa5b41babe7ad5226f47933e94aeaf64 > blob + b533dd484371ccaf0bb075196a1d7009d4058083 > --- gotwebd/parse.y > +++ gotwebd/parse.y > @@ -115,7 +115,7 @@ typedef struct { > > %} > > -%token BIND INTERFACE WWW_PATH MAX_REPOS SITE_NAME SITE_OWNER SITE_LINK LOGO > +%token LISTEN WWW_PATH MAX_REPOS SITE_NAME SITE_OWNER SITE_LINK LOGO > %token LOGO_URL SHOW_REPO_OWNER SHOW_REPO_AGE SHOW_REPO_DESCRIPTION > %token MAX_REPOS_DISPLAY REPOS_PATH MAX_COMMITS_DISPLAY ON ERROR > %token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK FCGI_SOCKET > @@ -381,7 +381,7 @@ serveropts2 : serveropts2 serveropts1 nl > | serveropts1 optnl > ; > > -socketopts1 : BIND INTERFACE STRING { > +socketopts1 : LISTEN ON STRING { > n = strlcpy(new_srv->fcgi_socket_bind, $3, > sizeof(new_srv->fcgi_socket_bind)); > if (n >= sizeof(new_srv->fcgi_socket_bind)) { > @@ -409,7 +409,7 @@ socketopts2 : socketopts2 socketopts1 nl > | socketopts1 optnl > ; > > -socketopts3 : BIND INTERFACE STRING { > +socketopts3 : LISTEN ON STRING { > n = strlcpy(gotwebd->fcgi_socket_bind, $3, > sizeof(gotwebd->fcgi_socket_bind)); > if (n >= sizeof(gotwebd->fcgi_socket_bind)) { > @@ -470,16 +470,16 @@ lookup(char *s) > { > /* This has to be sorted always. */ > static const struct keywords keywords[] = { > - { "bind", BIND }, > { "chroot", CHROOT }, > { "custom_css", CUSTOM_CSS }, > { "fcgi_socket", FCGI_SOCKET }, > - { "interface", INTERFACE }, > + { "listen", LISTEN }, > { "logo", LOGO }, > { "logo_url" , LOGO_URL }, > { "max_commits_display", MAX_COMMITS_DISPLAY }, > { "max_repos", MAX_REPOS }, > { "max_repos_display", MAX_REPOS_DISPLAY }, > + { "on", ON }, > { "port", PORT }, > { "prefork", PREFORK }, > { "repos_path", REPOS_PATH }, >
gotwebd.conf syntax change: "bind interface" -> "listen on"