Great, thanks :-) Oldrich.
so 28. 3. 2020 v 20:23 odesílatel Simon Kelley <si...@thekelleys.org.uk> napsal: > Patch applied, thanks. > > > Simon. > > > On 20/03/2020 21:18, Oldřich Jedlička wrote: > > Same as for the dbus, allow specifying ubus service name (namespace) on > > the command line as an optional argument to --enable-ubus option. > > > > Signed-off-by: Oldřich Jedlička <oldium....@gmail.com> > > --- > > man/dnsmasq.8 | 7 +++++-- > > src/config.h | 1 + > > src/dnsmasq.h | 1 + > > src/option.c | 14 +++++++++++--- > > src/ubus.c | 3 ++- > > 5 files changed, 20 insertions(+), 6 deletions(-) > > > > diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 > > index 2032a37..034e3cf 100644 > > --- a/man/dnsmasq.8 > > +++ b/man/dnsmasq.8 > > @@ -366,10 +366,13 @@ been built with DBus support. If the service name > is given, dnsmasq > > provides service at that name, rather than the default which is > > .B uk.org.thekelleys.dnsmasq > > .TP > > -.B --enable-ubus > > +.B --enable-ubus[=<service-name>] > > Enable dnsmasq UBus interface. It sends notifications via UBus on > > DHCPACK and DHCPRELEASE events. Furthermore it offers metrics. > > -Requires that dnsmasq has been built with UBus support. > > +Requires that dnsmasq has been built with UBus support. If the service > > +name is given, dnsmasq provides service at that namespace, rather than > > +the default which is > > +.B dnsmasq > > .TP > > .B \-o, --strict-order > > By default, dnsmasq will send queries to any of the upstream servers > > diff --git a/src/config.h b/src/config.h > > index b002560..7d08f7d 100644 > > --- a/src/config.h > > +++ b/src/config.h > > @@ -50,6 +50,7 @@ > > #define RANDFILE "/dev/urandom" > > #define DNSMASQ_SERVICE "uk.org.thekelleys.dnsmasq" /* Default - may be > overridden by config */ > > #define DNSMASQ_PATH "/uk/org/thekelleys/dnsmasq" > > +#define DNSMASQ_UBUS_NAME "dnsmasq" /* Default - may be overridden by > config */ > > #define AUTH_TTL 600 /* default TTL for auth DNS */ > > #define SOA_REFRESH 1200 /* SOA refresh default */ > > #define SOA_RETRY 180 /* SOA retry default */ > > diff --git a/src/dnsmasq.h b/src/dnsmasq.h > > index f747868..b47ef74 100644 > > --- a/src/dnsmasq.h > > +++ b/src/dnsmasq.h > > @@ -1063,6 +1063,7 @@ extern struct daemon { > > unsigned int duid_enterprise, duid_config_len; > > unsigned char *duid_config; > > char *dbus_name; > > + char *ubus_name; > > char *dump_file; > > int dump_mask; > > unsigned long soa_sn, soa_refresh, soa_retry, soa_expiry; > > diff --git a/src/option.c b/src/option.c > > index 9ffd7fc..1f698da 100644 > > --- a/src/option.c > > +++ b/src/option.c > > @@ -238,7 +238,7 @@ static const struct myoption opts[] = > > { "caa-record", 1, 0 , LOPT_CAA }, > > { "dns-rr", 1, 0, LOPT_RR }, > > { "enable-dbus", 2, 0, '1' }, > > - { "enable-ubus", 0, 0, LOPT_UBUS }, > > + { "enable-ubus", 2, 0, LOPT_UBUS }, > > { "bootp-dynamic", 2, 0, '3' }, > > { "dhcp-mac", 1, 0, '4' }, > > { "no-ping", 0, 0, '5' }, > > @@ -428,7 +428,7 @@ static struct { > > { 'z', OPT_NOWILD, NULL, gettext_noop("Bind only to interfaces in > use."), NULL }, > > { 'Z', OPT_ETHERS, NULL, gettext_noop("Read DHCP static host > information from %s."), ETHERSFILE }, > > { '1', ARG_ONE, "[=<busname>]", gettext_noop("Enable the DBus > interface for setting upstream servers, etc."), NULL }, > > - { LOPT_UBUS, OPT_UBUS, NULL, gettext_noop("Enable the UBus > interface."), NULL }, > > + { LOPT_UBUS, ARG_ONE, "[=<busname>]", gettext_noop("Enable the UBus > interface."), NULL }, > > { '2', ARG_DUP, "<interface>", gettext_noop("Do not provide DHCP on > this interface, only provide DNS."), NULL }, > > { '3', ARG_DUP, "[=tag:<tag>]...", gettext_noop("Enable dynamic > address allocation for bootp."), NULL }, > > { '4', ARG_DUP, "set:<tag>,<mac address>", gettext_noop("Map MAC > address (with wildcards) to option set."), NULL }, > > @@ -1881,7 +1881,15 @@ static int one_opt(int option, char *arg, char > *errstr, char *gen_err, int comma > > else > > daemon->dbus_name = DNSMASQ_SERVICE; > > break; > > - > > + > > + case LOPT_UBUS: /* --enable-ubus */ > > + set_option_bool(OPT_UBUS); > > + if (arg) > > + daemon->ubus_name = opt_string_alloc(arg); > > + else > > + daemon->ubus_name = DNSMASQ_UBUS_NAME; > > + break; > > + > > case '8': /* --log-facility */ > > /* may be a filename */ > > if (strchr(arg, '/') || strcmp (arg, "-") == 0) > > diff --git a/src/ubus.c b/src/ubus.c > > index c7f6b19..5f81287 100644 > > --- a/src/ubus.c > > +++ b/src/ubus.c > > @@ -38,7 +38,7 @@ static struct ubus_object_type ubus_object_type = > > UBUS_OBJECT_TYPE("dnsmasq", ubus_object_methods); > > > > static struct ubus_object ubus_object = { > > - .name = "dnsmasq", > > + .name = NULL, > > .type = &ubus_object_type, > > .methods = ubus_object_methods, > > .n_methods = ARRAY_SIZE(ubus_object_methods), > > @@ -94,6 +94,7 @@ void ubus_init() > > return; > > } > > > > + ubus_object.name = daemon->ubus_name; > > ret = ubus_add_object(ubus, &ubus_object); > > if (ret) > > { > > > > > _______________________________________________ > Dnsmasq-discuss mailing list > Dnsmasq-discuss@lists.thekelleys.org.uk > http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss >
_______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss