Hi again, I made a clearly diff (pointed by dhill@) and fix the rc script pointed by ajacoutot@, this new version of adsuck have a script for play nicely with dhclient.
Cheers -- Sending from my Computer.
Index: Makefile =================================================================== RCS file: /cvs/ports/net/adsuck/Makefile,v retrieving revision 1.15 diff -u -r1.15 Makefile --- Makefile 19 Nov 2010 22:31:32 -0000 1.15 +++ Makefile 17 Mar 2011 20:36:05 -0000 @@ -2,12 +2,11 @@ COMMENT= DNS relay for ad blocking -DISTNAME= adsuck-1.9 -REVISION= 1 +DISTNAME= adsuck-2.2 CATEGORIES= net HOMEPAGE= http://opensource.conformal.com/wiki/Adsuck -MAINTAINER= Marco Peereboom <ma...@openbsd.org> +MAINTAINER= Gonzalo L. R. <gonz...@x61.com.ar> EXTRACT_SUFX= .tgz # BSD @@ -18,23 +17,26 @@ MASTER_SITES= http://opensource.conformal.com/snapshots/adsuck/ -WANTLIB= c ldns>=4.4 +WANTLIB= c event ldns>=4.4 LIB_DEPENDS= net/ldns/libldns>=1.6.5 MAKE_FLAGS= BINDIR="${TRUEPREFIX}/sbin" \ MANDIR="${TRUEPREFIX}/man/cat" -USE_GROFF = Yes +USE_GROFF= Yes _files= Hosts.blc Hosts.rsk regex \ Hosts.pub Hosts.trc hosts.small resolv.conf +pre-configure: + ${SUBST_CMD} ${WRKSRC}/dhclient-adsuck + post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/adsuck ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/adsuck ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/adsuck ${INSTALL_DATA} ${WRKSRC}/files/README ${PREFIX}/share/doc/adsuck - ${INSTALL_DATA} ${FILESDIR}/dhclient-script.diff ${PREFIX}/share/adsuck + ${INSTALL_DATA} ${WRKSRC}/dhclient-adsuck ${PREFIX}/sbin .for _f in ${_files} ${INSTALL_DATA} ${WRKSRC}/files/${_f} ${PREFIX}/share/examples/adsuck .endfor Index: distinfo =================================================================== RCS file: /cvs/ports/net/adsuck/distinfo,v retrieving revision 1.8 diff -u -r1.8 distinfo --- distinfo 31 Aug 2010 13:39:55 -0000 1.8 +++ distinfo 17 Mar 2011 20:36:05 -0000 @@ -1,5 +1,5 @@ -MD5 (adsuck-1.9.tgz) = eS6dCCVqyBTqcm4yAj2DrQ== -RMD160 (adsuck-1.9.tgz) = JyvQ/H7HMZVtJ7tFy5PK8KESRcg= -SHA1 (adsuck-1.9.tgz) = KVbwqrd9NAhWuqFXRGMhODZ4vc4= -SHA256 (adsuck-1.9.tgz) = vqsgWhuOTxmfVZ9dOELhM1c2M6tJea+uxGF7Sn7YeKs= -SIZE (adsuck-1.9.tgz) = 2176154 +MD5 (adsuck-2.2.tgz) = sjUrhkZ5UI9K2j+Co7+R7Q== +RMD160 (adsuck-2.2.tgz) = Y45fUSjFIKdyPOv8o0R5VabMfmg= +SHA1 (adsuck-2.2.tgz) = gZ0KuXWr0b9GpZOElh58S+hAM68= +SHA256 (adsuck-2.2.tgz) = tBTm7xiSlHn9hcisRwu8ymSgaZAWlP5EnOTsw4iYhjs= +SIZE (adsuck-2.2.tgz) = 2740496 Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/net/adsuck/pkg/PLIST,v retrieving revision 1.3 diff -u -r1.3 PLIST --- pkg/PLIST 15 Nov 2010 18:13:45 -0000 1.3 +++ pkg/PLIST 17 Mar 2011 20:36:05 -0000 @@ -3,8 +3,8 @@ @newuser _adsuck:620:_adsuck:daemon:adsuck Daemon:/var/empty:/sbin/nologin @man man/cat8/adsuck.0 @bin sbin/adsuck +sbin/dhclient-adsuck share/adsuck/ -share/adsuck/dhclient-script.diff share/doc/adsuck/ share/doc/adsuck/README share/doc/pkg-readmes/${FULLPKGNAME} @@ -25,3 +25,4 @@ @sample /var/adsuck/files/regex share/examples/adsuck/resolv.conf @sample /var/adsuck/files/resolv.conf +@rcscript ${RCDIR}/adsuck Index: pkg/README =================================================================== RCS file: /cvs/ports/net/adsuck/pkg/README,v retrieving revision 1.1 diff -u -r1.1 README --- pkg/README 15 Nov 2010 18:13:45 -0000 1.1 +++ pkg/README 17 Mar 2011 20:36:05 -0000 @@ -1,10 +1,14 @@ $OpenBSD: README,v 1.1 2010/11/15 18:13:45 jasper Exp $ -To make dhclient play nice with adsuck, patching dhclient-script is necessary: +To make dhclient play nice with adsuck, you have a script: - cd /sbin - patch -p0 < ${TRUEPREFIX}/share/adsuck/dhclient-script.diff + ${TRUEPREFIX}/sbin/dhclient-adsuck -dhclient-script will then, providing adsuck exists and adsuck_flags != "NO" -will avoid /etc/resolv.conf and write instead /var/adsuck/files/resolv.conf, +dhclient-adsuck will then, providing adsuck exists and adsuck_flags != "NO" +avoid /etc/resolv.conf and write instead /var/adsuck/files/resolv.conf, and give adsuck a HUP to reload that file. + +Also, be sure to set /etc/resolv.conf to contain only one +nameserver line: + + nameserver 127.0.0.1
#!/bin/sh # # $OpenBSD$ daemon="${TRUEPREFIX}/sbin/adsuck" daemon_flags="-c /var/adsuck -f /files/resolv.conf /files/hosts.small" . /etc/rc.d/rc.subr rc_reload() { pkill -HUP -f "^${pexp}" && pkill -USR1 -f "^${pexp}" } rc_cmd $1
$OpenBSD$ --- dhclient-adsuck.orig Thu Mar 17 17:18:41 2011 +++ dhclient-adsuck Thu Mar 17 17:19:10 2011 @@ -18,7 +18,7 @@ . /etc/rc.conf -if [ "$adsuck_flags" != "NO" -a -x /usr/local/sbin/adsuck ]; then +if [ "$adsuck_flags" != "NO" -a -x ${TRUEPREFIX}/sbin/adsuck ]; then adsuck_resconf="/var/adsuck/files/resolv.conf" { @@ -31,7 +31,7 @@ if [ "$adsuck_flags" != "NO" -a -x /usr/local/sbin/ads if pgrep adsuck > /dev/null; then pkill -HUP adsuck else - /usr/local/sbin/adsuck $adsuck_flags + ${TRUEPREFIX}/sbin/adsuck $adsuck_flags fi unset new_domain_name_servers unset new_domain_name