Pārlūkot izejas kodu

- FLAG_PEER_REPLICATE renamed to FLAG_REPL_ENABLED which is what this
flag really means
- added debconf-configurable server_id option to the configuration file
- the replication source appends SER-Server-ID to the request with its
own server id

Jan Janak 17 gadi atpakaļ
vecāks
revīzija
cc30d60050
1 mainītis faili ar 11 papildinājumiem un 4 dzēšanām
  1. 11 4
      etc/ser-oob.cfg

+ 11 - 4
etc/ser-oob.cfg

@@ -111,6 +111,10 @@
 #memlog=10 # memory statistics log level
 #log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3))
 
+#DEBCONF-SERVERID-START
+server_id=1
+#DEBCONF-SERVERID-END
+
 /* Uncomment these lines to enter debugging mode 
 fork=no
 log_stderror=yes
@@ -249,7 +253,7 @@ flags
   FLAG_ACC            : 1, # this request will be recorded by ACC
   FLAG_FAILUREROUTE   : 2, # we are operating from the failure route
   FLAG_NAT            : 3, # the UAC is behind a NAT
-  FLAG_PEER_REPLICATE : 4, # the request came from a replication peer node
+  FLAG_REP_ENABLED    : 4, # REGISTER replication is enabled if set
   FLAG_TOTAG          : 5,
   FLAG_PSTN_ALLOWED   : 6, # the user is allowed to use the PSTN
   FLAG_DONT_RM_CRED   : 7, # do not remove the credentials
@@ -573,7 +577,7 @@ route[INIT]
 	}
 
 	if ($replicate==1) { # if global flag enabled, carry on replication
-		setflag(FLAG_PEER_REPLICATE);
+		setflag(FLAG_REPL_ENABLED);
 	}
 }
 
@@ -752,10 +756,11 @@ route[REGISTRAR]
 	# if this is a replica (sent to multicast address), trust it to be
 	# secure and store it in usrloc
 	if (dst_ip==224.0.1.75) {
-		if (!isflagset(FLAG_PEER_REPLICATE)) {
+		if (!isflagset(FLAG_REPL_ENABLED)) {
 			# multicast replication adminsitratively disabled -- ignore
 			drop;
 		}
+		
 		if (search("^Repl-Marker: nated")) { #: read marker from master
 			setflag(FLAG_NAT);
 			$uac_nat=1;
@@ -830,10 +835,12 @@ route[REGISTRAR]
 		sl_reply("400", "Invalid REGISTER Request");
 		drop;
 	}
-	if (isflagset(FLAG_PEER_REPLICATE)) {
+	if (isflagset(FLAG_REPL_ENABLED)) {
 		if (isflagset(FLAG_NAT)) {
 			append_hf("Repl-Marker: nated\r\n");
 		}
+		# Append this server's unique ID to the request
+		append_hf_value("SER-Server-ID", "%@sys.server_id");
 		# note: we are multicasting a successful REGISTER
 		# to all proxies on the multicast network for
 		# sake of replication; in case they share the