Project

General

Profile

« Previous | Next » 

Revision 51e72bf5

Added by Jim Pingle about 15 years ago

Rework connections a bit and report errors when they happen.

View differences:

etc/rc.filter_synchronize
267 267
                                update_filter_reload_status("Signaling CARP reload signal...");
268 268
                                carp_sync_xml($synchronizetoip, $carp['password'], $sections, $port);
269 269
                                $cli = new XML_RPC_Client('/xmlrpc.php', $synchronizetoip, $port);
270
                                $msg = new XML_RPC_Message('pfsense.filter_configure', array(new XML_RPC_Value($carp['password'], 'string')));
270
				$params = array(
271
					XML_RPC_encode($carp['password'])
272
				);
273

  
274
                                $msg = new XML_RPC_Message('pfsense.filter_configure', $params);
271 275
                                $username = $config['system']['user'][0]['name'];
272 276
                                $cli->setCredentials($username, $carp['password']);
273
                                $cli->send($msg, "900");
277
                                $resp = $cli->send($msg, "900");
278

  
279
				if(!$resp) {
280
					$error = "A communications error occured while attempting Filter sync with username {$username} {$synchronizetoip}:{$port}.";
281
					log_error($error);
282
					file_notice("sync_settings", $error, "Settings Sync", "");
283
				} elseif($resp->faultCode()) {
284
					$error = "An error code was received while attempting Filter sync with username {$username} {$synchronizetoip}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
285
					log_error($error);
286
					file_notice("sync_settings", $error, "Settings Sync", "");
287
				} else {
288
					log_error("Filter sync successfully completed with {$synchronizetoip}:{$port}.");
289
					$numberofruns = 3;
290
				}
291

  
274 292
                                /* signal a carp reload */
275 293
                                $cli = new XML_RPC_Client('/xmlrpc.php', $synchronizetoip, $port);
276
                                $msg = new XML_RPC_Message('pfsense.interfaces_carp_configure', array(new XML_RPC_Value($carp['password'], 'string')));
277
                                $cli->setCredentials($username, $carp['password']);
278
                                $cli->send($msg, "900");
294
                                $msg = new XML_RPC_Message('pfsense.interfaces_carp_configure', $params);
295
                                $resp = $cli->send($msg, "900");
296

  
297
				if(!$resp) {
298
					$error = "A communications error occured while attempting CARP sync with username {$username} {$synchronizetoip}:{$port}.";
299
					log_error($error);
300
					file_notice("sync_settings", $error, "Settings Sync", "");
301
				} elseif($resp->faultCode()) {
302
					$error = "An error code was received while attempting CARP sync with username {$username} {$synchronizetoip}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
303
					log_error($error);
304
					file_notice("sync_settings", $error, "Settings Sync", "");
305
				} else {
306
					log_error("CARP sync successfully completed with {$synchronizetoip}:{$port}.");
307
					$numberofruns = 3;
308
				}
279 309
                         }
280 310
						 break;
281 311
                }
282 312
        }
283 313
}
284 314

  
285
?>
315
?>

Also available in: Unified diff