dnsmasq: sync upstream (#8245)

* dnsmasq: add ubus acl to allow calls to hotplug.tftp object

dnsmasq may call hotplug.dhcp, hotplug.neigh and hotplug.tftp.
Only the first two callees were listed in the ACL, so add missing
hotplug.tftp.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* dnsmasq: fix the dynamic dns object names patch

We can't use booleans, since we're not including stdbool.h. Use integers
instead.

Fixes: 0b79e7c01e ("dnsmasq: generate the dns object name dynamically")

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>

Co-authored-by: Daniel Golle <daniel@makrotopia.org>
Co-authored-by: Rui Salvaterra <rsalvaterra@gmail.com>
This commit is contained in:
Beginner 2021-11-16 16:19:06 +08:00 committed by GitHub
parent 298dfb71b8
commit 9e8387f5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -7,6 +7,9 @@
}, },
"hotplug.neigh": { "hotplug.neigh": {
"methods": [ "call" ] "methods": [ "call" ]
},
"hotplug.tftp": {
"methods": [ "call" ]
} }
} }
} }

View File

@ -60,17 +60,17 @@
+ *dest = blobmsg_get_string(val); + *dest = blobmsg_get_string(val);
+} +}
+ +
+static bool ubus_dns_doctor(const char *name, int ttl, void *p, int af) +static int ubus_dns_doctor(const char *name, int ttl, void *p, int af)
+{ +{
+ struct blob_buf *b; + struct blob_buf *b;
+ char *addr; + char *addr;
+ +
+ if (!name) + if (!name)
+ return false; + return 0;
+ +
+ b = ubus_dns_notify_prepare(); + b = ubus_dns_notify_prepare();
+ if (!b) + if (!b)
+ return false; + return 0;
+ +
+ blobmsg_add_string(b, "name", name); + blobmsg_add_string(b, "name", name);
+ +
@ -80,7 +80,7 @@
+ +
+ addr = blobmsg_alloc_string_buffer(b, "address", INET6_ADDRSTRLEN); + addr = blobmsg_alloc_string_buffer(b, "address", INET6_ADDRSTRLEN);
+ if (!addr) + if (!addr)
+ return false; + return 0;
+ +
+ inet_ntop(af, p, addr, INET6_ADDRSTRLEN); + inet_ntop(af, p, addr, INET6_ADDRSTRLEN);
+ blobmsg_add_string_buffer(b); + blobmsg_add_string_buffer(b);
@ -89,14 +89,14 @@
+ ubus_dns_notify("dns_result", ubus_dns_doctor_cb, &addr); + ubus_dns_notify("dns_result", ubus_dns_doctor_cb, &addr);
+ +
+ if (!addr) + if (!addr)
+ return false; + return 0;
+ +
+ return inet_pton(af, addr, p) == 1; + return inet_pton(af, addr, p) == 1;
+} +}
+#else +#else
+static bool ubus_dns_doctor(const char *name, int ttl, void *p, int af) +static int ubus_dns_doctor(const char *name, int ttl, void *p, int af)
+{ +{
+ return false; + return 0;
+} +}
+#endif +#endif
+ +