Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 291437 Details for
Bug 377101
TAHI--DHCPv6--DUID cannot be kept consistent
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
dhcpv6-1.0.4-bz377101.patch
dhcpv6-1.0.4-bz377101.patch (text/plain), 5.09 KB, created by
David Cantrell
on 2008-01-11 23:09:16 UTC
(
hide
)
Description:
dhcpv6-1.0.4-bz377101.patch
Filename:
MIME Type:
Creator:
David Cantrell
Created:
2008-01-11 23:09:16 UTC
Size:
5.09 KB
patch
obsolete
>diff --git a/configure.ac b/configure.ac >index d52a112..dfb981b 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -19,7 +19,7 @@ dnl > dnl Red Hat Author: David Cantrell <dcantrell@redhat.com> > > AC_PREREQ(2.61) >-AC_INIT([dhcpv6], [1.0.4], [dcantrell@redhat.com]) >+AC_INIT([dhcpv6], [1.0.5], [dcantrell@redhat.com]) > AM_INIT_AUTOMAKE > AC_CONFIG_SRCDIR([src/dhcp6s.c]) > AC_CONFIG_HEADER([config.h]) >@@ -36,9 +36,9 @@ dnl function signatures changed), > dnl set DHCPV6_BINARY_AGE and DHCPV6_INTERFACE_AGE to 0. > DHCPV6_MAJOR_VERSION=1 > DHCPV6_MINOR_VERSION=0 >-DHCPV6_MICRO_VERSION=4 >-DHCPV6_INTERFACE_AGE=2 >-DHCPV6_BINARY_AGE=2 >+DHCPV6_MICRO_VERSION=5 >+DHCPV6_INTERFACE_AGE=3 >+DHCPV6_BINARY_AGE=3 > DHCPV6_VERSION_SUFFIX= > DHCPV6_VERSION=$DHCPV6_MAJOR_VERSION.$DHCPV6_MINOR_VERSION.$DHCPV6_MICRO_VERSION$DHCPV6_VERSION_SUFFIX > >diff --git a/include/common.h b/include/common.h >index 3058596..ba1937c 100644 >--- a/include/common.h >+++ b/include/common.h >@@ -80,6 +80,8 @@ extern void dprintf __P((int, const char *, ...)); > #endif > > extern int get_duid __P((const char *, const char *, struct duid *)); >+extern int save_duid __P((const char *, const char *, struct duid *)); >+extern u_int16_t calculate_duid_len __P((const char *)); > extern void dhcp6_init_options __P((struct dhcp6_optinfo *)); > extern void dhcp6_clear_options __P((struct dhcp6_optinfo *)); > extern int dhcp6_copy_options __P((struct dhcp6_optinfo *, >diff --git a/src/common.c b/src/common.c >index 858ac70..913b0a1 100644 >--- a/src/common.c >+++ b/src/common.c >@@ -721,14 +721,7 @@ get_duid(const char *idfile, const char *ifname, > goto fail; > } > } else { >- int l; >- >- if ((l = gethwid(tmpbuf, sizeof(tmpbuf), ifname, &hwtype)) < 0) { >- dprintf(LOG_INFO, "%s" >- "failed to get a hardware address", FNAME); >- goto fail; >- } >- len = l + sizeof(struct dhcp6_duid_type1); >+ len = calculate_duid_len(ifname); > } > > memset(duid, 0, sizeof(*duid)); >@@ -763,29 +756,57 @@ get_duid(const char *idfile, const char *ifname, > duidstr(duid)); > } > >+ /* save DUID */ >+ if (save_duid(idfile, ifname, duid)) { >+ dprintf(LOG_DEBUG, "%s" "failed to save DUID: %s", FNAME, >+ duidstr(duid)); >+ goto fail; >+ } >+ >+ if (fp) >+ fclose(fp); >+ return (0); >+ >+fail: >+ if (fp) >+ fclose(fp); >+ if (duid->duid_id != NULL) { >+ duidfree(duid); >+ } >+ return (-1); >+} >+ >+int >+save_duid(const char *idfile, const char *ifname, struct duid *duid) >+{ >+ FILE *fp = NULL; >+ u_int16_t len = 0; >+ >+ /* calculate DUID length */ >+ len = calculate_duid_len(ifname); >+ > /* save the (new) ID to the file for next time */ > #ifdef LIBDHCP > if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) > #endif >- if (!fp) { >- if ((fp = fopen(idfile, "w+")) == NULL) { >- dprintf(LOG_ERR, "%s" >- "failed to open DUID file for save", FNAME); >- goto fail; >- } >- if ((fwrite(&len, sizeof(len), 1, fp)) != 1) { >- dprintf(LOG_ERR, "%s" "failed to save DUID", FNAME); >- goto fail; >- } >- if ((fwrite(duid->duid_id, len, 1, fp)) != 1) { >- dprintf(LOG_ERR, "%s" "failed to save DUID", FNAME); >- goto fail; >- } >+ if ((fp = fopen(idfile, "w+")) == NULL) { >+ dprintf(LOG_ERR, "%s" >+ "failed to open DUID file for save", FNAME); >+ goto fail; >+ } > >- dprintf(LOG_DEBUG, "%s" "saved generated DUID to %s", FNAME, >- idfile); >+ if ((fwrite(&len, sizeof(len), 1, fp)) != 1) { >+ dprintf(LOG_ERR, "%s" "failed to save DUID", FNAME); >+ goto fail; > } > >+ if ((fwrite(duid->duid_id, len, 1, fp)) != 1) { >+ dprintf(LOG_ERR, "%s" "failed to save DUID", FNAME); >+ goto fail; >+ } >+ >+ dprintf(LOG_DEBUG, "%s" "saved generated DUID to %s", FNAME, idfile); >+ > if (fp) > fclose(fp); > return (0); >@@ -799,6 +820,24 @@ get_duid(const char *idfile, const char *ifname, > return (-1); > } > >+u_int16_t >+calculate_duid_len(const char *ifname) >+{ >+ int l; >+ u_int16_t ret = 0, hwtype; >+ struct dhcp6_duid_type1 *dp; /* we only support the type1 DUID */ >+ unsigned char tmpbuf[256]; /* DUID should be no more than 256 bytes */ >+ >+ if ((l = gethwid(tmpbuf, sizeof(tmpbuf), ifname, &hwtype)) < 0) { >+ dprintf(LOG_INFO, "%s" >+ "failed to get a hardware address", FNAME); >+ return 0; >+ } >+ >+ ret = l + sizeof(struct dhcp6_duid_type1); >+ return ret; >+} >+ > ssize_t > gethwid(buf, len, ifname, hwtypep) > unsigned char *buf; >diff --git a/src/dhcp6c.c b/src/dhcp6c.c >index 14e589e..255b161 100644 >--- a/src/dhcp6c.c >+++ b/src/dhcp6c.c >@@ -555,6 +555,7 @@ client6_ifinit(char *device) > memcpy(&client6_iaidaddr.client6_info.iaidinfo, &ifp->iaidinfo, > sizeof(client6_iaidaddr.client6_info.iaidinfo)); > duidcpy(&client6_iaidaddr.client6_info.clientid, &client_duid); >+ save_duid(DUID_FILE, device, &client_duid); > #ifdef LIBDHCP > if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) { > #endif >@@ -1050,6 +1051,12 @@ client6_send(ev) > goto end; > } > >+ /* save DUID now for persistent DUID (e.g., if client reboots) */ >+ if (save_duid(DUID_FILE, device, &client_duid)) { >+ dprintf(LOG_ERR, "%s" "failed to save client ID", FNAME); >+ goto end; >+ } >+ > /* option request options */ > if (dhcp6_copy_list(&optinfo.reqopt_list, &ifp->reqopt_list)) { > dprintf(LOG_ERR, "%s" "failed to copy requested options",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 377101
:
291437
|
291438
|
319707