modules/tm/t_fwd.c
d3b31abd
 /*
  * $Id$
  *
7dd0b342
  *
84d8e165
  * Copyright (C) 2001-2003 FhG Fokus
7dd0b342
  *
  * This file is part of ser, a free SIP server.
  *
  * ser is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
  * For a license to use the ser software under conditions
  * other than those described here, or to purchase support for this
  * software, please contact iptel.org by e-mail at the following addresses:
  *    info@iptel.org
  *
  * ser is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d3b31abd
  */
d531a5d5
 /*
  * History:
  * -------
a7cad316
  *  2003-02-13  proto support added (andrei)
  *  2003-02-24  s/T_NULL/T_NULL_CELL/ to avoid redefinition conflict w/
  *              nameser_compat.h (andrei)
  *  2003-03-01  kr set through a function now (jiri)
d505936f
  *  2003-03-06  callbacks renamed; "blind UAC" introduced, which makes
  *              transaction behave as if it was forwarded even if it was
  *              not -- good for local UAS, like VM (jiri)
a7cad316
  *  2003-03-19  replaced all the mallocs/frees w/ pkg_malloc/pkg_free (andrei)
  *  2003-03-30  we now watch downstream delivery and if it fails, send an
  *              error message upstream (jiri)
  *  2003-04-14  use protocol from uri (jiri)
a70eb298
  *  2003-12-04  global TM callbacks switched to per transaction callbacks
  *              (bogdan)
0be6158b
  *  2004-02-13: t->is_invite and t->local replaced with flags (bogdan)
60f7986c
  *  2005-08-04  msg->parsed_uri and parsed_uri_ok are no saved & restored
  *               before & after handling the branches (andrei)
d531a5d5
  */
d3b31abd
 
ff979952
 #include "defs.h"
 
7dd0b342
 
d3b31abd
 #include "../../dprint.h"
 #include "../../config.h"
3881f12c
 #include "../../parser/parser_f.h"
d3b31abd
 #include "../../ut.h"
 #include "../../timer.h"
caf80ae6
 #include "../../hash_func.h"
 #include "../../globals.h"
8710b7ee
 #include "../../mem/mem.h"
caf80ae6
 #include "../../dset.h"
49a20a49
 #include "../../action.h"
 #include "../../data_lump.h"
1400b772
 #include "t_funcs.h"
3881f12c
 #include "t_hooks.h"
caf80ae6
 #include "t_msgbuilder.h"
 #include "ut.h"
 #include "t_cancel.h"
 #include "t_lookup.h"
 #include "t_fwd.h"
 #include "fix_lumps.h"
141123d4
 #include "config.h"
3881f12c
 
49a20a49
 static int goto_on_branch = 0, branch_route = 0;
 
 void t_on_branch( unsigned int go_to )
 {
 	struct cell *t = get_t();
 
        /* in MODE_REPLY and MODE_ONFAILURE T will be set to current transaction;
         * in MODE_REQUEST T will be set only if the transaction was already
         * created; if not -> use the static variable */
 	if (!t || t==T_UNDEFINED ) {
 		goto_on_branch=go_to;
 	} else {
 		get_t()->on_branch = go_to;
 	}
 }
 
 unsigned int get_on_branch(void)
 {
 	return goto_on_branch;
 }
 
62097a8f
 
caf80ae6
 char *print_uac_request( struct cell *t, struct sip_msg *i_req,
a7cad316
 	int branch, str *uri, unsigned int *len, struct socket_info *send_sock,
 	enum sip_protos proto )
d3b31abd
 {
caf80ae6
 	char *buf, *shbuf;
60f7986c
 	str* msg_uri;
49a20a49
 	struct lump* add_rm_backup, *body_lumps_backup;
46931a4d
 
caf80ae6
 	shbuf=0;
62097a8f
 
caf80ae6
 	/* ... we calculate branch ... */	
7958eeae
 	if (!t_calc_branch(t, branch, i_req->add_to_branch_s,
 			&i_req->add_to_branch_len ))
 	{
caf80ae6
 		LOG(L_ERR, "ERROR: print_uac_request: branch computation failed\n");
49a20a49
 		goto error00;
caf80ae6
 	}
62097a8f
 
caf80ae6
 	/* ... update uri ... */
60f7986c
 	msg_uri=GET_RURI(i_req);
 	if ((msg_uri->s!=uri->s) || (msg_uri->len!=uri->len)){
 		i_req->new_uri=*uri;
 		i_req->parsed_uri_ok=0;
 	}
46931a4d
 
49a20a49
 	add_rm_backup = i_req->add_rm;
 	body_lumps_backup = i_req->body_lumps;
 	i_req->add_rm = dup_lump_list(i_req->add_rm);
 	i_req->body_lumps = dup_lump_list(i_req->body_lumps);
 
 	if (branch_route) {
 		     /* run branch_route actions if provided */
 		if (run_actions(branch_rlist[branch_route], i_req) < 0) {
 			LOG(L_ERR, "ERROR: print_uac_request: Error in run_actions\n");
                }
 	}
 
a70eb298
 	/* run the specific callbacks for this transaction */
 	run_trans_callbacks( TMCB_REQUEST_FWDED , t, i_req, 0, -i_req->REQ_METHOD);
d3b31abd
 
caf80ae6
 	/* ... and build it now */
a7cad316
 	buf=build_req_buf_from_sip_req( i_req, len, send_sock, proto );
40ac69d4
 #ifdef DBG_MSG_QA
 	if (buf[*len-1]==0) {
 		LOG(L_ERR, "ERROR: print_uac_request: sanity check failed\n");
 		abort();
 	}
 #endif
caf80ae6
 	if (!buf) {
 		LOG(L_ERR, "ERROR: print_uac_request: no pkg_mem\n"); 
 		ser_error=E_OUT_OF_MEM;
 		goto error01;
1400b772
 	}
caf80ae6
 
 	shbuf=(char *)shm_malloc(*len);
 	if (!shbuf) {
 		ser_error=E_OUT_OF_MEM;
 		LOG(L_ERR, "ERROR: print_uac_request: no shmem\n");
 		goto error02;
 	}
 	memcpy( shbuf, buf, *len );
 
 error02:
 	pkg_free( buf );
 error01:
49a20a49
 	     /* Delete the duplicated lump lists, this will also delete
 	      * all lumps created here, such as lumps created in per-branch
 	      * routing sections, Via, and Content-Length headers created in
 	      * build_req_buf_from_sip_req
 	      */
 	free_duped_lump_list(i_req->add_rm);
 	free_duped_lump_list(i_req->body_lumps);
 	     /* Restore the lists from backups */
 	i_req->add_rm = add_rm_backup;
 	i_req->body_lumps = body_lumps_backup;
 
  error00:
caf80ae6
 	return shbuf;
 }
 
fde02f64
 /* introduce a new uac, which is blind -- it only creates the
    data structures and starts FR timer, but that's it; it does
    not print messages and send anything anywhere; that is good
    for FIFO apps -- the transaction must look operationally
    and FR must be ticking, whereas the request is "forwarded"
    using a non-SIP way and will be replied the same way
 */
 int add_blind_uac( /*struct cell *t*/ )
 {
 	unsigned short branch;
 	struct cell *t;
 
 	t=get_t();
 	if (t==T_UNDEFINED || !t ) {
 		LOG(L_ERR, "ERROR: add_blind_uac: no transaction context\n");
 		return -1;
 	}
 
 	branch=t->nr_of_outgoings;	
 	if (branch==MAX_BRANCHES) {
 		LOG(L_ERR, "ERROR: add_blind_uac: "
 			"maximum number of branches exceeded\n");
 		return -1;
 	}
 	/* make sure it will be replied */
0be6158b
 	t->flags |= T_NOISY_CTIMER_FLAG;
fde02f64
 	t->nr_of_outgoings++;
 	/* start FR timer -- protocol set by default to PROTO_NONE,
        which means retransmission timer will not be started
     */
57857a94
 	if (start_retr(&t->uac[branch].request)!=0)
 		LOG(L_CRIT, "BUG: add_blind_uac: start retr failed for %p\n",
 				&t->uac[branch].request);
fde02f64
 	/* we are on a timer -- don't need to put on wait on script
 	   clean-up	
 	*/
 	set_kr(REQ_FWDED); 
 
 	return 1; /* success */
 }
 
caf80ae6
 /* introduce a new uac to transaction; returns its branch id (>=0)
    or error (<0); it doesn't send a message yet -- a reply to it
d531a5d5
    might interfere with the processes of adding multiple branches
caf80ae6
 */
179e3637
 int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
d531a5d5
 	struct proxy_l *proxy, int proto )
caf80ae6
 {
 
 	int ret;
 	short temp_proxy;
 	union sockaddr_union to;
 	unsigned short branch;
 	struct socket_info* send_sock;
 	char *shbuf;
 	unsigned int len;
d3b31abd
 
caf80ae6
 	branch=t->nr_of_outgoings;
 	if (branch==MAX_BRANCHES) {
 		LOG(L_ERR, "ERROR: add_uac: maximum number of branches exceeded\n");
 		ret=E_CFG;
40633485
 		goto error;
caf80ae6
 	}
40633485
 
caf80ae6
 	/* check existing buffer -- rewriting should never occur */
 	if (t->uac[branch].request.buffer) {
 		LOG(L_CRIT, "ERROR: add_uac: buffer rewrite attempt\n");
 		ret=ser_error=E_BUG;
 		goto error;
 	}
 
 	/* check DNS resolution */
22c4d743
 	if (proxy){
 		temp_proxy=0;
 		proto=get_proto(proto, proxy->proto);
 	}else {
179e3637
 		proxy=uri2proxy( next_hop ? next_hop : uri, proto );
caf80ae6
 		if (proxy==0)  {
 			ret=E_BAD_ADDRESS;
1400b772
 			goto error;
 		}
dcda247d
 		proto=proxy->proto; /* uri2proxy will fix it for us */
caf80ae6
 		temp_proxy=1;
d3b31abd
 	}
 
caf80ae6
 	if (proxy->ok==0) {
 		if (proxy->host.h_addr_list[proxy->addr_idx+1])
 			proxy->addr_idx++;
 		else proxy->addr_idx=0;
 		proxy->ok=1;
62097a8f
 	}
d3b31abd
 
caf80ae6
 	hostent2su( &to, &proxy->host, proxy->addr_idx, 
57857a94
 		proxy->port ? proxy->port:((proto==PROTO_TLS)?SIPS_PORT:SIP_PORT));
caf80ae6
 
a35ad52c
 	send_sock=get_send_socket( request, &to , proto);
caf80ae6
 	if (send_sock==0) {
5dcfb23d
 		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d, proto %d "
caf80ae6
 			" (no corresponding listening socket)\n",
22c4d743
 			to.s.sa_family, proto );
caf80ae6
 		ret=ser_error=E_NO_SOCKET;
 		goto error01;
 	}
 
 	/* now message printing starts ... */
 	shbuf=print_uac_request( t, request, branch, uri, 
22c4d743
 		&len, send_sock, proto );
caf80ae6
 	if (!shbuf) {
 		ret=ser_error=E_OUT_OF_MEM;
 		goto error01;
 	}
 
 	/* things went well, move ahead and install new buffer! */
d531a5d5
 	t->uac[branch].request.dst.to=to;
 	t->uac[branch].request.dst.send_sock=send_sock;
22c4d743
 	t->uac[branch].request.dst.proto=proto;
d531a5d5
 	t->uac[branch].request.dst.proto_reserved1=0;
caf80ae6
 	t->uac[branch].request.buffer=shbuf;
 	t->uac[branch].request.buffer_len=len;
 	t->uac[branch].uri.s=t->uac[branch].request.buffer+
 		request->first_line.u.request.method.len+1;
 	t->uac[branch].uri.len=uri->len;
 	t->nr_of_outgoings++;
 
 	/* update stats */
 	proxy->tx++;
 	proxy->tx_bytes+=len;
 
 	/* done! */	
 	ret=branch;
 		
 error01:
 	if (temp_proxy) {
 		free_proxy( proxy );
8710b7ee
 		pkg_free( proxy );
caf80ae6
 	}
d3b31abd
 error:
1400b772
 	return ret;
d3b31abd
 }
 
caf80ae6
 int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel, 
 	struct cell *t_invite, int branch )
62097a8f
 {
caf80ae6
 	int ret;
 	char *shbuf;
b69d0b14
 	unsigned int len;
62097a8f
 
caf80ae6
 	if (t_cancel->uac[branch].request.buffer) {
 		LOG(L_CRIT, "ERROR: e2e_cancel_branch: buffer rewrite attempt\n");
 		ret=ser_error=E_BUG;
62097a8f
 		goto error;
caf80ae6
 	}	
62097a8f
 
caf80ae6
 	/* note -- there is a gap in proxy stats -- we don't update 
 	   proxy stats with CANCEL (proxy->ok, proxy->tx, etc.)
 	*/
1400b772
 
caf80ae6
 	/* print */
 	shbuf=print_uac_request( t_cancel, cancel_msg, branch, 
 		&t_invite->uac[branch].uri, &len, 
a7cad316
 		t_invite->uac[branch].request.dst.send_sock,
 		t_invite->uac[branch].request.dst.proto);
caf80ae6
 	if (!shbuf) {
 		LOG(L_ERR, "ERROR: e2e_cancel_branch: printing e2e cancel failed\n");
 		ret=ser_error=E_OUT_OF_MEM;
1400b772
 		goto error;
 	}
caf80ae6
 	
 	/* install buffer */
d531a5d5
 	t_cancel->uac[branch].request.dst=t_invite->uac[branch].request.dst;
caf80ae6
 	t_cancel->uac[branch].request.buffer=shbuf;
 	t_cancel->uac[branch].request.buffer_len=len;
 	t_cancel->uac[branch].uri.s=t_cancel->uac[branch].request.buffer+
 		cancel_msg->first_line.u.request.method.len+1;
 	t_cancel->uac[branch].uri.len=t_invite->uac[branch].uri.len;
 	
62097a8f
 
caf80ae6
 	/* success */
 	ret=1;
62097a8f
 
 
 error:
caf80ae6
 	return ret;
62097a8f
 }
 
caf80ae6
 void e2e_cancel( struct sip_msg *cancel_msg, 
 	struct cell *t_cancel, struct cell *t_invite )
 {
fe04f095
 	branch_bm_t cancel_bm, tmp_bm;
caf80ae6
 	int i;
 	int lowest_error;
 	str backup_uri;
60f7986c
 	struct sip_uri backup_parsed_uri;
 	int backup_parsed_uri_ok;
caf80ae6
 	int ret;
 
 	cancel_bm=0;
 	lowest_error=0;
 
 	backup_uri=cancel_msg->new_uri;
60f7986c
 	backup_parsed_uri_ok=cancel_msg->parsed_uri_ok;
 	backup_parsed_uri=cancel_msg->parsed_uri;
caf80ae6
 	/* determine which branches to cancel ... */
 	which_cancel( t_invite, &cancel_bm );
141123d4
 	t_cancel->nr_of_outgoings=t_invite->nr_of_outgoings;
 	/* fix label -- it must be same for reply matching */
 	t_cancel->label=t_invite->label;
caf80ae6
 	/* ... and install CANCEL UACs */
 	for (i=0; i<t_invite->nr_of_outgoings; i++)
 		if (cancel_bm & (1<<i)) {
 			ret=e2e_cancel_branch(cancel_msg, t_cancel, t_invite, i);
 			if (ret<0) cancel_bm &= ~(1<<i);
 			if (ret<lowest_error) lowest_error=ret;
 		}
 	cancel_msg->new_uri=backup_uri;
60f7986c
 	cancel_msg->parsed_uri_ok=backup_parsed_uri_ok;
 	cancel_msg->parsed_uri=backup_parsed_uri;
caf80ae6
 
 	/* send them out */
fe04f095
 	for (i = 0; i < t_cancel->nr_of_outgoings; i++) {
 		if (cancel_bm & (1 << i)) {
 			     /* Provisional reply received on this branch, send CANCEL */
 			     /* No need to stop timers as they have already been stopped by the reply */
 			if (SEND_BUFFER(&t_cancel->uac[i].request) == -1) {
caf80ae6
 				LOG(L_ERR, "ERROR: e2e_cancel: send failed\n");
 			}
57857a94
 			if (start_retr( &t_cancel->uac[i].request )!=0)
 				LOG(L_CRIT, "BUG: e2e_cancel: failed to start retr. for %p\n",
 							&t_cancel->uac[i].request);
fe04f095
 		} else {
 			if (t_invite->uac[i].last_received < 100) {
57857a94
 				/* No provisional response received, stop
 				 * retransmission timers */
 				stop_rb_retr(&t_invite->uac[i].request);
 				/* no need to stop fr, it will be stoped by relay_reply
 				 * put_on_wait -- andrei */
 				/* Generate faked reply */
fe04f095
 				LOCK_REPLIES(t_invite);
57857a94
 				if (relay_reply(t_invite, FAKED_REPLY, i, 487, &tmp_bm) == 
 						RPS_ERROR) {
fe04f095
 					lowest_error = -1;
 				}
 			}
caf80ae6
 		}
 	}
 
84d8e165
 	/* if error occurred, let it know upstream (final reply
caf80ae6
 	   will also move the transaction on wait state
 	*/
 	if (lowest_error<0) {
 		LOG(L_ERR, "ERROR: cancel error\n");
 		t_reply( t_cancel, cancel_msg, 500, "cancel error");
 	/* if there are pending branches, let upstream know we
 	   are working on it
 	*/
 	} else if (cancel_bm) {
 		DBG("DEBUG: e2e_cancel: e2e cancel proceeding\n");
84d8e165
 		t_reply( t_cancel, cancel_msg, 200, CANCELING );
caf80ae6
 	/* if the transaction exists, but there is no more pending
84d8e165
 	   branch, tell upstream we're done
caf80ae6
 	*/
 	} else {
 		DBG("DEBUG: e2e_cancel: e2e cancel -- no more pending branches\n");
141123d4
 		t_reply( t_cancel, cancel_msg, 200, CANCEL_DONE );
caf80ae6
 	}
 }
62097a8f
 
caf80ae6
 
 /* function returns:
84d8e165
  *       1 - forward successful
caf80ae6
  *      -1 - error during forward
  */
 int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , 
d531a5d5
 	struct proxy_l * proxy, int proto)
caf80ae6
 {
 	str          backup_uri;
60f7986c
 	struct sip_uri backup_parsed_uri;
 	int backup_parsed_uri_ok;
caf80ae6
 	int branch_ret, lowest_ret;
 	str current_uri;
 	branch_bm_t	added_branches;
 	int first_branch;
035f593c
 	int i, q;
caf80ae6
 	struct cell *t_invite;
2bde8ca1
 	int success_branch;
87405423
 	int try_new;
02333eaa
 	str dst_uri;
7d4c7fd3
 	struct socket_info* si, *backup_si;
caf80ae6
 
 	/* make -Wall happy */
 	current_uri.s=0;
 
fde02f64
 	set_kr(REQ_FWDED);
caf80ae6
 
 	if (p_msg->REQ_METHOD==METHOD_CANCEL) {
b1f1656e
 		t_invite=t_lookupOriginalT(  p_msg );
1ea91058
 		if (t_invite!=T_NULL_CELL) {
caf80ae6
 			e2e_cancel( p_msg, t, t_invite );
 			UNREF(t_invite);
 			return 1;
 		}
 	}
 
 	/* backup current uri ... add_uac changes it */
 	backup_uri = p_msg->new_uri;
60f7986c
 	backup_parsed_uri_ok=p_msg->parsed_uri_ok;
 	backup_parsed_uri=p_msg->parsed_uri;
7d4c7fd3
 	backup_si = p_msg->force_send_socket;
caf80ae6
 	/* if no more specific error code is known, use this */
 	lowest_ret=E_BUG;
 	/* branches added */
 	added_branches=0;
 	/* branch to begin with */
 	first_branch=t->nr_of_outgoings;
 
49a20a49
 	if (t->on_branch) {
 		/* tell add_uac that it should run branch route actions */
 		branch_route = t->on_branch;
 		/* reset the flag before running the actions (so that it
 		 * could be set again in branch_route if needed
 		 */
 		t_on_branch(0);
 	} else {
 		branch_route = 0;
 	}
 	
caf80ae6
 	/* on first-time forwarding, use current uri, later only what
 	   is in additional branches (which may be continuously refilled
 	*/
 	if (first_branch==0) {
87405423
 		try_new=1;
257181a0
 		branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg), proxy, proto );
caf80ae6
 		if (branch_ret>=0) 
 			added_branches |= 1<<branch_ret;
 		else
 			lowest_ret=branch_ret;
87405423
 	} else try_new=0;
caf80ae6
 
2a78db5c
 	init_branch_iterator();
7d4c7fd3
 	while((current_uri.s=next_branch( &current_uri.len, &q, &dst_uri.s, &dst_uri.len, &si))) {
87405423
 		try_new++;
7d4c7fd3
 		p_msg->force_send_socket = si;
d399b7aa
 		branch_ret=add_uac( t, p_msg, &current_uri, 
02333eaa
 				    (dst_uri.len) ? (&dst_uri) : &current_uri, 
d399b7aa
 				    proxy, proto);
caf80ae6
 		/* pick some of the errors in case things go wrong;
 		   note that picking lowest error is just as good as
 		   any other algorithm which picks any other negative
 		   branch result */
 		if (branch_ret>=0) 
 			added_branches |= 1<<branch_ret;
 		else
 			lowest_ret=branch_ret;
 	}
 	/* consume processed branches */
 	clear_branches();
 
7d4c7fd3
 	p_msg->force_send_socket = backup_si;
caf80ae6
 	/* restore original URI */
 	p_msg->new_uri=backup_uri;
60f7986c
 	p_msg->parsed_uri_ok=backup_parsed_uri_ok;
 	p_msg->parsed_uri=backup_parsed_uri;
caf80ae6
 
 	/* don't forget to clear all branches processed so far */
 
 	/* things went wrong ... no new branch has been fwd-ed at all */
87405423
 	if (added_branches==0) {
 		if (try_new==0) {
84d8e165
 			LOG(L_ERR, "ERROR: t_forward_nonack: no branched for forwarding\n");
87405423
 			return -1;
 		}
 		LOG(L_ERR, "ERROR: t_forward_nonack: failure to add branches\n");
caf80ae6
 		return lowest_ret;
87405423
 	}
caf80ae6
 
 	/* send them out now */
2bde8ca1
 	success_branch=0;
caf80ae6
 	for (i=first_branch; i<t->nr_of_outgoings; i++) {
 		if (added_branches & (1<<i)) {
 			if (SEND_BUFFER( &t->uac[i].request)==-1) {
2bde8ca1
 				LOG(L_ERR, "ERROR: t_forward_nonack: sending request failed\n");
caf80ae6
 				if (proxy) { proxy->errors++; proxy->ok=0; }
2bde8ca1
 			} else {
 				success_branch++;
caf80ae6
 			}
57857a94
 			if (start_retr( &t->uac[i].request )!=0)
 				LOG(L_CRIT, "BUG: t_forward_non_ack: "
 						"failed to start retr. for %p\n", &t->uac[i].request);
caf80ae6
 		}
 	}
2bde8ca1
 	if (success_branch<=0) {
 		ser_error=E_SEND;
 		return -1;
 	}
caf80ae6
 	return 1;
 }	
 
d531a5d5
 int t_replicate(struct sip_msg *p_msg,  struct proxy_l *proxy, int proto )
caf80ae6
 {
 	/* this is a quite horrible hack -- we just take the message
 	   as is, including Route-s, Record-route-s, and Vias ,
 	   forward it downstream and prevent replies received
 	   from relaying by setting the replication/local_trans bit;
 
 		nevertheless, it should be good enough for the primary
 		customer of this function, REGISTER replication
 
 		if we want later to make it thoroughly, we need to
 		introduce delete lumps for all the header fields above
 	*/
d531a5d5
 	return t_relay_to(p_msg, proxy, proto, 1 /* replicate */);
caf80ae6
 }