]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/dhcp/dhcp-PPP.patch
aarch64: Fix rootfile for Python
[people/pmueller/ipfire-2.x.git] / src / patches / dhcp / dhcp-PPP.patch
CommitLineData
c1e9ba67
MF
1diff -up dhcp-4.3.1b1/client/dhc6.c.mRfpsB dhcp-4.3.1b1/client/dhc6.c
2--- dhcp-4.3.1b1/client/dhc6.c.mRfpsB 2014-07-10 17:48:03.779424870 +0200
3+++ dhcp-4.3.1b1/client/dhc6.c 2014-07-10 17:48:03.795424644 +0200
4@@ -5088,7 +5088,8 @@ make_client6_options(struct client_state
5 */
6 if ((oc = lookup_option(&dhcpv6_universe, *op,
7 D6O_CLIENTID)) == NULL) {
8- if (!option_cache(&oc, &default_duid, NULL, clientid_option,
9+ if (default_duid.len == 0 ||
10+ !option_cache(&oc, &default_duid, NULL, clientid_option,
11 MDL))
12 log_fatal("Failure assembling a DUID.");
13
14diff -up dhcp-4.3.1b1/client/dhclient.c.mRfpsB dhcp-4.3.1b1/client/dhclient.c
15--- dhcp-4.3.1b1/client/dhclient.c.mRfpsB 2014-07-10 17:39:25.853763858 +0200
16+++ dhcp-4.3.1b1/client/dhclient.c 2014-07-10 17:49:49.882925843 +0200
17@@ -948,8 +948,8 @@ main(int argc, char **argv) {
18 if (default_duid.buffer != NULL)
19 data_string_forget(&default_duid, MDL);
20
21- form_duid(&default_duid, MDL);
22- write_duid(&default_duid);
23+ if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS)
24+ write_duid(&default_duid);
25 }
26 }
27
28@@ -3267,7 +3267,7 @@ write_options(struct client_state *clien
78ab9b04
MT
29 * is not how it is intended. Upcoming rearchitecting the client should
30 * address this "one daemon model."
31 */
32-void
33+isc_result_t
34 form_duid(struct data_string *duid, const char *file, int line)
35 {
36 struct interface_info *ip;
c1e9ba67 37@@ -3280,6 +3280,15 @@ form_duid(struct data_string *duid, cons
78ab9b04
MT
38 if (ip == NULL)
39 log_fatal("Impossible condition at %s:%d.", MDL);
40
41+ while (ip && ip->hw_address.hbuf[0] == HTYPE_RESERVED) {
42+ /* Try the other interfaces */
43+ log_debug("Cannot form default DUID from interface %s.", ip->name);
44+ ip = ip->next;
45+ }
46+ if (ip == NULL) {
47+ return ISC_R_UNEXPECTED;
48+ }
49+
50 if ((ip->hw_address.hlen == 0) ||
51 (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
52 log_fatal("Impossible hardware address length at %s:%d.", MDL);
c1e9ba67
MF
53@@ -3323,6 +3332,8 @@ form_duid(struct data_string *duid, cons
54 log_info("Created duid %s.", str);
55 dfree(str, MDL);
78ab9b04 56 }
c1e9ba67 57+
78ab9b04
MT
58+ return ISC_R_SUCCESS;
59 }
60
c1e9ba67
MF
61 /* Write the default DUID to the lease store. */
62diff -up dhcp-4.3.1b1/common/bpf.c.mRfpsB dhcp-4.3.1b1/common/bpf.c
63--- dhcp-4.3.1b1/common/bpf.c.mRfpsB 2014-07-10 17:39:25.797764653 +0200
64+++ dhcp-4.3.1b1/common/bpf.c 2014-07-10 17:48:03.797424616 +0200
65@@ -600,6 +600,22 @@ get_hw_addr(const char *name, struct har
78ab9b04
MT
66 memcpy(&hw->hbuf[1], LLADDR(sa), sa->sdl_alen);
67 break;
68 #endif /* IFT_FDDI */
69+#if defined(IFT_PPP)
70+ case IFT_PPP:
71+ if (local_family != AF_INET6)
72+ log_fatal("Unsupported device type %d for \"%s\"",
73+ sa->sdl_type, name);
74+ hw->hlen = 0;
75+ hw->hbuf[0] = HTYPE_RESERVED;
76+ /* 0xdeadbeef should never occur on the wire,
77+ * and is a signature that something went wrong.
78+ */
79+ hw->hbuf[1] = 0xde;
80+ hw->hbuf[2] = 0xad;
81+ hw->hbuf[3] = 0xbe;
82+ hw->hbuf[4] = 0xef;
83+ break;
84+#endif
85 default:
86 log_fatal("Unsupported device type %d for \"%s\"",
87 sa->sdl_type, name);
c1e9ba67
MF
88diff -up dhcp-4.3.1b1/common/lpf.c.mRfpsB dhcp-4.3.1b1/common/lpf.c
89--- dhcp-4.3.1b1/common/lpf.c.mRfpsB 2014-07-10 17:39:25.744765404 +0200
90+++ dhcp-4.3.1b1/common/lpf.c 2014-07-10 17:48:03.797424616 +0200
91@@ -511,6 +511,22 @@ get_hw_addr(const char *name, struct har
78ab9b04 92 hw->hbuf[0] = HTYPE_FDDI;
c1e9ba67 93 memcpy(&hw->hbuf[1], sa->sa_data, 6);
78ab9b04
MT
94 break;
95+#if defined(ARPHRD_PPP)
96+ case ARPHRD_PPP:
97+ if (local_family != AF_INET6)
98+ log_fatal("Unsupported device type %d for \"%s\"",
99+ sa->sa_family, name);
100+ hw->hlen = 0;
101+ hw->hbuf[0] = HTYPE_RESERVED;
102+ /* 0xdeadbeef should never occur on the wire,
103+ * and is a signature that something went wrong.
104+ */
105+ hw->hbuf[1] = 0xde;
106+ hw->hbuf[2] = 0xad;
107+ hw->hbuf[3] = 0xbe;
108+ hw->hbuf[4] = 0xef;
109+ break;
110+#endif
111 default:
112 log_fatal("Unsupported device type %ld for \"%s\"",
113 (long int)sa->sa_family, name);
c1e9ba67
MF
114diff -up dhcp-4.3.1b1/includes/dhcpd.h.mRfpsB dhcp-4.3.1b1/includes/dhcpd.h
115--- dhcp-4.3.1b1/includes/dhcpd.h.mRfpsB 2014-07-10 17:48:03.761425124 +0200
116+++ dhcp-4.3.1b1/includes/dhcpd.h 2014-07-10 17:48:03.798424601 +0200
117@@ -2839,7 +2839,7 @@ void client_dns_remove(struct client_sta
78ab9b04 118
c1e9ba67
MF
119 void dhcpv4_client_assignments(void);
120 void dhcpv6_client_assignments(void);
78ab9b04
MT
121-void form_duid(struct data_string *duid, const char *file, int line);
122+isc_result_t form_duid(struct data_string *duid, const char *file, int line);
c1e9ba67
MF
123
124 /* dhc6.c */
78ab9b04 125 void dhc6_lease_destroy(struct dhc6_lease **src, const char *file, int line);
c1e9ba67
MF
126diff -up dhcp-4.3.1b1/includes/dhcp.h.mRfpsB dhcp-4.3.1b1/includes/dhcp.h
127--- dhcp-4.3.1b1/includes/dhcp.h.mRfpsB 2014-07-10 17:48:03.761425124 +0200
128+++ dhcp-4.3.1b1/includes/dhcp.h 2014-07-10 17:48:03.798424601 +0200
129@@ -81,6 +81,8 @@ struct dhcp_packet {
130 * is no standard for this so we
131 * just steal a type */
78ab9b04 132
c1e9ba67 133+#define HTYPE_RESERVED 0 /* RFC 5494 */
78ab9b04
MT
134+
135 /* Magic cookie validating dhcp options field (and bootp vendor
136 extensions field). */
137 #define DHCP_OPTIONS_COOKIE "\143\202\123\143"
c1e9ba67
MF
138diff -up dhcp-4.3.1b1/server/dhcpv6.c.mRfpsB dhcp-4.3.1b1/server/dhcpv6.c
139--- dhcp-4.3.1b1/server/dhcpv6.c.mRfpsB 2014-07-10 17:47:31.464881409 +0200
140+++ dhcp-4.3.1b1/server/dhcpv6.c 2014-07-10 17:48:03.800424573 +0200
141@@ -330,6 +330,9 @@ generate_new_server_duid(void) {
78ab9b04
MT
142 if (p->hw_address.hlen > 0) {
143 break;
144 }
145+ if (p->next == NULL && p->hw_address.hbuf[0] == HTYPE_RESERVED) {
146+ log_error("Can not generate DUID from interfaces which do not have hardware addresses, please configure server-duid!");
147+ }
148 }
149 if (p == NULL) {
150 return ISC_R_UNEXPECTED;