[Serusers] WARNING: upstream bug - 0-terminated packet

Jev jev at ecad.org
Thu Jul 15 23:53:40 CEST 2004


Hi All,

I'm having to work with another SIP UAS acting as a location server, and 
I have ser as my 'frontend' so all clients talk to ser, and ser will 
register and with the location server.

In my logs I see the warning:
Jul 15 14:26:31 frig /usr/local/sbin/ser[18931]: WARNING: upstream bug - 
0-terminated packet

This happens when I t_relay my REGISTERS to the 3rd party location 
server. The packets look fine to me. Any ideas?

Here follows a trace (from ngrep), the logs from syslog, and our ser 
configuration. I'm aware that the location server is not challenging on 
REGISTERS :)

Thanks!
-Jev

U xx.xx.xx.181:64683 -> xx.xx.xx.6:5060
REGISTER sip:frontendser.example.com SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.92;branch=z9hG4bK0c95a85aa284e67a.
From: "Billy Pike" 
<sip:88890000 at frontendser.example.com>;tag=4c8855e01b806681.
To: <sip:88890000 at frontendser.example.com>.
Contact: <sip:88890000 at 192.168.123.92>.
Call-ID: 0b3754db1b4dd80b at 192.168.123.92.
CSeq: 100 REGISTER.
Expires: 3600.
User-Agent: Grandstream BT100 1.0.4.55.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
Content-Length: 0.
.

#
U xx.xx.xx.6:5060 -> xx.xx.xx.178:5060
REGISTER sip:location.example.com:5060 SIP/2.0.
Record-Route: <sip:xx.xx.xx.6;ftag=4c8855e01b806681;lr=on>.
Via: SIP/2.0/UDP xx.xx.xx.6;branch=z9hG4bK168.c89ec35.0.
Via: SIP/2.0/UDP 
192.168.123.92;rport=64683;received=xx.xx.xx.181;branch=z9hG4bK0c95a85aa284e67a.
From: "Billy Pike" 
<sip:88890000 at frontendser.example.com>;tag=4c8855e01b806681.
To: <sip:88890000 at frontendser.example.com>.
Contact: <sip:88890000 at xx.xx.xx.181:64683>.
Call-ID: 0b3754db1b4dd80b at 192.168.123.92.
CSeq: 100 REGISTER.
Expires: 3600.
User-Agent: Grandstream BT100 1.0.4.55.
Max-Forwards: 69.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
Content-Length: 0.
P-hint: fixed NAT contact for request.
.

#####
U xx.xx.xx.178:5060 -> xx.xx.xx.6:5060
SIP/2.0 200 OK.
Record-Route: <sip:xx.xx.xx.6;ftag=4c8855e01b806681;lr=on>.
Via: SIP/2.0/UDP xx.xx.xx.6;branch=z9hG4bK168.c89ec35.0.
Via: SIP/2.0/UDP 
192.168.123.92;rport=64683;received=xx.xx.xx.181;branch=z9hG4bK0c95a85aa284e67a.
From: "Billy Pike" 
<sip:88890000 at frontendser.example.com>;tag=4c8855e01b806681.
To: <sip:88890000 at frontendser.example.com>.
Contact: <sip:88890000 at xx.xx.xx.181:64683>.
Call-ID: 0b3754db1b4dd80b at 192.168.123.92.
CSeq: 100 REGISTER.
Expires: 3600.
User-agent: Grandstream BT100 1.0.4.55.
Max-Forwards: 68.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
Content-Length: 0.
P-hint: fixed NAT contact for request.
.
.
##
U xx.xx.xx.6:5060 -> xx.xx.xx.181:64683
SIP/2.0 200 OK.
Record-Route: <sip:xx.xx.xx.6;ftag=4c8855e01b806681;lr=on>.
Via: SIP/2.0/UDP 
192.168.123.92;rport=64683;received=xx.xx.xx.181;branch=z9hG4bK0c95a85aa284e67a.
From: "Billy Pike" 
<sip:88890000 at frontendser.example.com>;tag=4c8855e01b806681.
To: <sip:88890000 at frontendser.example.com>.
Contact: <sip:88890000 at xx.xx.xx.181:64683>.
Call-ID: 0b3754db1b4dd80b at 192.168.123.92.
CSeq: 100 REGISTER.
Expires: 3600.
User-agent: Grandstream BT100 1.0.4.55.
Max-Forwards: 68.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
Content-Length: 0.
P-hint: fixed NAT contact for request.
.






Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: ----------Entering 
default route---------------
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: [REGISTER] from 
[sip:88890000 at frontendser.example.com] to 
[sip:88890000 at frontendser.example.com]
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: src address different 
than via header->NAT detected
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: force_rport and 
fix_nated_contact and setflag(5)
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: rewriting uri for 
REGISTER request..
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: Called 
rewritehostport(location.example.com,5060) on REGSITER request..
Jul 15 14:26:31 frig /usr/local/sbin/ser[18904]: Called t_relay() for 
register..
Jul 15 14:26:31 frig /usr/local/sbin/ser[18931]: WARNING: upstream bug - 
0-terminated packet






#
# $Id: ser_rtproxy_fe.cfg,v 1.3 2004/07/06 22:48:35 jev Exp $
#
# TODO
# Fix xlog statements to use appropriate logging levels.
#
# ----------- global configuration parameters ------------------------

debug=9         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no	# (cmd line: -E)

/* Uncomment these lines to enter debugging mode
debug=9
fork=no
log_stderror=yes
*/

check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
#children=4
fifo="/tmp/ser_fifo"

sip_warning=yes

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.so"

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

modparam("usrloc", "db_mode",   0)

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)

# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 1)

modparam("registrar", "nat_flag", 6)
#modparam("nathelper", "natping_interval", 4) # Ping interval 30 s
modparam("nathelper", "natping_interval", 5) # Ping interval 30 s

# -------------------------  request routing logic -------------------

# main routing logic

route{

	log(1, "----------Entering default route---------------\n");
	xlog("L_ERR", "[%rm] from [%fu] to [%tu]");

	if (nat_uac_test("2")) {
		log(1, "src address different than via header->NAT detected\n");
		log(1, "force_rport and fix_nated_contact and setflag(5)\n");
		#try NAT traversal, works only if the client is symmetrical
		force_rport();
		fix_nated_contact();
		#fix_nated_sdp();
		append_hf("P-hint: fixed NAT contact for request\r\n");
		# flag 5 indicates that incoming request is from NATed client
		setflag(5);
	};
	

	# initial sanity checks -- messages with
	# max_forwards==0, or excessively long requests
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		break;
	};
	if ( msg:len > max_len ) {
		sl_send_reply("513", "Message too big");
		break;
	};

	# we record-route all messages -- to make sure that
	# subsequent messages will go through our proxy; that's
	# particularly good if upstream and downstream entities
	# use different transport protocol
	record_route();	
	# loose-route processing
	if (loose_route()) {
		t_relay();
		break;
	};

	# if the request is for other domain use UsrLoc
	# (in case, it does not work, use the following command
	# with proper names and addresses in it)
	if (uri==myself) {

		if (method=="REGISTER") {
			log(1,"rewriting uri for REGISTER request..");
			rewritehostport("location.example.com:5060");
			if(	isflagset(5) ){
				force_rtp_proxy();
			}
			log(1,"Called rewritehostport(location.example.com,5060) on REGSITER 
request..");
			if(t_relay()){
				log(1,"Called t_relay() for register..");
			}
#			if(!sl_send_reply("200", "ok")){
#				log(1,"Got error when calling sl_send_reply(200, ok) on REGSITER 
request..");
#			}
			t_on_reply("1");
			break;
		};

		if (method=="INVITE" || method == "CANCEL") {
			log(1,"rewriting uri for INVITE request..");
			rewritehostport("location.example.com:5060");
			log(1,"Called rewritehostport(location.example.com,5060) on INVITE 
request..");
			if(isflagset(5)){
				force_rtp_proxy();
			}

			route(1);
#if(t_relay()){
#				log(1,"Called t_relay() for register..");
#			}
#			if(!sl_send_reply("200", "ok")){
#				log(1,"Got error when calling sl_send_reply(200, ok) on REGSITER 
request..");
#			}
			t_on_reply("1");
			break;
		};
	};

	route(1);
}
route[1]{
	log(1, "-------------------------------------------\n");
	log(1, "entering route[1] - relaying SIP message\n");
	if ((isflagset(5)) || (isflagset(6))) {
		log(1, "at least one of the participants is NATed->record_route\n");
		record_route();
		log(1, "     -->setting up reply processing ->onreply_route[1]");
		t_on_reply("1");
		if (method=="INVITE") {
			log(1, "INVITE request-->force_rtp_proxy, set NATED-INVITE flag(7)");
			force_rtp_proxy();
			append_hf("P-hint: request forced to nathelper\r\n");
			setflag(7);
		};
	};


	log(1, "relaying message ...\n");
	if (!t_relay()) {
		log(1, "t_relay error occured\n");
		sl_reply_error();
	};
}

route[2]{
	if ((isflagset(5)) || (isflagset(6))) {
		log(1, "at least one of the participants is NATed->record_route\n");
		record_route();
		log(1, "     -->setting up reply processing ->onreply_route[2]");
		t_on_reply("1");
		if (method=="INVITE") {
			log(1, "     INVITE request-->force_rtp_proxy, set NATED-INVITE 
flag(7)");
			force_rtp_proxy();
			append_hf("P-hint: request forced to nathelper\r\n");
			setflag(7);
		};
	};
	xlog("L_ERR", "Forwarding %fu to %tu [Cisco]\n");
	rewritehostport("xx.xx.xx.8:5060");
	if(!t_relay()){
		log(1, "Relay to Cisco failed");
		break;
	};
}

#all incoming replies for t_onrepli-ed transactions enter here
onreply_route[1] {
	log(1, "-------------------------------------------\n");
	log(1, "onreply_route[1] entered\n");

	if (isflagset(5)) {
		log(1, "transaction was sent to a NATED client -> fix nated contact\n");
		fix_nated_contact();
		force_rport();
		force_rtp_proxy();
		#fix_nated_sdp();
		append_hf("P-hint: fixed NAT contact for response (nathelper)\r\n");
	}

	if ( (status=~"100") ) {
		log(1, "status 100 received\n");
	};

	if ( (status=~"180") ) {
		log(1, "status 180 received\n");
	};

	if ( (status=~"202") ) {
		log(1, "status 202 received\n");
	};

	if ( (status=~"200" || status=~"183") ) {
		log(1, "status 2xx or 183");
	if ( isflagset(7) ) {
		log(1, "marked(7) as NATED-INVITE -> force_rtp_proxy \n");
		force_rtp_proxy();
		append_hf("P-hint: response forced to nathelper\r\n");
		};
	};
}
onreply_route[2] {
	log(1, "-------------------------------------------\n");
	xlog("L_ERR", "onreply_route[2] entered From %fu to %tu\n");

	if (isflagset(6)) {
		log(1, "transaction was sent to a NATED client -> fix nated contact\n");
		fix_nated_contact();
		#fix_nated_sdp();
		append_hf("P-hint: fixed NAT contact for response\r\n");
	}

	if ( (status=~"100") ) {
		log(1, "status 100 received\n");
	};

	if ( (status=~"180") ) {
		log(1, "status 180 received\n");
	};

	if ( (status=~"202") ) {
		log(1, "status 202 received\n");
	};

	if ( (status=~"200" || status=~"183") ) {
		log(1, "status 2xx or 183");
	if ( isflagset(7) ) {
		log(1, "marked(7) as NATED-INVITE -> force_rtp_proxy \n");
		force_rtp_proxy();
		append_hf("P-hint: response forced to nathelper\r\n");
		};
	};
}




More information about the sr-users mailing list