]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/dhcp-4.2.0-noprefixavail.patch
firewall: add more pscan matches and filter INVALID conntrack packages.
[ipfire-2.x.git] / src / patches / dhcp-4.2.0-noprefixavail.patch
1 diff -up dhcp-4.2.0/server/dhcpv6.c.noprefixavail dhcp-4.2.0/server/dhcpv6.c
2 --- dhcp-4.2.0/server/dhcpv6.c.noprefixavail 2010-10-07 13:48:45.000000000 +0200
3 +++ dhcp-4.2.0/server/dhcpv6.c 2010-10-13 11:00:25.000000000 +0200
4 @@ -1134,7 +1134,7 @@ try_client_v6_prefix(struct iasubopt **p
5 return DHCP_R_INVALIDARG;
6 }
7 tmp_plen = (int) requested_pref->data[0];
8 - if ((tmp_plen < 3) || (tmp_plen > 128)) {
9 + if ((tmp_plen < 3) || (tmp_plen > 128) ||((int)tmp_plen != pool->units)) {
10 return ISC_R_FAILURE;
11 }
12 memcpy(&tmp_pref, requested_pref->data + 1, sizeof(tmp_pref));
13 @@ -1147,9 +1147,8 @@ try_client_v6_prefix(struct iasubopt **p
14 return ISC_R_FAILURE;
15 }
16
17 - if (((int)tmp_plen != pool->units) ||
18 - !ipv6_in_pool(&tmp_pref, pool)) {
19 - return ISC_R_FAILURE;
20 + if (!ipv6_in_pool(&tmp_pref, pool)) {
21 + return ISC_R_ADDRNOTAVAIL;
22 }
23
24 if (prefix6_exists(pool, &tmp_pref, tmp_plen)) {
25 @@ -1409,13 +1408,6 @@ lease_to_client(struct data_string *repl
26 if ((status != ISC_R_SUCCESS) &&
27 (status != ISC_R_NORESOURCES))
28 goto exit;
29 -
30 - /*
31 - * If any prefix cannot be given to any IA_PD, then
32 - * set the NoPrefixAvail status code.
33 - */
34 - if (reply.client_resources == 0)
35 - no_resources_avail = ISC_TRUE;
36 }
37
38 /*
39 @@ -1549,36 +1541,6 @@ lease_to_client(struct data_string *repl
40 reply.opt_state, reply.packet,
41 required_opts_NAA,
42 NULL);
43 - } else if (no_resources_avail && (reply.ia_count == 0) &&
44 - (reply.packet->dhcpv6_msg_type == DHCPV6_SOLICIT))
45 - {
46 - /* Set the NoPrefixAvail status code. */
47 - if (!set_status_code(STATUS_NoPrefixAvail,
48 - "No prefixes available for this "
49 - "interface.", reply.opt_state)) {
50 - log_error("lease_to_client: Unable to set "
51 - "NoPrefixAvail status code.");
52 - goto exit;
53 - }
54 -
55 - /* Rewind the cursor to the start. */
56 - reply.cursor = REPLY_OPTIONS_INDEX;
57 -
58 - /*
59 - * Produce an advertise that includes only:
60 - *
61 - * Status code.
62 - * Server DUID.
63 - * Client DUID.
64 - */
65 - reply.buf.reply.msg_type = DHCPV6_ADVERTISE;
66 - reply.cursor += store_options6((char *)reply.buf.data +
67 - reply.cursor,
68 - sizeof(reply.buf) -
69 - reply.cursor,
70 - reply.opt_state, reply.packet,
71 - required_opts_NAA,
72 - NULL);
73 } else {
74 /*
75 * Having stored the client's IA's, store any options that
76 @@ -2793,16 +2755,18 @@ find_client_temporaries(struct reply_sta
77 */
78 static isc_result_t
79 reply_process_try_addr(struct reply_state *reply, struct iaddr *addr) {
80 - isc_result_t status = ISC_R_NORESOURCES;
81 + isc_result_t status = ISC_R_ADDRNOTAVAIL;
82 struct ipv6_pool *pool;
83 int i;
84 struct data_string data_addr;
85
86 if ((reply == NULL) || (reply->shared == NULL) ||
87 - (reply->shared->ipv6_pools == NULL) || (addr == NULL) ||
88 - (reply->lease != NULL))
89 + (addr == NULL) || (reply->lease != NULL))
90 return DHCP_R_INVALIDARG;
91
92 + if (reply->shared->ipv6_pools == NULL)
93 + return ISC_R_ADDRNOTAVAIL;
94 +
95 memset(&data_addr, 0, sizeof(data_addr));
96 data_addr.len = addr->len;
97 data_addr.data = addr->iabuf;
98 @@ -3314,7 +3278,9 @@ reply_process_ia_pd(struct reply_state *
99 if (status == ISC_R_CANCELED)
100 break;
101
102 - if ((status != ISC_R_SUCCESS) && (status != ISC_R_ADDRINUSE))
103 + if ((status != ISC_R_SUCCESS) &&
104 + (status != ISC_R_ADDRINUSE) &&
105 + (status != ISC_R_ADDRNOTAVAIL))
106 goto cleanup;
107 }
108
109 @@ -3594,7 +3560,8 @@ reply_process_prefix(struct reply_state
110
111 /* Either error out or skip this prefix. */
112 if ((status != ISC_R_SUCCESS) &&
113 - (status != ISC_R_ADDRINUSE))
114 + (status != ISC_R_ADDRINUSE) &&
115 + (status != ISC_R_ADDRNOTAVAIL))
116 goto cleanup;
117
118 if (reply->lease == NULL) {
119 @@ -3773,16 +3740,18 @@ prefix_is_owned(struct reply_state *repl
120 static isc_result_t
121 reply_process_try_prefix(struct reply_state *reply,
122 struct iaddrcidrnet *pref) {
123 - isc_result_t status = ISC_R_NORESOURCES;
124 + isc_result_t status = ISC_R_ADDRNOTAVAIL;
125 struct ipv6_pool *pool;
126 int i;
127 struct data_string data_pref;
128
129 if ((reply == NULL) || (reply->shared == NULL) ||
130 - (reply->shared->ipv6_pools == NULL) || (pref == NULL) ||
131 - (reply->lease != NULL))
132 + (pref == NULL) || (reply->lease != NULL))
133 return DHCP_R_INVALIDARG;
134
135 + if (reply->shared->ipv6_pools == NULL)
136 + return ISC_R_ADDRNOTAVAIL;
137 +
138 memset(&data_pref, 0, sizeof(data_pref));
139 data_pref.len = 17;
140 if (!buffer_allocate(&data_pref.buffer, data_pref.len, MDL)) {