dnsmasq: bump to dnsmasq v2.80test3
[openwrt/staging/blogic.git] / package / network / services / dnsmasq / patches / 240-ubus.patch
index 41e2848594b042c3f724694ad226ef292c270453..2fa9f48d1284b5c444caf1d9c457b18aac5880e1 100644 (file)
@@ -1,17 +1,15 @@
-Index: dnsmasq-2.77/src/dnsmasq.c
-===================================================================
---- dnsmasq-2.77.orig/src/dnsmasq.c
-+++ dnsmasq-2.77/src/dnsmasq.c
-@@ -17,6 +17,8 @@
- /* Declare static char *compiler_opts  in config.h */
- #define DNSMASQ_COMPILE_OPTS
+--- a/src/dnsmasq.c
++++ b/src/dnsmasq.c
+@@ -19,6 +19,8 @@
  
-+#include <libubus.h>
-+
  #include "dnsmasq.h"
  
++#include <libubus.h>
++
  struct daemon *daemon;
-@@ -32,6 +34,62 @@ static void fatal_event(struct event_des
+ static volatile pid_t pid = 0;
+@@ -32,6 +34,64 @@ static void fatal_event(struct event_des
  static int read_event(int fd, struct event_desc *evp, char **msg);
  static void poll_resolv(int force, int do_reload, time_t now);
  
@@ -27,7 +25,7 @@ Index: dnsmasq-2.77/src/dnsmasq.c
 +      .type = &ubus_object_type,
 +};
 +
-+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name)
++void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface)
 +{
 +      if (!ubus || !ubus_object.has_subscribers)
 +              return;
@@ -39,6 +37,8 @@ Index: dnsmasq-2.77/src/dnsmasq.c
 +              blobmsg_add_string(&b, "ip", ip);
 +      if (name)
 +              blobmsg_add_string(&b, "name", name);
++      if (interface)
++              blobmsg_add_string(&b, "interface", interface);
 +      ubus_notify(ubus, &ubus_object, type, b.head, -1);
 +}
 +
@@ -74,7 +74,7 @@ Index: dnsmasq-2.77/src/dnsmasq.c
  int main (int argc, char **argv)
  {
    int bind_fallback = 0;
-@@ -911,6 +969,7 @@ int main (int argc, char **argv)
+@@ -949,6 +1009,7 @@ int main (int argc, char **argv)
        set_dbus_listeners();
  #endif        
    
@@ -82,7 +82,7 @@ Index: dnsmasq-2.77/src/dnsmasq.c
  #ifdef HAVE_DHCP
        if (daemon->dhcp || daemon->relay4)
        {
-@@ -1041,6 +1100,8 @@ int main (int argc, char **argv)
+@@ -1079,6 +1140,8 @@ int main (int argc, char **argv)
        check_dbus_listeners();
  #endif
        
@@ -91,10 +91,8 @@ Index: dnsmasq-2.77/src/dnsmasq.c
        check_dns_listeners(now);
  
  #ifdef HAVE_TFTP
-Index: dnsmasq-2.77/Makefile
-===================================================================
---- dnsmasq-2.77.orig/Makefile
-+++ dnsmasq-2.77/Makefile
+--- a/Makefile
++++ b/Makefile
 @@ -85,7 +85,7 @@ all : $(BUILDDIR)
        @cd $(BUILDDIR) && $(MAKE) \
   top="$(top)" \
@@ -104,31 +102,27 @@ Index: dnsmasq-2.77/Makefile
   -f $(top)/Makefile dnsmasq 
  
  mostly_clean :
-Index: dnsmasq-2.77/src/dnsmasq.h
-===================================================================
---- dnsmasq-2.77.orig/src/dnsmasq.h
-+++ dnsmasq-2.77/src/dnsmasq.h
-@@ -1389,6 +1389,8 @@ void emit_dbus_signal(int action, struct
+--- a/src/dnsmasq.h
++++ b/src/dnsmasq.h
+@@ -1445,6 +1445,8 @@ void emit_dbus_signal(int action, struct
  #  endif
  #endif
  
-+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name);
++void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface);
 +
  /* ipset.c */
  #ifdef HAVE_IPSET
  void ipset_init(void);
-Index: dnsmasq-2.77/src/rfc2131.c
-===================================================================
---- dnsmasq-2.77.orig/src/rfc2131.c
-+++ dnsmasq-2.77/src/rfc2131.c
-@@ -1621,6 +1621,10 @@ static void log_packet(char *type, void
+--- a/src/rfc2131.c
++++ b/src/rfc2131.c
+@@ -1636,6 +1636,10 @@ static void log_packet(char *type, void
              daemon->namebuff,
              string ? string : "",
              err ? err : "");
 +  if (!strcmp(type, "DHCPACK"))
-+        ubus_event_bcast("dhcp.ack", addr ? inet_ntoa(a) : NULL, daemon->namebuff, string ? string : NULL);
++        ubus_event_bcast("dhcp.ack", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface);
 +  else if (!strcmp(type, "DHCPRELEASE"))
-+        ubus_event_bcast("dhcp.release", addr ? inet_ntoa(a) : NULL, daemon->namebuff, string ? string : NULL);
++        ubus_event_bcast("dhcp.release", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface);
  }
  
  static void log_options(unsigned char *start, u32 xid)