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

Andreas Schneider asn at samba.org
Fri Aug 5 13:17:53 UTC 2022


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.

> Best Regards,
> 
> Matt Grant
> 
> On Tue, 2 Aug 2022 at 21:12, Matt Grant <matt at mattgrant.net.nz> wrote:
> > Hi!
> > 
> > Code as it is up in merge request:
> > https://gitlab.com/samba-team/samba/-/merge_requests/2271
> > 
> > It's come a long way.  Been cleaned up a lot, and just completing the test
> > suite.  Need to test
> > denying DNS update by IP source address, and updates authed by IP source
> > address.
> > 
> > Have managed to update dns_base.py to optionally bind to a source IP
> > address for a query, but can't figure how to
> > set SOCKET_WRAPPER_DEFAULT_IFACE for the test/special test suite process
> > socket wrapper stuff.  Tis getting quite seeing double inside
> > selftest/target/Samba4.pm and source4/selftest/tests.py....
> > 
> > Could some one please lay out a map for me how to proceed with this, or
> > just help me to give it this extra push with this to get this over the
> > hump
> > and accepted for merging?
> > 
> > Thank you!
> > 
> > Matt Grant


-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





More information about the samba-technical mailing list