Hello community, here is the log from the commit of package dhcpv6 checked in at Mon Sep 1 14:48:24 CEST 2008. -------- --- dhcpv6/dhcpv6.changes 2008-08-18 00:46:14.000000000 +0200 +++ /mounts/work_src_done/STABLE/dhcpv6/dhcpv6.changes 2008-09-01 12:56:33.293336000 +0200 @@ -1,0 +2,11 @@ +Mon Sep 1 12:54:37 CEST 2008 - kkeil@suse.de + +- Add netconfig support + +------------------------------------------------------------------- +Fri Aug 30 18:00:57 CEST 2008 - kkeil@suse.de + +- Initialize variables in dhcp6_set_ia_options() +- Do not add an invalid IA Address option to an IA (bnc#418705) + +------------------------------------------------------------------- New: ---- dhcpv6-1.0.20-Do-not-add-an-invalid-IA-Address-option-to.patch dhcpv6-1.0.20-git_Initialize_variables_in_dhcp6_set_ia_options dhcpv6-1.0.20-netconfig.dif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dhcpv6.spec ++++++ --- /var/tmp/diff_new_pack.w32020/_old 2008-09-01 14:48:14.000000000 +0200 +++ /var/tmp/diff_new_pack.w32020/_new 2008-09-01 14:48:14.000000000 +0200 @@ -26,13 +26,16 @@ Group: Productivity/Networking/System Summary: DHCP Client and Server for IPv6 Version: 1.0.20 -Release: 1 +Release: 7 Source0: %{name}-%{version}.tar.bz2 Source1: dhcp6c_update.sh Source2: 60-dhcp6c.up Source3: 60-dhcp6c.down Patch1: %{name}-%{version}-destdir.patch Patch2: %{name}-%{version}-cmd.patch +Patch3: %{name}-%{version}-git_Initialize_variables_in_dhcp6_set_ia_options +Patch4: %{name}-%{version}-Do-not-add-an-invalid-IA-Address-option-to.patch +Patch5: %{name}-%{version}-netconfig.dif Provides: dhcp6 = 1.0.4 Obsoletes: dhcp6 <= 1.0.4 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -101,6 +104,9 @@ %setup -q -n %{name}-%{version} %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 %build touch NEWS @@ -111,7 +117,7 @@ autoheader automake --foreign --add-missing --copy autoconf -CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \ +CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DWITH_NETCONFIG" \ ./configure --prefix=/usr \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ @@ -173,6 +179,11 @@ %{_libdir}/libdhcp6client-1.0.so.* %changelog +* Mon Sep 01 2008 kkeil@suse.de +- Add netconfig support +* Sat Aug 30 2008 kkeil@suse.de +- Initialize variables in dhcp6_set_ia_options() +- Do not add an invalid IA Address option to an IA (bnc#418705) * Mon Aug 18 2008 kkeil@suse.de - update update to 1.0.20 * include all our patches ++++++ dhcpv6-1.0.20-Do-not-add-an-invalid-IA-Address-option-to.patch ++++++
From 4f3c9bc0768329152bb08020772dd61850657234 Mon Sep 17 00:00:00 2001 From: Mitsuru Chinen <mitch@linux.vnet.ibm.com> Date: Fri, 29 Aug 2008 22:12:47 +0900 Subject: [PATCH] [dhcp6s] Do not add an invalid IA Address option to an IA
An invalid IA Address option was added to an IA when status code option is in a Solicit or a Request message by mistake Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com> --- src/common.c | 42 +++++++++++++++++++++++++----------------- 1 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/common.c b/src/common.c index 9353f24..dd447b6 100644 --- a/src/common.c +++ b/src/common.c @@ -98,6 +98,7 @@ static int get_assigned_ipv6addrs __P((unsigned char *, unsigned char *, struct ia_listval *)); static int dhcp6_set_ia_options __P((unsigned char **, int *, struct ia_listval *)); +static int ia_add_address __P((struct ia_listval *, struct dhcp6_addr *)); struct dhcp6_if *find_ifconfbyname(const char *ifname) { struct dhcp6_if *ifp; @@ -1402,6 +1403,8 @@ static int get_assigned_ipv6addrs(unsigned char *p, unsigned char *ep, default: goto malformed; } + if (ia_add_address(ia, &addr6)) + goto fail; break; case DH6OPT_IAPREFIX: if (optlen < sizeof(pi) - sizeof(u_int32_t)) @@ -1448,27 +1451,12 @@ static int get_assigned_ipv6addrs(unsigned char *p, unsigned char *ep, default: goto malformed; } + if (ia_add_address(ia, &addr6)) + goto fail; break; default: goto malformed; } - - /* set up address type */ - addr6.type = ia->type; - if (dhcp6_find_listval(&ia->addr_list, - &addr6, DHCP6_LISTVAL_DHCP6ADDR)) { - dhcpv6_dprintf(LOG_INFO, "duplicated address (%s/%d)", - in6addr2str(&addr6.addr, 0), addr6.plen); - /* XXX: decline message */ - continue; - } - - if (dhcp6_add_listval(&ia->addr_list, &addr6, - DHCP6_LISTVAL_DHCP6ADDR) == NULL) { - dhcpv6_dprintf(LOG_ERR, "%s" "failed to copy an " - "address", FNAME); - goto fail; - } } return 0; @@ -1481,6 +1469,26 @@ fail: return -1; } +static int ia_add_address(struct ia_listval *ia, struct dhcp6_addr *addr6) { + /* set up address type */ + addr6->type = ia->type; + if (dhcp6_find_listval(&ia->addr_list, + addr6, DHCP6_LISTVAL_DHCP6ADDR)) { + dhcpv6_dprintf(LOG_INFO, "duplicated address (%s/%d)", + in6addr2str(&addr6->addr, 0), addr6->plen); + /* XXX: decline message */ + return 0; + } + + if (dhcp6_add_listval(&ia->addr_list, addr6, + DHCP6_LISTVAL_DHCP6ADDR) == NULL) { + dhcpv6_dprintf(LOG_ERR, "%s" "failed to copy an " + "address", FNAME); + return -1; + } + return 0; +} + #define COPY_OPTION(t, l, v, p) do { \ if ((void *)(ep) - (void *)(p) < (l) + sizeof(struct dhcp6opt)) { \ dhcpv6_dprintf(LOG_INFO, "%s" "option buffer short for %s", FNAME, dhcp6optstr((t))); \ -- 1.5.5.1 ++++++ dhcpv6-1.0.20-netconfig.dif ++++++ --- src/dhcp6c.c +++ src/dhcp6c.c 2008/08/26 11:51:53 @@ -91,6 +91,19 @@ #include "libdhcp_control.h" #endif +#ifdef WITH_NETCONFIG +#ifndef _GNU_SOURCE + #define _GNU_SOURCE + #include <getopt.h> + #undef _GNU_SOURCE +#else + #include <getopt.h> +#endif +#include "netconfig.h" + +static int use_netconfig = 0; +#endif + static int debug = 0; static u_long sig_flags = 0; @@ -195,6 +208,12 @@ int dhcpv6_client(LIBDHCP_Control *libdh char *progname, *conffile = DHCP6C_CONF; FILE *pidfp; char *addr; +#ifdef WITH_NETCONFIG + struct option long_options[] = { + {"netconfig", no_argument, NULL, 0x0100}, + { NULL, 0, NULL, 0 } + }; +#endif #ifdef LIBDHCP libdhcp_control = libdhcp_ctl; @@ -211,8 +230,17 @@ int dhcpv6_client(LIBDHCP_Control *libdh progname++; TAILQ_INIT(&request_list); +#ifdef WITH_NETCONFIG + while ((ch = getopt_long(argc, argv, "c:r:R:P:vfIp:", + long_options, NULL)) != -1) { + switch (ch) { + case 0x0100: + use_netconfig = 1; + break; +#else while ((ch = getopt(argc, argv, "c:r:R:P:vfIp:")) != -1) { switch (ch) { +#endif case 'p': if (strlen(optarg) >= MAXPATHLEN) { dhcpv6_dprintf(LOG_ERR, "pid file name is too long"); @@ -931,11 +959,25 @@ static void free_resources(struct dhcp6_ dhcp6_remove_event(ev); } - /* restore /etc/resolv.conf.dhcpv6.bak back to /etc/resolv.conf */ - if (!lstat(RESOLV_CONF_BAK_FILE, &buf)) { - if (rename(RESOLV_CONF_BAK_FILE, RESOLV_CONF_FILE)) - dhcpv6_dprintf(LOG_ERR, "%s" " failed to backup resolv.conf", - FNAME); +#ifdef WITH_NETCONFIG + if(use_netconfig) + { + int ret = netconfig_remove("dhcp6c", debug, ifp->ifname); + dhcpv6_dprintf(LOG_DEBUG, "netconfig remove(%s): status %d", + ifp->ifname, ret); + } + else +#endif +#ifdef LIBDHCP + if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RESOLVER)) +#endif + { + /* restore /etc/resolv.conf.dhcpv6.bak back to /etc/resolv.conf */ + if (!lstat(RESOLV_CONF_BAK_FILE, &buf)) { + if (rename(RESOLV_CONF_BAK_FILE, RESOLV_CONF_FILE)) + dhcpv6_dprintf(LOG_ERR, "%s" " failed to backup resolv.conf", + FNAME); + } } free_servers(ifp); @@ -1837,6 +1879,15 @@ static int client6_recvreply(struct dhcp return -1; } +#ifdef WITH_NETCONFIG + if (use_netconfig) + { + int ret = netconfig_modify("dhcp6c", debug, ifp->ifname, optinfo, ifp); + dhcpv6_dprintf(LOG_DEBUG, "netconfig modify(%s): status %d", + ifp->ifname, ret); + } + else +#endif if (!TAILQ_EMPTY(&optinfo->dns_list.addrlist) || optinfo->dns_list.domainlist != NULL) { #ifdef LIBDHCP @@ -2401,3 +2452,8 @@ static void setup_interface(char *ifname return; } + +#ifdef WITH_NETCONFIG +#include "netconfig.c" +#endif + --- src/netconfig.c +++ src/netconfig.c 2008/08/19 20:36:54 @@ -0,0 +1,242 @@ +#ifdef WITH_NETCONFIG +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/wait.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include "netconfig.h" + +static int do_netconfig_restore = 0; + +int netconfig_modify(const char *service, int verbose, const char *ifname, + struct dhcp6_optinfo *optinfo, struct dhcp6_if *ifp) +{ + if(getuid() != 0 || geteuid() != 0) + { + return -1; + } + + if( !service || !ifname || !optinfo || !ifp) + { + return -1; + } + + int rc; + int fd[2] = {-1, -1}; + rc = socketpair(AF_LOCAL, SOCK_STREAM, PF_LOCAL, fd); + if(rc == -1) + { + return -1; + } + + pid_t pid; + pid = fork(); + if(pid == 0) + { + char *argv[] = { + "/sbin/netconfig", + "modify", + "-s", (char *)service, + "-i", (char *)ifname, + (verbose ? "-v" : NULL), + NULL + }; + extern char **environ; + + close(fd[0]); + if(dup2(fd[1], fileno(stdin)) == fileno(stdin)) + { + close(fd[1]); + if(freopen("/dev/null", "w", stdout) && + freopen("/dev/null", "w", stderr)) + { + execve(argv[0], argv, environ); + } + } else { + close(fd[1]); + } + exit(127); + } + else + if(pid > 0) + { + close(fd[1]); + FILE *out = fdopen(fd[0], "w"); + if( out) + { + fprintf(out, "INTERFACE='%s'\n", ifname); +#if 0 + /* + ** FIXME: the optinfo struct changed between 1.0.11 and 1.0.20 + ** not a problem, since IPADDR is informational only + */ + struct ia_listval *ia = ia_find_listval(&optinfo->ia_list, ...); + + if(!TAILQ_EMPTY(&ia->addr_list)) + { + struct dhcp6_listval *lv; + size_t i = 0; + fprintf(out, "IPADDR='"); + for (lv = TAILQ_FIRST(&ia->addr_list); + lv; + lv = TAILQ_NEXT(lv, link), i++) + { + if (lv->val_dhcp6addr.type != IAPD) { + u_int8_t plen = lv->val_dhcp6addr.plen ? + lv->val_dhcp6addr.plen : + dhcp6_get_prefixlen(&lv->val_dhcp6addr.addr, ifp); + + dhcpv6_dprintf(LOG_DEBUG, + "netconfig modify(%s): " + "IPADDR+='%s/%u'", + ifname, + in6addr2str(&lv->val_dhcp6addr.addr, 0), + plen); + fprintf(out, "%s%s", + (i == 0 ? "" : " "), + in6addr2str(&lv->val_dhcp6addr.addr, 0)); + if( plen) + fprintf(out, "/%u", plen); + } + } + fprintf(out, "'\n"); + } +#endif + fprintf(out, "DNSSERVERS='"); + if (!TAILQ_EMPTY(&optinfo->dns_list.addrlist)) + { + struct dhcp6_listval *d; + size_t i = 0; + for (d = TAILQ_FIRST(&optinfo->dns_list.addrlist); + d; + d = TAILQ_NEXT(d, link), i++) + { + dhcpv6_dprintf(LOG_DEBUG, + "netconfig modify(%s): " + "DNSSERVERS+='%s'", + ifname, + in6addr2str(&d->val_addr6, 0)); + + fprintf(out, "%s%s", + (i == 0 ? "" : " "), + in6addr2str(&d->val_addr6, 0)); + } + } + else + { + dhcpv6_dprintf(LOG_DEBUG, "netconfig modify(%s): " + "no DNS server available", ifname); + } + fprintf(out, "'\n"); + + fprintf(out, "DNSSEARCH='"); + if (optinfo->dns_list.domainlist) + { + struct domain_list *dlist; + size_t i = 0; + for (dlist = optinfo->dns_list.domainlist; + dlist; + dlist = dlist->next, i++) + { + dhcpv6_dprintf(LOG_DEBUG, + "netconfig modify(%s): " + "DNSSEARCH+='%s'", + ifname, + dlist->name); + + fprintf(out, "%s%s", + (i == 0 ? "" : " "), + dlist->name); + } + } + else + { + dhcpv6_dprintf(LOG_DEBUG, "netconfig modify(%s): " + "no DNS search list available", ifname); + } + fprintf(out, "'\n"); + + fclose(out); + } + else + { + close(fd[0]); + } + + /* wait for child even unable to write */ + int err; + int ret = 0; + do + { + err = waitpid(pid, &ret, 0); + } while(err == -1 && errno == EINTR); + + do_netconfig_restore++; + + return (((ret & 0x7f)==0) ? + ((ret >> 8) & 0xff) : + -(ret & 0x7f)); + } + return -1; +} + +int netconfig_remove(const char *service, int verbose, const char *ifname) +{ + if(getuid() != 0 || geteuid() != 0) + { + return -1; + } + + if( !service || !ifname) + { + return -1; + } + + if( do_netconfig_restore == 0) + { + return 0; + } + + pid_t pid; + + pid = fork(); + if(pid == 0) + { + char *argv[] = { + "/sbin/netconfig", + "remove", + "-s", (char *)service, + "-i", (char *)ifname, + (verbose ? "-v" : NULL), + NULL + }; + extern char **environ; + + if(freopen("/dev/null", "r", stdin) && + freopen("/dev/null", "w", stdout) && + freopen("/dev/null", "w", stderr)) + { + execve(argv[0], argv, environ); + } + exit(127); + } + else + if(pid > 0) + { + int err; + int ret = 0; + do + { + err = waitpid(pid, &ret, 0); + } while(err == -1 && errno == EINTR); + + do_netconfig_restore = 0; + + return (((ret & 0x7f)==0) ? + ((ret >> 8) & 0xff) : + -(ret & 0x7f)); + } + return -1; +} +#endif --- src/netconfig.h +++ src/netconfig.h 2008/08/19 12:38:29 @@ -0,0 +1,12 @@ +#ifdef WITH_NETCONFIG +#ifndef NETCONFIG_H +#define NETCONFIG_H +#include "dhcp6.h" + +int netconfig_modify(const char *service, int verbose, const char *ifname, + struct dhcp6_optinfo *optinfo, struct dhcp6_if *ifp); + +int netconfig_remove(const char *service, int verbose, const char *ifname); + +#endif +#endif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de