Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 322144 Details for
Bug 432652
net-misc/dhcp - dhclient (ipv6) not enabled for ppp devices
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
dhclient ppp fix
dhcp-4.2.4-P1.patch (text/plain), 6.17 KB, created by
Andreas Steinmetz
on 2012-08-25 01:23:35 UTC
(
hide
)
Description:
dhclient ppp fix
Filename:
MIME Type:
Creator:
Andreas Steinmetz
Created:
2012-08-25 01:23:35 UTC
Size:
6.17 KB
patch
obsolete
>diff -rNu dhcp-4.2.4-P1.orig/client/dhc6.c dhcp-4.2.4-P1/client/dhc6.c >--- dhcp-4.2.4-P1.orig/client/dhc6.c 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/client/dhc6.c 2012-08-25 03:02:18.622369238 +0200 >@@ -131,18 +131,54 @@ > * is not how it is intended. Upcoming rearchitecting the client should > * address this "one daemon model." > */ >-void >+isc_result_t > form_duid(struct data_string *duid, const char *file, int line) > { > struct interface_info *ip; > int len; >+ int fd; >+ int flag; > > /* For now, just use the first interface on the list. */ > ip = interfaces; >+ flag = 0; > > if (ip == NULL) > log_fatal("Impossible condition at %s:%d.", MDL); > >+ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) { >+ fd = open("/dev/urandom", O_RDONLY); >+ if (fd != -1) { >+ if(read(fd, ip->hw_address.hbuf + 1, 6) == 6) { >+ ip->hw_address.hbuf[0] = HTYPE_ETHER; >+ ip->hw_address.hlen = 7; >+ close(fd); >+ flag = 1; >+ break; >+ } >+ close(fd); >+ } >+ if (!ip->hw_address.hlen && ip->v6address_count) { >+ ip->hw_address.hbuf[0] = HTYPE_ETHER; >+ ip->hw_address.hlen = 7; >+ memcpy(ip->hw_address.hbuf + 1, >+ ip->v6addresses[0].s6_addr, 6); >+ for(len = 0 ; len < 10 ; len ++) { >+ fd = len % 6; >+ ip->hw_address.hbuf[fd + 1] ^= >+ ip->v6addresses[0].s6_addr[len + 6]; >+ } >+ flag = 1; >+ break; >+ } >+ /* Try the other interfaces */ >+ log_debug("Cannot form default DUID from interface %s.", ip->name); >+ ip = ip->next; >+ } >+ if (ip == NULL) { >+ return ISC_R_UNEXPECTED; >+ } >+ > if ((ip->hw_address.hlen == 0) || > (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf))) > log_fatal("Impossible hardware address length at %s:%d.", MDL); >@@ -178,6 +214,9 @@ > memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1, > ip->hw_address.hlen - 1); > } >+ if (flag) >+ memset(ip->hw_address.hbuf, 0, 7); >+ return ISC_R_SUCCESS; > } > > /* >@@ -4945,7 +4984,8 @@ > */ > if ((oc = lookup_option(&dhcpv6_universe, *op, > D6O_CLIENTID)) == NULL) { >- if (!option_cache(&oc, &default_duid, NULL, clientid_option, >+ if (default_duid.len == 0 || >+ !option_cache(&oc, &default_duid, NULL, clientid_option, > MDL)) > log_fatal("Failure assembling a DUID."); > >diff -rNu dhcp-4.2.4-P1.orig/client/dhclient.c dhcp-4.2.4-P1/client/dhclient.c >--- dhcp-4.2.4-P1.orig/client/dhclient.c 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/client/dhclient.c 2012-08-24 18:08:58.212309579 +0200 >@@ -573,8 +573,8 @@ > if (default_duid.buffer != NULL) > data_string_forget(&default_duid, MDL); > >- form_duid(&default_duid, MDL); >- write_duid(&default_duid); >+ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS) >+ write_duid(&default_duid); > } > > for (ip = interfaces ; ip != NULL ; ip = ip->next) { >diff -rNu dhcp-4.2.4-P1.orig/common/bpf.c dhcp-4.2.4-P1/common/bpf.c >--- dhcp-4.2.4-P1.orig/common/bpf.c 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/common/bpf.c 2012-08-24 18:08:58.213309578 +0200 >@@ -599,6 +599,22 @@ > memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen); > break; > #endif /* IFT_FDDI */ >+#if defined(IFT_PPP) >+ case IFT_PPP: >+ if (local_family != AF_INET6) >+ log_fatal("Unsupported device type %d for \"%s\"", >+ sa->sdl_type, name); >+ hw->hlen = 0; >+ hw->hbuf[0] = HTYPE_RESERVED; >+ /* 0xdeadbeef should never occur on the wire, and is a signature that >+ * something went wrong. >+ */ >+ hw->hbuf[1] = 0xde; >+ hw->hbuf[2] = 0xad; >+ hw->hbuf[3] = 0xbe; >+ hw->hbuf[4] = 0xef; >+ break; >+#endif > default: > log_fatal("Unsupported device type %d for \"%s\"", > sa->sdl_type, name); >diff -rNu dhcp-4.2.4-P1.orig/common/lpf.c dhcp-4.2.4-P1/common/lpf.c >--- dhcp-4.2.4-P1.orig/common/lpf.c 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/common/lpf.c 2012-08-24 18:08:58.213309578 +0200 >@@ -460,6 +460,22 @@ > hw->hbuf[0] = HTYPE_FDDI; > memcpy(&hw->hbuf[1], sa->sa_data, 16); > break; >+#if defined(ARPHRD_PPP) >+ case ARPHRD_PPP: >+ if (local_family != AF_INET6) >+ log_fatal("Unsupported device type %d for \"%s\"", >+ sa->sa_family, name); >+ hw->hlen = 0; >+ hw->hbuf[0] = HTYPE_RESERVED; >+ /* 0xdeadbeef should never occur on the wire, and is a signature that >+ * something went wrong. >+ */ >+ hw->hbuf[1] = 0xde; >+ hw->hbuf[2] = 0xad; >+ hw->hbuf[3] = 0xbe; >+ hw->hbuf[4] = 0xef; >+ break; >+#endif > default: > log_fatal("Unsupported device type %ld for \"%s\"", > (long int)sa->sa_family, name); >diff -rNu dhcp-4.2.4-P1.orig/includes/dhcp.h dhcp-4.2.4-P1/includes/dhcp.h >--- dhcp-4.2.4-P1.orig/includes/dhcp.h 2012-07-13 08:10:30.000000000 +0200 >+++ dhcp-4.2.4-P1/includes/dhcp.h 2012-08-24 18:08:58.215309576 +0200 >@@ -85,6 +85,8 @@ > * is no standard for this so we > * just steal a type */ > >+#define HTYPE_RESERVED 0 /* RFC 5494 */ >+ > /* Magic cookie validating dhcp options field (and bootp vendor > extensions field). */ > #define DHCP_OPTIONS_COOKIE "\143\202\123\143" >diff -rNu dhcp-4.2.4-P1.orig/includes/dhcpd.h dhcp-4.2.4-P1/includes/dhcpd.h >--- dhcp-4.2.4-P1.orig/includes/dhcpd.h 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/includes/dhcpd.h 2012-08-24 18:08:58.214309577 +0200 >@@ -2763,7 +2763,7 @@ > void dhcpv6_client_assignments(void); > > /* dhc6.c */ >-void form_duid(struct data_string *duid, const char *file, int line); >+isc_result_t form_duid(struct data_string *duid, const char *file, int line); > void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line); > void start_init6(struct client_state *client); > void start_info_request6(struct client_state *client); >diff -rNu dhcp-4.2.4-P1.orig/server/dhcpv6.c dhcp-4.2.4-P1/server/dhcpv6.c >--- dhcp-4.2.4-P1.orig/server/dhcpv6.c 2012-07-13 08:18:05.000000000 +0200 >+++ dhcp-4.2.4-P1/server/dhcpv6.c 2012-08-24 18:08:58.217309574 +0200 >@@ -300,6 +300,9 @@ > if (p->hw_address.hlen > 0) { > break; > } >+ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) { >+ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!"); >+ } > } > if (p == NULL) { > return ISC_R_UNEXPECTED;
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 432652
:
322144
|
389858