[Dnsmasq-discuss] Uppercase queries are forwarded differently depending on the protocol (tcp vs udp)

2022-09-14 Thread Dmitry Pasiukevich via Dnsmasq-discuss
Hi,

TLDR: DNS request to dnsmasq with upper-case domain is handled differently
if request is sent over TCP vs UDP

I run a server to forward "cluster.local" queries to another process:
/usr/sbin/dnsmasq-k--cache-size=1000--no-negcache--dns-forward-max=1500--log-facility=---server=/cluster.local/
127.0.0.1#10053--log-queries=extra--log-debug


dnsmasq 2.86 with IP 10.64.0.7

1. When I run:
dig +tcp kubernetes.default.svc.cluster.LOCAL @10.64.0.7

I get NOERROR but no data in the response. dnsmasq logs:
I0913 06:15:04.790606   1 nanny.go:146] dnsmasq[86]: 44065
10.64.1.4/33015 query[A] kubernetes.default.svc.CLUSTER.LOCAL from 10.64.1.4
I0913 06:15:04.851065   1 nanny.go:146] dnsmasq[86]: 44065
10.64.1.4/33015 forwarded kubernetes.default.svc.CLUSTER.LOCAL to
169.254.169.254

As you can see dnsmasq doesn't modify the domain. Because it's a
"CLUSTER.LOCAL" and not a "cluster.local" it's forwarded to the server
169.254.169.254 set in the /etc/resolv.conf. And not the
--server=/cluster.local/127.0.0.1#10053 

2. When I run exactly the same query but over UDP not TCP:
dig kubernetes.default.svc.CLUSTER.LOCAL @10.64.0.7

I get NOERROR and correct response:
kubernetes.default.svc.CLUSTER.LOCAL. 30 IN A   10.68.0.1

dnsmasq logs in this case:
I0913 06:19:20.820425   1 nanny.go:146] dnsmasq[11]: 44471
10.64.1.4/49622 query[A] kubernetes.default.svc.CLUSTER.LOCAL from 10.64.1.4
I0913 06:19:20.820866   1 nanny.go:146] dnsmasq[11]: 44471
10.64.1.4/49622 forwarded kubernetes.default.svc.cluster.local to 127.0.0.1

In this case the domain in the query is changed to the lower-case and it
matches "cluster.local" and forwards to 127.0.0.1 as expected.

3. When I run exactly the same query over TCP but fully lower-case it works
as well.

Is this a bug or intended behaviour or maybe I misunderstood the logs?
Thanks!
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Snapshot archives downloaded from gitweb are not versioned properly

2022-09-14 Thread Simon Kelley
Playing with this, going the other way and moving to just using 
%(describe) is good, since it vastly simplifies things.


The problem is that %(describe) is rather new, and as solving this 
problem means solving it on thekelleys.org.uk, which is running Debian 
stable, the yak has now morphed into "install latest git as a backport 
on Debian stable." More later.



Simon.


On 13/09/2022 09:10, Johnny S. Lee via Dnsmasq-discuss wrote:

How about something like the following?

diff --git a/VERSION b/VERSION
index 998eb1f..29a22f8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-$Format:%d$
+$Format:%d;%(describe)$
diff --git a/bld/get-version b/bld/get-version
index 1f51768..4ba3646 100755
--- a/bld/get-version
+++ b/bld/get-version
@@ -24,13 +24,19 @@ if which git >/dev/null 2>&1 && \
  ([ -d .git ] || grep '^gitdir:' .git >/dev/null 2>&1) && \
  git describe >/dev/null 2>&1; then
  git describe | sed 's/^v//'
-elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
+elif grep '\$Format:%d;%(describe)\$' $1/VERSION >/dev/null 2>&1; then
  # unsubstituted VERSION, but no git available.
  echo UNKNOWN
  else
- vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
+ vers=`cut -d';' -f1 $1/VERSION | sed 's/[(), ]/,/ g' | tr ','
'\n' | grep ^v[0-9]`
+ ret=$?

- if [ $? -eq 0 ]; then
+ if [ ${ret} -ne 0 ]; then
+ vers=`cut -d';' -f2 $1/VERSION | grep ^v[0-9]`
+ ret=$?
+ fi
+
+ if [ ${ret} -eq 0 ]; then
   echo "${vers}" | sort -k1.2,1.5Vr -k1.6,1.6 -k1.8,1.9Vr
-k1.10,1.11Vr | head -n 1 | sed 's/^v//'
   else
   cat $1/VERSION

This appends ";%(describe)" to the format.
The script will try to parse the contents of %d first, then %(describe).
This should have minimal impact.

On Tue, 13 Sept 2022 at 06:52, Johnny S. Lee <_...@jsl.io> wrote:



I'm not clear what the difference between that and %(describe) is. The
substituted value is used subtly in get-version as part of the
build-process, so we need to be a little careful about changing things.


$ git log -10 --format="'%d'"
' (HEAD -> master, origin/master, origin/HEAD)'
' (tag: v2.87rc1)'
''
''
''
''
''
''
''
' (tag: v2.87test9)'
$ git log -10 --format="'%(describe)'"
'v2.87rc1-1-gc4b9bc6'
'v2.87rc1'
'v2.87test9-7-g04cc2ae'
'v2.87test9-6-g32588c7'
'v2.87test9-5-g84a6d07'
'v2.87test9-4-gd6c69f6'
'v2.87test9-3-gce37291'
'v2.87test9-2-g09d741f'
'v2.87test9-1-g0666ae3'
'v2.87test9'

Output of get-version should be the same for tagged commits.
Note that the %(describe) placeholder is rather new. It was added in
Git 2.32 last year.


On Mon, 12 Sept 2022 at 23:19, Simon Kelley  wrote:



The current format is %d, which is

"ref names, like the --decorate option of git-log[1]"

according to git help log.

I'm not clear what the difference between that and %(describe) is. The
substituted value is used subtly in get-version as part of the
build-process, so we need to be a little careful about changing things.

When the build runs on a fully-fledged git repo, rather than a tar file
extracted from one, get-version does run "git describe". This isn't the
case during the automated build, however.


Simon.


On 12/09/2022 04:51, Johnny S. Lee via Dnsmasq-discuss wrote:

The contents of file VERSION from the tar.gz files of the latest 3 commits:

dnsmasq-c4b9bc6/VERSION: (HEAD -> master)
dnsmasq-4447d48/VERSION: (tag: v2.87rc1, origin/master, origin/HEAD)
dnsmasq-04cc2ae/VERSION:

Would it be better adding "%(describe)" to the format in file VERSION?

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss