Project

General

Profile

services.inc.patch

Marc Posch, 06/22/2014 05:23 PM

View differences:

services.inc 2014-06-21 03:03:56.675462400 +0200
134 134
			case "assist":
135 135
				$radvdconf .= "\tAdvManagedFlag on;\n";
136 136
				$radvdconf .= "\tAdvOtherConfigFlag on;\n";
137 137
				break;
138 138
		}
139
		$radvdconf .= "\tprefix {$subnetv6}/{$ifcfgsnv6} {\n";
140
		if($carpif == true) {
141
			$radvdconf .= "\t\tDeprecatePrefix off;\n";
142
		} else {
143
			$radvdconf .= "\t\tDeprecatePrefix on;\n";
144
		}
145
		switch($dhcpv6ifconf['ramode']) {
146
			case "managed":
147
				$radvdconf .= "\t\tAdvOnLink on;\n";
148
				$radvdconf .= "\t\tAdvAutonomous off;\n";
149
				$radvdconf .= "\t\tAdvRouterAddr on;\n";
150
				break;
151
			case "router":
152
				$radvdconf .= "\t\tAdvOnLink off;\n";
153
				$radvdconf .= "\t\tAdvAutonomous off;\n";
154
				$radvdconf .= "\t\tAdvRouterAddr on;\n";
155
				break;
156
			case "assist":
157
				$radvdconf .= "\t\tAdvOnLink on;\n";
158
				$radvdconf .= "\t\tAdvAutonomous on;\n";
159
				$radvdconf .= "\t\tAdvRouterAddr on;\n";
160
				break;
161
			case "unmanaged":
162
				$radvdconf .= "\t\tAdvOnLink on;\n";
163
				$radvdconf .= "\t\tAdvAutonomous on;\n";
164
				$radvdconf .= "\t\tAdvRouterAddr on;\n";
165
				break;				
139
		if (is_array($dhcpv6ifconf['subnets']['item'])) {
140
			foreach ($dhcpv6ifconf['subnets']['item'] as $dhcpv6subnet) {
141
				$radvdconf .= "\tprefix {$dhcpv6subnet} {\n";
142
				if($carpif == true) {
143
					$radvdconf .= "\t\tDeprecatePrefix off;\n";
144
				} else {
145
					$radvdconf .= "\t\tDeprecatePrefix on;\n";
146
				}
147
				switch($dhcpv6ifconf['ramode']) {
148
					case "managed":
149
						$radvdconf .= "\t\tAdvOnLink on;\n";
150
						$radvdconf .= "\t\tAdvAutonomous off;\n";
151
						$radvdconf .= "\t\tAdvRouterAddr on;\n";
152
						break;
153
					case "router":
154
						$radvdconf .= "\t\tAdvOnLink off;\n";
155
						$radvdconf .= "\t\tAdvAutonomous off;\n";
156
						$radvdconf .= "\t\tAdvRouterAddr on;\n";
157
						break;
158
					case "assist":
159
						$radvdconf .= "\t\tAdvOnLink on;\n";
160
						$radvdconf .= "\t\tAdvAutonomous on;\n";
161
						$radvdconf .= "\t\tAdvRouterAddr on;\n";
162
						break;
163
					case "unmanaged":
164
						$radvdconf .= "\t\tAdvOnLink on;\n";
165
						$radvdconf .= "\t\tAdvAutonomous on;\n";
166
						$radvdconf .= "\t\tAdvRouterAddr on;\n";
167
						break;				
168
				}
169
				$radvdconf .= "\t};\n";
170
			}
166 171
		}
167
		$radvdconf .= "\t};\n";
168

  
169
		if($carpif === true) {
170
			$radvdconf .= "\troute ::/0 {\n";
171
			$radvdconf .= "\t\tRemoveRoute off;\n";
172
			$radvdconf .= "\t};\n";
173
		} else {
174
			$radvdconf .= "\troute ::/0 {\n";
175
			$radvdconf .= "\t\tRemoveRoute on;\n";
172
		else {
173
			$radvdconf .= "\tprefix {$subnetv6}/{$ifcfgsnv6} {\n";
174
			if($carpif == true) {
175
				$radvdconf .= "\t\tDeprecatePrefix off;\n";
176
			} else {
177
				$radvdconf .= "\t\tDeprecatePrefix on;\n";
178
			}
179
			switch($dhcpv6ifconf['ramode']) {
180
				case "managed":
181
					$radvdconf .= "\t\tAdvOnLink on;\n";
182
					$radvdconf .= "\t\tAdvAutonomous off;\n";
183
					$radvdconf .= "\t\tAdvRouterAddr on;\n";
184
					break;
185
				case "router":
186
					$radvdconf .= "\t\tAdvOnLink off;\n";
187
					$radvdconf .= "\t\tAdvAutonomous off;\n";
188
					$radvdconf .= "\t\tAdvRouterAddr on;\n";
189
					break;
190
				case "assist":
191
					$radvdconf .= "\t\tAdvOnLink on;\n";
192
					$radvdconf .= "\t\tAdvAutonomous on;\n";
193
					$radvdconf .= "\t\tAdvRouterAddr on;\n";
194
					break;
195
				case "unmanaged":
196
					$radvdconf .= "\t\tAdvOnLink on;\n";
197
					$radvdconf .= "\t\tAdvAutonomous on;\n";
198
					$radvdconf .= "\t\tAdvRouterAddr on;\n";
199
					break;				
200
			}
176 201
			$radvdconf .= "\t};\n";
177 202
		}
203
		if (is_array($dhcpv6ifconf['routes']['item'])) {
204
			foreach ($dhcpv6ifconf['routes']['item'] as $dhcpv6route) {
205
				$radvdconf .= "\troute " . $dhcpv6route['destination'] . " {\n";
206
				$radvdconf .= "\t\tRemoveRoute off;\n";
207
				$radvdconf .= "\t\tAdvRoutePreference " . $dhcpv6route['priority'] . ";\n";
208
				$radvdconf .= "\t};\n";
209
			}
210
		}
211
		else {
212
			if($carpif === true) {
213
				$radvdconf .= "\troute ::/0 {\n";
214
				$radvdconf .= "\t\tRemoveRoute off;\n";
215
				$radvdconf .= "\t};\n";
216
			} else {
217
				$radvdconf .= "\troute ::/0 {\n";
218
				$radvdconf .= "\t\tRemoveRoute on;\n";
219
				$radvdconf .= "\t};\n";
220
			}
221
		}
178 222

  
179 223
		/* add DNS servers */
180 224
		$dnslist = array();
181 225
		if (isset($dhcpv6ifconf['rasamednsasdhcp6']) && is_array($dhcpv6ifconf['dnsserver']) && !empty($dhcpv6ifconf['dnsserver'])) {
182 226
			foreach($dhcpv6ifconf['dnsserver'] as $server)
......
197 241
		if (count($dnslist) > 0) {
198 242
			$dnsstring = implode(" ", $dnslist);
199 243
			if ($dnsstring <> "")
200 244
				$radvdconf .= "\tRDNSS {$dnsstring} { };\n";
201 245
		}
202
		if (!empty($dhcpv6ifconf['domain'])) {
246
		
247
		if (!isset($dhcpv6ifconf['rasamednsasdhcp6']) && isset($dhcpv6ifconf['radomainsearchlist']) && $dhcpv6ifconf['radomainsearchlist'] <> "") {
248
			$domain_array=preg_split("/[ ;]+/",$dhcpv6ifconf['radomainsearchlist']);
249
			$radvdconf .= "\tDNSSL ";
250
			foreach ($domain_array as $curdomain) {
251
				$radvdconf .= $curdomain . " ";
252
			}
253
			$radvdconf .= "{ };\n";
254
		} elseif (!empty($dhcpv6ifconf['domain'])) {
203 255
			$radvdconf .= "\tDNSSL {$dhcpv6ifconf['domain']} { };\n";
204 256
		} elseif (!empty($config['system']['domain'])) {
205 257
			$radvdconf .= "\tDNSSL {$config['system']['domain']} { };\n";
206 258
		}
207 259
		$radvdconf .= "};\n";