diff options
author | Stefan Briesenick <sbriesen@gentoo.org> | 2010-07-20 20:31:31 +0000 |
---|---|---|
committer | Stefan Briesenick <sbriesen@gentoo.org> | 2010-07-20 20:31:31 +0000 |
commit | 6942ae90ebab8007d831f5b403d71bee0bcbd761 (patch) | |
tree | 2b2b51691bce787a8fcc5bf042d430ca4b2fe8f3 /net-dns | |
parent | Added calls to python_mod_optimize (diff) | |
download | gentoo-2-6942ae90ebab8007d831f5b403d71bee0bcbd761.tar.gz gentoo-2-6942ae90ebab8007d831f5b403d71bee0bcbd761.tar.bz2 gentoo-2-6942ae90ebab8007d831f5b403d71bee0bcbd761.zip |
added special linux netlink patch from Martin Väth. solving bug# 318905.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'net-dns')
-rw-r--r-- | net-dns/ez-ipupdate/ChangeLog | 11 | ||||
-rw-r--r-- | net-dns/ez-ipupdate/ez-ipupdate-3.0.11_beta8-r6.ebuild | 105 | ||||
-rw-r--r-- | net-dns/ez-ipupdate/files/ez-ipupdate-3.0.11_beta8-linux.diff | 212 |
3 files changed, 326 insertions, 2 deletions
diff --git a/net-dns/ez-ipupdate/ChangeLog b/net-dns/ez-ipupdate/ChangeLog index 990d8f9d9e46..f8151de91292 100644 --- a/net-dns/ez-ipupdate/ChangeLog +++ b/net-dns/ez-ipupdate/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-dns/ez-ipupdate -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-dns/ez-ipupdate/ChangeLog,v 1.29 2009/09/23 18:28:39 patrick Exp $ +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/ez-ipupdate/ChangeLog,v 1.30 2010/07/20 20:31:31 sbriesen Exp $ + +*ez-ipupdate-3.0.11_beta8-r6 (20 Jul 2010) + + 20 Jul 2010; Stefan Briesenick <sbriesen@gentoo.org> + +ez-ipupdate-3.0.11_beta8-r6.ebuild, + +files/ez-ipupdate-3.0.11_beta8-linux.diff: + added special linux netlink patch from Martin Väth. solving bug# 318905. 23 Sep 2009; Patrick Lauer <patrick@gentoo.org> ez-ipupdate-3.0.11_beta8-r4.ebuild, ez-ipupdate-3.0.11_beta8-r5.ebuild: diff --git a/net-dns/ez-ipupdate/ez-ipupdate-3.0.11_beta8-r6.ebuild b/net-dns/ez-ipupdate/ez-ipupdate-3.0.11_beta8-r6.ebuild new file mode 100644 index 000000000000..c4a3ea20c169 --- /dev/null +++ b/net-dns/ez-ipupdate/ez-ipupdate-3.0.11_beta8-r6.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/ez-ipupdate/ez-ipupdate-3.0.11_beta8-r6.ebuild,v 1.1 2010/07/20 20:31:31 sbriesen Exp $ + +EAPI="2" + +inherit eutils + +PATCH_VERSION="10" +MY_PV="${PV/_beta/b}" +S="${WORKDIR}/${PN}-${MY_PV}" + +DESCRIPTION="Dynamic DNS client for lots of dynamic dns services" +HOMEPAGE="http://ez-ipupdate.com/" +SRC_URI="mirror://debian/pool/main/e/ez-ipupdate/${PN}_${MY_PV}.orig.tar.gz + mirror://debian/pool/main/e/ez-ipupdate/${PN}_${MY_PV}-${PATCH_VERSION}.diff.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~sparc ~x86" +IUSE="" + +DEPEND="" + +src_prepare() { + epatch "${WORKDIR}/${PN}_${MY_PV}-${PATCH_VERSION}.diff" + epatch "${FILESDIR}/${P}-zoneedit.diff" + epatch "${FILESDIR}/${P}-dnsexit.diff" + epatch "${FILESDIR}/${P}-3322.diff" + epatch "${FILESDIR}/${P}-linux.diff" + + # comment out obsolete options + sed -i -e "s:^\(run-as-user.*\):#\1:g" \ + -e "s:^\(cache-file.*\):#\1:g" ex*conf + + # make 'missing' executable (bug #103480) + chmod +x missing +} + +src_compile() { + econf --bindir=/usr/sbin || die "econf failed" + emake || die "emake failed" +} + +src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + newinitd "${FILESDIR}/ez-ipupdate.initd" ez-ipupdate + keepdir /etc/ez-ipupdate /var/cache/ez-ipupdate + + # install docs + dodoc README + newdoc debian/README.Debian README.debian + newdoc debian/changelog ChangeLog.debian + newdoc CHANGELOG ChangeLog + + # install example configs + docinto examples + dodoc ex*conf +} + +pkg_preinst() { + enewgroup ez-ipupd + enewuser ez-ipupd -1 -1 /var/cache/ez-ipupdate ez-ipupd +} + +pkg_postinst() { + chmod 750 /etc/ez-ipupdate /var/cache/ez-ipupdate + chown ez-ipupd:ez-ipupd /etc/ez-ipupdate /var/cache/ez-ipupdate + + elog + elog "Please create one or more config files in" + elog "/etc/ez-ipupdate/. A bunch of samples can" + elog "be found in the doc directory." + elog + elog "All config files must have a '.conf' extension." + elog + elog "Please do not use the 'run-as-user', 'run-as-euser'," + elog "'cache-file' and 'pidfile' options, since these are" + elog "handled internally by the init-script!" + elog + elog "If you want to use ez-ipupdate in daemon mode," + elog "please add 'daemon' to the config file(s) and" + elog "add the ez-ipupdate init-script to the default" + elog "runlevel." + elog + elog "Without the 'daemon' option, you can run the" + elog "init-script with the 'update' parameter inside" + elog "your PPP ip-up script." + elog + + if [ -f /etc/ez-ipupdate.conf ]; then + elog "!!! IMPORTANT UPDATE NOTICE !!!" + elog + elog "The ez-ipupdate init-script can now handle more" + elog "than one config file. New config file location is" + elog "/etc/ez-ipupdate/*.conf" + elog + if [ ! -f /etc/ez-ipupdate/default.conf ]; then + mv -f /etc/ez-ipupdate.conf /etc/ez-ipupdate/default.conf + elog "Your old configuration has been moved to" + elog "/etc/ez-ipupdate/default.conf" + elog + fi + fi +} diff --git a/net-dns/ez-ipupdate/files/ez-ipupdate-3.0.11_beta8-linux.diff b/net-dns/ez-ipupdate/files/ez-ipupdate-3.0.11_beta8-linux.diff new file mode 100644 index 000000000000..22d45190682a --- /dev/null +++ b/net-dns/ez-ipupdate/files/ez-ipupdate-3.0.11_beta8-linux.diff @@ -0,0 +1,212 @@ +--- ez-ipupdate.c.orig ++++ ez-ipupdate.c +@@ -172,6 +172,17 @@ + # ifdef HAVE_SYS_SOCKIO_H + # include <sys/sockio.h> + # endif ++# ifdef __linux__ ++# include <linux/if.h> ++# include <linux/netlink.h> ++# include <linux/rtnetlink.h> ++/* Under Linux, we reopen socket in get_if_addr() every time */ ++# define socketopen(sock) ++# define socketclose(sock) ++# else ++# define socketopen(sock) sock = socket(AF_INET, SOCK_STREAM, 0) ++# define socketclose(sock) close(sock) ++# endif + #endif + + #include <dprintf.h> +@@ -1605,6 +1616,114 @@ + int get_if_addr(int sock, char *name, struct sockaddr_in *sin) + { + #ifdef IF_LOOKUP ++#ifdef __linux__ ++ struct { ++ struct nlmsghdr nlmsg_info; ++ struct ifaddrmsg ifaddrmsg_info; ++ char buffer[2048]; ++ } req; ++ struct nlmsghdr *curr; ++ int len; ++ char buf[8192]; ++ ++ /* open a socket and bind it. ++ Under non-linux, the socket can be kept open, but it seems under ++ linux we cannot use the same socket for several requests reliable ++ [although sometimes it works...] */ ++ static struct sockaddr_nl local; ++ sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); ++ if(sock < 0) { ++ perror("socket"); ++ return -1; ++ } ++ local.nl_family = AF_NETLINK; ++ local.nl_pad = 0; ++ local.nl_pid = getpid(); ++ local.nl_groups = 0; ++ if(bind(sock, (struct sockaddr*) &local, sizeof(local)) < 0) { ++ perror("bind"); ++ close(sock); ++ return -1; ++ } ++ ++ memset(&req, 0, sizeof(req)); ++ req.nlmsg_info.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg)); ++ req.nlmsg_info.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; ++ req.nlmsg_info.nlmsg_type = RTM_GETADDR; ++ req.nlmsg_info.nlmsg_pid = getpid(); ++ req.ifaddrmsg_info.ifa_family = AF_INET; ++ if(send(sock, &req, req.nlmsg_info.nlmsg_len, 0) < 0) { ++ perror("sendmsg(sock)"); ++ close(sock); ++ return -1; ++ } ++ ++ len = recv(sock, buf, sizeof(buf), 0); ++ close(sock); ++ if(len < 0) { ++ perror("recv"); ++ return -1; ++ } else if(len == 0) { ++ dprintf((stderr, "No interfaces found")); ++ return -1; ++ } ++ ++ /* Initialize sin except for address */ ++ bzero(sin, sizeof(struct sockaddr_in)); ++ sin->sin_family = AF_INET; ++ ++ /* We take the last non-private IP with matching name */ ++ int found = 0; ++ curr = (struct nlmsghdr *) buf; ++ for(; NLMSG_OK(curr, len); curr = NLMSG_NEXT(curr, len)) { ++ struct ifaddrmsg *curraddr = (struct ifaddrmsg *) NLMSG_DATA(curr); ++ struct rtattr *datalist = (struct rtattr *) IFA_RTA(curraddr); ++ int datalen = IFA_PAYLOAD(curr); ++ int mystat = 0; ++ struct in_addr sin_addr; ++ in_addr_t addr; ++ for(; RTA_OK(datalist, datalen); datalist = RTA_NEXT(datalist, datalen)) { ++ switch(datalist->rta_type) { ++ case IFA_LABEL: ++ if(strcmp((char *)RTA_DATA(datalist), name) != 0) ++ mystat = -1; ++ break; ++ case IFA_LOCAL: ++ addr = ((struct in_addr *)RTA_DATA(datalist))->s_addr; ++ /* addr: 192.168.0.0/16 || 172.16.0.0/12 || 10.0.0.0/8 */ ++ if(((addr & 0xFFFF) == 0xA8C0) ++ || ((addr & 0xF0FF) == 0x10AC) ++ || ((addr & 0xFF) == 0x0A)) { ++ mystat = -1; ++ } ++ else { ++ /* We must not store yet sin->sin_addr, since name might not match */ ++ sin_addr = *((struct in_addr *)RTA_DATA(datalist)); ++ mystat = 1; ++ } ++ break; ++ default: ++ break; ++ } ++ if(mystat < 0) ++ break; ++ } ++ if(mystat > 0) { ++ sin->sin_addr = sin_addr; ++ found = 1; ++ /* If you want to take the first non-private IP with matching name ++ uncomment the next break command: ++ break; */ ++ } ++ } ++ if(found) { ++ dprintf((stderr, "%s: %s\n", name, inet_ntoa(sin->sin_addr))); ++ return 0; ++ } ++ dprintf((stderr, "%s: %s\n", name, "has no non-private address")); ++ return -1; ++#else ++/* ifndef __linux__ */ + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); +@@ -1638,7 +1757,10 @@ + return -1; + } + return -1; ++#endif ++/* endif __linux__ */ + #else ++/* ifndef IF_LOOKUP */ + return -1; + #endif + } +@@ -4490,7 +4612,7 @@ + #ifdef IF_LOOKUP + if(options & OPT_DAEMON) + { +- sock = socket(AF_INET, SOCK_STREAM, 0); ++ socketopen(sock); + } + #endif + +@@ -4745,12 +4867,12 @@ + struct sockaddr_in sin; + int sock; + +- sock = socket(AF_INET, SOCK_STREAM, 0); ++ socketopen(sock); + if(get_if_addr(sock, interface, &sin) != 0) + { + exit(1); + } +- close(sock); ++ socketclose(sock); + snprintf(ipbuf, sizeof(ipbuf), "%s", inet_ntoa(sin.sin_addr)); + #else + fprintf(stderr, "interface lookup not enabled at compile time\n"); +@@ -4791,7 +4913,7 @@ + struct sockaddr_in sin; + int sock; + +- sock = socket(AF_INET, SOCK_STREAM, 0); ++ socketopen(sock); + if(get_if_addr(sock, interface, &sin) == 0) + { + if(address) { free(address); } +@@ -4802,7 +4924,7 @@ + show_message("could not resolve ip address for %s.\n", interface); + exit(1); + } +- close(sock); ++ socketclose(sock); + } + + for(i=0; i<ntrys; i++) +@@ -4846,12 +4968,12 @@ + struct sockaddr_in sin; + int sock; + +- sock = socket(AF_INET, SOCK_STREAM, 0); ++ socketopen(sock); + if(get_if_addr(sock, interface, &sin) != 0) + { + exit(1); + } +- close(sock); ++ socketclose(sock); + snprintf(ipbuf, sizeof(ipbuf), "%s", inet_ntoa(sin.sin_addr)); + #else + fprintf(stderr, "interface lookup not enabled at compile time\n"); +@@ -4878,7 +5000,7 @@ + } + + #ifdef IF_LOOKUP +- if(sock > 0) { close(sock); } ++ if(sock > 0) { socketclose(sock); } + #endif + + if(address) { free(address); } |