summaryrefslogtreecommitdiff
blob: 2a7f8183d4e084ee1d16fbbf88a5927369af4a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
https://bugs.gentoo.org/559832

the get_client_id func is used outside of IPv6 code, so don't store it in the
IPv6-specific dhcpv6.c file.  otherwise, building w/out IPv6 & w/ldap yields:
dhcpd-ldap.o: In function 'find_client_in_ldap':
ldap.c:(.text+0x4774): undefined reference to 'get_client_id'

--- a/server/dhcpleasequery.c
+++ b/server/dhcpleasequery.c
@@ -33,6 +33,34 @@
  *       DoS'ed by DHCPLEASEQUERY message.
  */
 
+/*
+ * Get the client identifier from the packet.
+ */
+isc_result_t
+get_client_id(struct packet *packet, struct data_string *client_id) {
+	struct option_cache *oc;
+
+	/*
+	 * Verify our client_id structure is empty.
+	 */
+	if ((client_id->data != NULL) || (client_id->len != 0)) {
+		return DHCP_R_INVALIDARG;
+	}
+
+	oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
+	if (oc == NULL) {
+		return ISC_R_NOTFOUND;
+	}
+
+	if (!evaluate_option_cache(client_id, packet, NULL, NULL,
+				   packet->options, NULL,
+				   &global_scope, oc, MDL)) {
+		return ISC_R_FAILURE;
+	}
+
+	return ISC_R_SUCCESS;
+}
+
 /* 
  * If you query by hardware address or by client ID, then you may have
  * more than one IP address for your query argument. We need to do two
--- a/server/dhcpv6.c
+++ b/server/dhcpv6.c
@@ -392,34 +392,6 @@ generate_new_server_duid(void) {
 }
 
 /*
- * Get the client identifier from the packet.
- */
-isc_result_t
-get_client_id(struct packet *packet, struct data_string *client_id) {
-	struct option_cache *oc;
-
-	/*
-	 * Verify our client_id structure is empty.
-	 */
-	if ((client_id->data != NULL) || (client_id->len != 0)) {
-		return DHCP_R_INVALIDARG;
-	}
-
-	oc = lookup_option(&dhcpv6_universe, packet->options, D6O_CLIENTID);
-	if (oc == NULL) {
-		return ISC_R_NOTFOUND;
-	}
-
-	if (!evaluate_option_cache(client_id, packet, NULL, NULL,
-				   packet->options, NULL,
-				   &global_scope, oc, MDL)) {
-		return ISC_R_FAILURE;
-	}
-
-	return ISC_R_SUCCESS;
-}
-
-/*
  * Message validation, defined in RFC 3315, sections 15.2, 15.5, 15.7:
  *
  *    Servers MUST discard any Solicit messages that do not include a