Re: [Dnsmasq-discuss] [PATCH] dnsmasq unit tests!
On Thu, May 21, 2020 at 04:32:01PM +0200, Geert Stappers wrote: > On Thu, May 14, 2020 at 09:08:09PM +0200, Petr Menšík wrote: > > My previous message is waiting for moderation, since my patch is a big one. > > > > On 5/12/20 10:51 PM, Geert Stappers wrote: > > > On Mon, May 04, 2020 at 05:02:38PM +0200, Petr Menšík wrote: > > ... > > > > > > I think it is great to have unittests. > > > > > > > > > > > > To be continued ... > > OK, patch cleaned up, should apply without any warning now. > > > > Yes, works fine. Fixes the parameter count mismatch that was seen > earlier. One unittest failed as warned before. And yes indeed > the Harald Jensas's patch 'Fix regression in s_config_in_context() > method' does solve it. > > > Cheers > Geert Stappers > (Curious who also > says: "Unittests? Yes, have it in the dnsmasq source tree!" ) > Rewording my curiousity: Who would like to have unittests in the dnsmasq source tree AND has courage to express that? Groeten Geert Stappers -- stappers@alpaca:~/src/dnsmasq $ make check make: *** No rule to make target 'check'. Stop. stappers@alpaca:~/src/dnsmasq $ ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] [PATCH] Connection track mark based DNS query filtering.
On Fri, Jan 22, 2021 at 09:34:53PM +0100, Etan Kissling wrote: > This extends query filtering support beyond what is currently possible > with the `--ipset` configuration option, by adding support for: > 1) Specifying allowlists on a per-client basis, based on their >associated Linux connection track mark. > 2) Dynamic configuration of allowlists via Ubus. > 3) Reporting when a DNS query resolves or is rejected via Ubus. > 4) DNS name patterns containing wildcards. > > Disallowed queries are not forwarded; they are rejected > with a REFUSED error code. > > Signed-off-by: Etan Kissling > --- > Makefile | 2 +- > man/dnsmasq.8 | 31 +++- > src/dnsmasq.h | 25 +++- > src/forward.c | 123 +++- > src/option.c | 134 ++ > src/pattern.c | 386 ++ > src/rfc1035.c | 82 +++ > src/ubus.c| 182 > 8 files changed, 956 insertions(+), 9 deletions(-) > create mode 100644 src/pattern.c Found this while looking for another patch. Did see that no one did respond to the patch. I might be wrong about that due my archive my only point of view. What where other responses? Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] dnsmasq: dhcp-server with disabled dns-server: /etc/hosts ignored
On Fri, Oct 21, 2022 at 11:23:28PM +0200, Michael Traxler wrote: dnsmasq-2.87: When you disable the DNS-server via port=0 the /etc/hosts file is ignored and also the addn-hosts= is ignored. I've had the same feeling some time ago, with no resolution: https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2020q2/014063.html This then results in the problem, that the DHCP-server still works, but if you use the dhcp-host=da:7a:3a:62:7d:d2,trb where trb is a name in /etc/hosts dnsmasq reacts with: DHCPDISCOVER(enp2s0) da:7a:3a:62:7d:d2 no address available I checked via strace that it really doesn't even open /etc/hosts nor the given file via the "addn-hosts" option. Looks for me like a bug. I can not find a logical reason, why a dhcp-server *needs* to have a running DNS-server. Or is it a feature? :-) On 22.10.22 21:15, Geert Stappers via Dnsmasq-discuss wrote: Or an incomplete configuration file. So remove the 'port=0' (or comment it out) and check if the host with MAC-address gets the IP-address of trb. Turris OS (openwrt clone) released new version this week, I can check again when I get to it. However, changing port to non-zero helped in my case. I'm not very skilled in C, so I can only guess: src/cache.c seems to ignore hosts cache when port is set to 0 there may be of course different places the cache is filled #ifdef HAVE_DHCP struct in_addr a_record_from_hosts(char *name, time_t now) { struct crec *crecp = NULL; struct in_addr ret; /* If no DNS service, cache not initialised. */ if (daemon->port != 0) while ((crecp = cache_find_by_name(crecp, name, now, F_IPV4))) if (crecp->flags & F_HOSTS) return crecp->addr.addr4; my_syslog(MS_DHCP | LOG_WARNING, _("No IPv4 address found for %s"), name); ret.s_addr = 0; return ret; } -- Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Fighting for peace is like fucking for virginity... ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH 2/6] Removed trailing white spaces
From: Geert Stappers This was done by sed --in-place -e 's/[\t ]*$//' src/*.c src/*.h However, this is an **empty** commit, The diff would be too big for the mailinglist. The commit hash is needed for in .git-blame-ignore-revs ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH 5/6] Better description of Coding Style
From: Geert Stappers And the CS needs more tuning. --- .clang-format | 7 ++- CodingStyle | 7 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 75d465b..ada50d2 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,8 @@ +# +# Machine readable version of Dnsmasq Coding Style +# +# It is the program `clang-format`, that is supposed to read this YAML file. +# --- Language:Cpp AccessModifierOffset: -2 @@ -180,7 +185,7 @@ StatementMacros: - QT_REQUIRE_VERSION TabWidth:8 UseCRLF: false -UseTab: Never +UseTab: Always WhitespaceSensitiveMacros: - STRINGIZE - PP_STRINGIZE diff --git a/CodingStyle b/CodingStyle index 5457dd8..fb8c5b9 100644 --- a/CodingStyle +++ b/CodingStyle @@ -6,3 +6,10 @@ We indent by 2 spaces. When we are doing that for 4th time, we use a tab, not 8 spaces. Next indents are again 2 spaces and replace again with tab on modulo 4 indents. + + +Further +--- + +In file .clang-format is the machine readable version +of the Dnsmasq coding style. -- 2.37.2 ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH 3/6] Tell `git blame` which commits to ignore
From: Geert Stappers new file: .git-blame-ignore-revs That file has commit-hash of commit to ignore and information on how to activate it. --- .git-blame-ignore-revs | 9 + 1 file changed, 9 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000..29db600 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,9 @@ +# +# In this file is documented which commits +#git blame +# should ignore. To activate it, do +#git config blame.ignoreRevsFile .git-blame-ignore-revs +# + +# sed --in-place -e 's/[\t ]*$//' src/*.c src/*.h +023ea4bea87bc4bccb4b7197ced1e604215186c8 -- 2.37.2 ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] Coding Style
In-Reply-To: <20221022202018.cxxx2lag6dxqg...@gpm.stappers.nl> Previous-Subject: Re: [Dnsmasq-discuss] [PATCH] Removed empty last lines On Sat, Oct 22, 2022 at 10:20:18PM +0200, Geert Stappers via Dnsmasq-discuss wrote: > On Sat, Oct 22, 2022 at 09:26:53PM +0200, Geert Stappers wrote: > > Files src/domain-match.c and src/metrics.c had empty last lines. > > Now has the last line of those files more than just white space. > > > > diff --git a/src/domain-match.c b/src/domain-match.c > > --- a/src/domain-match.c > > +++ b/src/domain-match.c > > @@ -729,4 +729,3 @@ int add_update_server(int flags, > > > >return 1; > > } > > - > > diff --git a/src/metrics.c b/src/metrics.c > > --- a/src/metrics.c > > +++ b/src/metrics.c > > @@ -63,4 +63,3 @@ void clear_metrics(void) > >serv->query_latency = 0; > > } > > } > > - > > > > The thing I aiming for is "formatting by machine". > So that tooling can enforce Coding Style. > Differences against previous attempt: * `git blame` can be told to ignore certain commits * `clang-format` improved * We became wiser This email will get patches as follow-up message. Expect to see a machine readable format description, git blame commit ignore instructions and a CodingStyle file. I'm looking forward to your feedback. Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH 4/6] Created file .clang-format
From: Geert Stappers I did clang-format --assume-filename=.c --style=GNU --dump-config and redirected that to .clang-format. For coding style I should have pick a better match from webpage https://clang.llvm.org/docs/ClangFormatStyleOptions.html Item that complies with dnsmasq coding style is IndentWidth: 2 --- .clang-format | 190 ++ 1 file changed, 190 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000..75d465b --- /dev/null +++ b/.clang-format @@ -0,0 +1,190 @@ +--- +Language:Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: All +AlwaysBreakAfterReturnType: AllDefinitions +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: true + IndentBraces:true + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: All +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: GNU +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 79 +CommentPragmas: '^ IWYU pragma:' +QualifierAlignment: Leave +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: BinPack +BasedOnStyle:'' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +AllowAllConstructorInitializersOnNextLine: true +FixNamespaceComments: false +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' +Priority:2 +SortPriority:0 +CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' +Priority:3 +SortPriority:0 +CaseSensitive: false + - Regex: '.*' +Priority:1 +SortPriority:0 +CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Right +PPIndentWidth: -1 +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes:CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList:
[Dnsmasq-discuss] [PATCH 1/6] new file: CodingStyle
From: Geert Stappers Documents how to indent. (further codingstyle will be machine readable) --- CodingStyle | 8 1 file changed, 8 insertions(+) create mode 100644 CodingStyle diff --git a/CodingStyle b/CodingStyle new file mode 100644 index 000..5457dd8 --- /dev/null +++ b/CodingStyle @@ -0,0 +1,8 @@ + +Indentation +--- + +We indent by 2 spaces. +When we are doing that for 4th time, we use a tab, not 8 spaces. +Next indents are again 2 spaces and replace again with tab +on modulo 4 indents. -- 2.37.2 ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
[Dnsmasq-discuss] [PATCH 6/6] Extended Makefile with format target
From: Geert Stappers For keeping the source code in shape, you do: make format or just make fmt File CodingStyle has `make fmt` documented for being closer to the "Go-lang" and/or the "Rust" world. --- CodingStyle | 7 +++ Makefile| 9 + 2 files changed, 16 insertions(+) diff --git a/CodingStyle b/CodingStyle index fb8c5b9..58d83e6 100644 --- a/CodingStyle +++ b/CodingStyle @@ -13,3 +13,10 @@ Further In file .clang-format is the machine readable version of the Dnsmasq coding style. + + +Format +-- + +To format the code execute: +make fmt diff --git a/Makefile b/Makefile index 48e8d3b..b5be2ba 100644 --- a/Makefile +++ b/Makefile @@ -134,6 +134,15 @@ merge : echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U $(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \ done +# enforce Coding Style +format: + clang-format \ + --style=file \ + -i src/*.c src/*.h + +# alias inspired by `go fmt` and `cargo fmt` +fmt: format + # Canonicalise .po file. %.po : @cd $(BUILDDIR) && $(MAKE) -f $(top)/Makefile dnsmasq.pot -- 2.37.2 ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] [PATCH] Connection track mark based DNS query filtering.
On Sun, Oct 23, 2022 at 10:15:47AM +0200, Geert Stappers via Dnsmasq-discuss wrote: > On Fri, Jan 22, 2021 at 09:34:53PM +0100, Etan Kissling wrote: > > This extends query filtering support beyond what is currently possible > > with the `--ipset` configuration option, by adding support for: > > 1) Specifying allowlists on a per-client basis, based on their > >associated Linux connection track mark. > > 2) Dynamic configuration of allowlists via Ubus. > > 3) Reporting when a DNS query resolves or is rejected via Ubus. > > 4) DNS name patterns containing wildcards. > > > > Disallowed queries are not forwarded; they are rejected > > with a REFUSED error code. > > > > Signed-off-by: Etan Kissling > > --- > > Makefile | 2 +- > > man/dnsmasq.8 | 31 +++- > > src/dnsmasq.h | 25 +++- > > src/forward.c | 123 +++- > > src/option.c | 134 ++ > > src/pattern.c | 386 ++ > > src/rfc1035.c | 82 +++ > > src/ubus.c| 182 > > 8 files changed, 956 insertions(+), 9 deletions(-) > > create mode 100644 src/pattern.c > > > Found this while looking for another patch. > Did see that no one did respond to the patch. > I might be wrong about that due my archive my only point of view. > > > What where other responses? > I'm asking especially the mailinglist because I got : host mx-in.g.apple.com[17.72.136.242] said: 550 5.1.6 recipient no longer on server: etan_kissl...@apple.com (in reply to RCPT TO command) Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss