Hung up on writing Unit tests for dynamic DNS update from different source addresses

Stefan Metzmacher metze at samba.org
Fri Aug 5 14:07:34 UTC 2022


Am 05.08.22 um 15:17 schrieb Andreas Schneider via samba-technical:
> On Tuesday, 2 August 2022 23:15:15 CEST Matt Grant wrote:
>> Hi!
>>
>> Figured it out, after a bit of digging.
>>
>> Can't use the test process itself as need to
>> set SOCKET_WRAPPER_DEFAULT_IFACE to say 251 which sets the source IP
>> numbers to 10.53.57.251 and fd00::5357:5fxx.  Or maybe I could try the
>> loopback source address of ::1 for example?
>>
>> Will call nsupdate (needed for testing samba_dnsupdate) via Python
>> subprocess module to do the work.  Bit messy, but there is NO way to add
>> extra IP numbers to the current socket_wrapper interface context that I can
>> see from its man page.
>>
>> Thanks guys!  Will get this done.
> 
> The number of addresses is limited as we need to walk a directory to find an
> IP address.
> 
> from 'man socket_wrapper'
> 
> 
> SOCKET_WRAPPER_DEFAULT_IFACE
>             Additionally, the default interface to be used by an application is
>             defined with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where the valid
>             range for <ID> starts with 1 (the default) and ends with 64. This
>             is analogous to use the IPv4 addresses
>             "127.0.0.<ID>"/"10.53.57.<ID>" or IPv6 addresses
>             "fd00::5357:5f<IDx>" (where <IDx> is a hexadecimal presentation of
>             <ID>). You should always set the default interface. If you listen
>             on INADDR_ANY then it will use the default interface to listen on.

Note that we already have a range allocated for client tests:

selftest/target/Samba.pm:

                 # 11-16 are used by selftest.pl for the client.conf. Most tests only
                 # use the first .11 IP. However, some tests (like winsreplication) rely
                 # on the client having multiple IPs.
                 client            => 11,

I guess we can also use 10.53.57.12 - 10.53.57.16 for dns tests...

metze



More information about the samba-technical mailing list