Help writing new SAMBA_INTERNAL DNS test code please.

Matt Grant matt at mattgrant.net.nz
Fri Sep 3 22:21:09 UTC 2021


Hi!


Thank you for all the advice.  Code is now working on CI. However, have
a newbie query  if someone would not mind answering please.


However, noticed something in my test code
(python/samba/tests/dns_forwarder_helpers/server.py) I want to fix for
portability between different Python versions.  I had to subclass
scoketserver.UDPSocketServer to set the address_family property for
AF_INET6, as this is socketservers documented way to change this, even
in Python 3.9!!


I want to make the __init__ method signature portable by only requiring
the arguments the tests use, initially I copied the full __init__ method
signature.


If I recreate my git commit to grantma/dns-forward-port, will git push
-f completey replace all the code I previously pushed to gitlab and
still keep the current merge request?


Thank you!


Matt Grant

On 3/09/21 8:08 am, Andrew Bartlett wrote:
> G'Day Matt,
>
> Can you keep things on the mailing list or gitlab please?
>
> I'm quite busy with some other stuff and so personal mail risks getting
> lost, we track outstanding patches in GitLab for this reason, so we
> keep a list of what is going on.
>
> Likewise on the mailing list others can help.
>
> Andrew,
>
> On Fri, 2021-09-03 at 07:55 +1200, Matt Grant wrote:
>> OK,
>>
>> This is how I will proceed.  I will alter the SAMBA_INTERNAL
>> dns_forwarder test to have an IPv6 server listening on port 54 for
>> the second forwarder in that test suite.  However this does not cover
>> off the case where the second server is an IPv6 only address with out
>> square brackets, no port number given, defaulting to port 53, but
>> will test the code.
>>
>> testparm support is another issue.  Have not written code for that as
>> it does not look at the dns forwarder addresses given.
>>
>> Patch for new feature is attached.  Just subscribing to Samba
>> bugzilla so I can log a bug for implementing this feature in master.
>>
>> Regards,
>>
>> Matt Grant
>>
>> On Wed, 1 Sept 2021 at 09:25, Andrew Bartlett <abartlet at samba.org>
>> wrote:
>>> On Tue, 2021-08-31 at 13:36 -0700, Jeremy Allison via samba-
>>> technical
>>> wrote:
>>>> On Tue, Aug 31, 2021 at 05:20:57PM +1200, Matt Grant via samba-
>>>> technical wrote:
>>>>> Hi Andrew!
>>>>>
>>>>> Have not created Samba bugs for the following yet, as I am
>>> trying
>>>>> to get
>>>>> the hardest part doen, writing the test code.
>>>>>
>>>>>   1. Dns server port number specification for smb.conf 'dns
>>>>> forwarder'
>>>>>   server list
>>>>>   2. Restricting the dynamic DNS update ranges so that the
>>>>> SAMBA_INTERNAL
>>>>>   server is not spammed with IPv6 PD addresses from the ISP.
>>>>>
>>>>> Main issue is being able to dynamically change the smb.conf
>>> setup
>>>>> for the
>>>>> Python self test hookup, for 1, specifically within
>>>>> samba.tests.dns_forwarder.  Being able to do this will also
>>> make 2
>>>>> far
>>>>> easier.  After looking at the test code set up, I can't see how
>>> to
>>>>> dynamically change the smb.conf file in st/samba/smb.conf while
>>> the
>>>>> tests
>>>>> are running to set up for testing the port numbers or not.
>>>> Look at tests like:
>>>>
>>>> source3/script/tests/test_deadtime.sh
>>>>
>>>> they use a feature:
>>>>
>>>> global_inject_conf=$(dirname $SMB_CONF_PATH)/global_inject.conf
>>>>
>>>> that allows a test to include dynamic smb.conf entries for Samba3
>>>> tests via the line:
>>>>
>>>>          include = $globalinjectconf
>>>>
>>>> inside selftest/target/Samba3.pm.
>>>>
>>>> I don't think the same feature is in selftest/target/Samba4.pm
>>>> but I'd look into adding that. It might do what you need.
>>> Sadly the AD DC (except the embedded smbd) still doesn't reload the
>>> smb.conf (ever!), so that trick won't work.  
>>>
>>> If custom smb.conf options can't be avoided, they need to be added
>>> to
>>> an existing (if otherwise harmless) or new environment.  Sadly if a
>>> new
>>> server instance (like ad_dc, fl2003dc etc) is needed in Samba4.pm
>>> that
>>> is a fair chunk of work, so we try to fit it in with an existing
>>> one.
>>>
>>> Sorry!
>>>
>>> Andrew Bartlett
>>>



More information about the samba-technical mailing list