6 IP address of an interface on which Dnsmasq process is listening. |
6 IP address of an interface on which Dnsmasq process is listening. |
7 |
7 |
8 This patch was developed in-house. Since it is Solaris-specific it is not |
8 This patch was developed in-house. Since it is Solaris-specific it is not |
9 suitable for upstream. |
9 suitable for upstream. |
10 |
10 |
11 --- dnsmasq-2.68/Makefile 2013-12-08 07:58:29.000000000 -0800 |
11 --- dnsmasq-2.75/Makefile.orig 2016-07-11 17:16:44.577976921 -0400 |
12 +++ NEW/Makefile 2014-07-06 20:06:34.886232993 -0700 |
12 +++ dnsmasq-2.75/Makefile 2016-07-11 17:12:36.902671954 -0400 |
13 @@ -19,6 +19,7 @@ |
13 @@ -19,6 +19,7 @@ |
14 # Variables you may well want to override. |
14 # Variables you may well want to override. |
15 |
15 |
16 PREFIX = /usr/local |
16 PREFIX = /usr/local |
17 +LIBDIR = $(PREFIX)/lib/inet |
17 +LIBDIR = $(PREFIX)/lib/inet |
24 MAN = man |
24 MAN = man |
25 +WRT = contrib/wrt |
25 +WRT = contrib/wrt |
26 |
26 |
27 ################################################################# |
27 ################################################################# |
28 |
28 |
29 @@ -67,6 +69,8 @@ |
29 @@ -75,6 +77,8 @@ |
30 helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \ |
30 dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o \ |
31 dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o domain.o |
31 domain.o dnssec.o blockdata.o tables.o loop.o inotify.o poll.o |
32 |
32 |
33 +dhcp_release_objs = dhcp_release.o |
33 +dhcp_release_objs = dhcp_release.o |
34 + |
34 + |
35 hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \ |
35 hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \ |
36 dns-protocol.h radv-protocol.h |
36 dns-protocol.h radv-protocol.h ip6addr.h |
37 |
37 |
38 @@ -75,11 +79,12 @@ |
38 @@ -83,11 +87,12 @@ |
39 top="$(top)" \ |
39 top="$(top)" \ |
40 build_cflags="$(version) $(dbus_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags)" \ |
40 build_cflags="$(version) $(dbus_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \ |
41 build_libs="$(dbus_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs)" \ |
41 build_libs="$(dbus_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs)" \ |
42 - -f $(top)/Makefile dnsmasq |
42 - -f $(top)/Makefile dnsmasq |
43 + -f $(top)/Makefile dnsmasq dhcp_release |
43 + -f $(top)/Makefile dnsmasq dhcp_release |
44 |
44 |
45 mostly_clean : |
45 mostly_clean : |
46 rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot |
46 rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot |
47 - rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq |
47 - rm -f $(BUILDDIR)/.copts_* $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq |
48 + rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a \ |
48 + rm -f $(BUILDDIR)/.copts_* $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq \ |
49 + $(BUILDDIR)/dnsmasq $(BUILDDIR)/dhcp_release |
49 + $(BUILDDIR)/dhcp_release |
50 |
50 |
51 clean : mostly_clean |
51 clean : mostly_clean |
52 rm -f $(BUILDDIR)/dnsmasq_baseline |
52 rm -f $(BUILDDIR)/dnsmasq_baseline |
53 @@ -89,9 +94,11 @@ |
53 @@ -97,9 +102,11 @@ |
54 install : all install-common |
54 install : all install-common |
55 |
55 |
56 install-common : |
56 install-common : |
57 - $(INSTALL) -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8 |
57 - $(INSTALL) -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8 |
58 + $(INSTALL) -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8 \ |
58 + $(INSTALL) -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8 \ |
61 $(INSTALL) -m 755 $(BUILDDIR)/dnsmasq $(DESTDIR)$(BINDIR) |
61 $(INSTALL) -m 755 $(BUILDDIR)/dnsmasq $(DESTDIR)$(BINDIR) |
62 + $(INSTALL) -m 755 $(BUILDDIR)/dhcp_release $(DESTDIR)$(LIBDIR) |
62 + $(INSTALL) -m 755 $(BUILDDIR)/dhcp_release $(DESTDIR)$(LIBDIR) |
63 |
63 |
64 all-i18n : $(BUILDDIR) |
64 all-i18n : $(BUILDDIR) |
65 @cd $(BUILDDIR) && $(MAKE) \ |
65 @cd $(BUILDDIR) && $(MAKE) \ |
66 @@ -99,7 +106,7 @@ |
66 @@ -107,7 +114,7 @@ |
67 i18n=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \ |
67 i18n=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \ |
68 build_cflags="$(version) $(dbus_cflags) $(ct_cflags) $(lua_cflags) `$(PKG_CONFIG) --cflags libidn`" \ |
68 build_cflags="$(version) $(dbus_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags) `$(PKG_CONFIG) --cflags libidn`" \ |
69 build_libs="$(dbus_libs) $(ct_libs) $(lua_libs) $(sunos_libs) `$(PKG_CONFIG) --libs libidn`" \ |
69 build_libs="$(dbus_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) `$(PKG_CONFIG) --libs libidn`" \ |
70 - -f $(top)/Makefile dnsmasq |
70 - -f $(top)/Makefile dnsmasq |
71 + -f $(top)/Makefile dnsmasq dhcp_release |
71 + -f $(top)/Makefile dnsmasq dhcp_release |
72 for f in `cd $(PO); echo *.po`; do \ |
72 for f in `cd $(PO); echo *.po`; do \ |
73 cd $(top) && cd $(BUILDDIR) && $(MAKE) top="$(top)" -f $(top)/Makefile $${f%.po}.mo; \ |
73 cd $(top) && cd $(BUILDDIR) && $(MAKE) top="$(top)" -f $(top)/Makefile $${f%.po}.mo; \ |
74 done |
74 done |
75 @@ -142,12 +149,18 @@ |
75 @@ -150,6 +157,9 @@ |
76 $(objs:.o=.c) $(hdrs): |
76 $(objs:.o=.c) $(hdrs): |
77 ln -s $(top)/$(SRC)/$@ . |
77 ln -s $(top)/$(SRC)/$@ . |
78 |
78 |
79 +$(dhcp_release_objs:.o=.c): |
79 +$(dhcp_release_objs:.o=.c): |
80 + ln -s $(top)/$(WRT)/$@ . |
80 + ln -s $(top)/$(WRT)/$@ . |
81 + |
81 + |
|
82 $(objs): $(copts_conf) $(hdrs) |
|
83 |
82 .c.o: |
84 .c.o: |
83 $(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $< |
85 @@ -158,6 +168,9 @@ |
84 |
86 dnsmasq : $(objs) |
85 dnsmasq : .configured $(hdrs) $(objs) |
|
86 $(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS) |
87 $(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS) |
87 |
88 |
88 +dhcp_release : .configured $(hdrs) $(dhcp_release_objs) |
89 +dhcp_release : $(objs) $(dhcp_release_objs) |
89 + $(CC) $(LDFLAGS) -o $@ $(dhcp_release_objs) $(build_libs) $(LIBS) |
90 + $(CC) $(LDFLAGS) -o $@ $(dhcp_release_objs) $(build_libs) $(LIBS) |
90 + |
91 + |
91 dnsmasq.pot : $(objs:.o=.c) $(hdrs) |
92 dnsmasq.pot : $(objs:.o=.c) $(hdrs) |
92 $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(objs:.o=.c) |
93 $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(objs:.o=.c) |
93 |
94 |
94 --- dnsmasq-2.68/contrib/wrt/dhcp_release.c 2013-12-08 07:58:29.000000000 -0800 |
95 --- dnsmasq-2.75/contrib/wrt/dhcp_release.c.orig 2016-07-11 17:17:15.545272241 -0400 |
95 +++ NEW/contrib/wrt/dhcp_release.c 2014-07-04 14:57:37.992103839 -0700 |
96 +++ dnsmasq-2.75/contrib/wrt/dhcp_release.c 2016-07-11 17:16:03.110231008 -0400 |
96 @@ -33,6 +33,10 @@ |
97 @@ -33,6 +33,10 @@ |
97 The client-id is optional. If it is "*" then it treated as being missing. |
98 The client-id is optional. If it is "*" then it treated as being missing. |
98 */ |
99 */ |
99 |
100 |
100 +#if defined(__sun) || defined(__sun__) |
101 +#if defined(__sun) || defined(__sun__) |
171 + |
172 + |
172 +#if !defined(HAVE_SOLARIS_NETWORK) |
173 +#if !defined(HAVE_SOLARIS_NETWORK) |
173 /* This voodoo fakes up a packet coming from the correct interface, which really matters for |
174 /* This voodoo fakes up a packet coming from the correct interface, which really matters for |
174 a DHCP server */ |
175 a DHCP server */ |
175 strcpy(ifr.ifr_name, argv[1]); |
176 strcpy(ifr.ifr_name, argv[1]); |
176 @@ -276,11 +294,43 @@ |
177 @@ -276,6 +294,7 @@ |
177 perror("cannot setup interface"); |
178 perror("cannot setup interface"); |
178 exit(1); |
179 exit(1); |
179 } |
180 } |
180 - |
181 +#endif |
181 +#endif |
182 |
|
183 if (inet_addr(argv[2]) == INADDR_NONE) |
|
184 { |
|
185 @@ -284,8 +303,40 @@ |
|
186 } |
182 |
187 |
183 lease.s_addr = inet_addr(argv[2]); |
188 lease.s_addr = inet_addr(argv[2]); |
184 +#ifdef HAVE_SOLARIS_NETWORK |
189 +#ifdef HAVE_SOLARIS_NETWORK |
185 + struct ifaddrs *ifp_head, *ifp; |
190 + struct ifaddrs *ifp_head, *ifp; |
186 + |
191 + |
187 + if (getifaddrs(&ifp_head) < 0) |
192 + if (getifaddrs(&ifp_head) < 0) |
188 + { |
193 + { |
189 + perror("could not retrieve IP addresses"); |
194 + perror("could not retrieve IP addresses"); |
190 + exit(1); |
195 + exit(1); |
191 + } |
196 + } |
192 + for (ifp = ifp_head; ifp != NULL; ifp = ifp->ifa_next) { |
197 + for (ifp = ifp_head; ifp != NULL; ifp = ifp->ifa_next) { |
193 + if (ifp->ifa_addr->sa_family != AF_INET) |
198 + if (ifp->ifa_addr->sa_family != AF_INET) |
194 + continue; |
199 + continue; |
195 + if (strcmp(ifp->ifa_name, argv[1]) == 0 && |
200 + if (strcmp(ifp->ifa_name, argv[1]) == 0 && |
196 + is_same_net(lease, ((struct sockaddr_in *)ifp->ifa_addr)->sin_addr, |
201 + is_same_net(lease, ((struct sockaddr_in *)ifp->ifa_addr)->sin_addr, |
197 + ((struct sockaddr_in *)ifp->ifa_netmask)->sin_addr)) |
202 + ((struct sockaddr_in *)ifp->ifa_netmask)->sin_addr)) |