From patchwork Fri May 23 09:44:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michal_Grzn=C3=A1r?= X-Patchwork-Id: 351789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E401314007B for ; Fri, 23 May 2014 19:46:50 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1Wnm3a-0008US-Ca; Fri, 23 May 2014 11:46:30 +0200 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]) by ganesha.gnumonks.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from ) id 1Wnm1p-0008Ef-PA for openbsc@lists.osmocom.org; Fri, 23 May 2014 11:44:46 +0200 Received: by mail-ob0-f169.google.com with SMTP id vb8so5124912obc.14 for ; Fri, 23 May 2014 02:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=u7X1vP7b0G0TASgn+uavZ5nUdxL9zmQ5du+4X4hsvkw=; b=WVxSsdkADa4asotRMkPc4W+/Cf3KJhrljuOTTpcTSlXYb52or7wQ4P9FhAX9sHDGHK mBOywUJmU61MZu1GKFEBKCQg/XnT54emhWdlFPqo2ii86UT8kRiBuCRCgT4LpN6gxJaI aiNefrLCJXeWlGhP3hl2J9lXJBS48pjr6TckQO6ekgX+nG1zXnSlCPw2SVmfYGmn+aJC +pOCaKIPsk37+FykL1vLa3puYs/pz/yipNfpkNV5JQhkrnc38x2kO9fmkfAUwIgizrzJ LW7280gXTohtBgGmNiVS5+1i31ry64ftdEjHHBSiL10VGP+HGoEB++7oD5jUCG3EF4ST RkDQ== MIME-Version: 1.0 X-Received: by 10.182.241.67 with SMTP id wg3mr3639095obc.16.1400838280302; Fri, 23 May 2014 02:44:40 -0700 (PDT) Received: by 10.182.154.67 with HTTP; Fri, 23 May 2014 02:44:40 -0700 (PDT) In-Reply-To: <20140517115033.GC14533@nataraja> References: <20140517115033.GC14533@nataraja> Date: Fri, 23 May 2014 11:44:40 +0200 Message-ID: Subject: Re: OsmoSGSN [PATCH], Network Service From: =?UTF-8?Q?Michal_Grzn=C3=A1r?= To: Harald Welte X-Spam-Score: -0.1 (/) Cc: openbsc@lists.osmocom.org X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org Hi, I am sorry for my previous bad post format. There are the right diff files. And the problem was as I said in Imsi attach procedure new TLLI == new allocated P-tmsi, and there was a problem that the function gprs_tmsi2tlli() function there was not called and so I had to mask the upper bits in function where the p-tmsi is allocated, there is also a pcap trace where you can see it. thanks, regards Michal 2014-05-17 13:50 GMT+02:00 Harald Welte : > Hi Michal, > > thanks a lot for reporting back on your experience. > > Hoewever, it is customary to post changes as unified diff ('diff -u' > format here on this list for review. I have a hard time understanding > the format that you posted. Can you pleaes re-post your changes? > Either with diff -u created manually, or with 'git diff' or similar. > > On Mon, May 05, 2014 at 11:13:37PM +0200, Michal Grznár wrote: > > Hi, I am using OsmoSGSN in topology with OpenGGSN and proprietary > simulator > > and the problem is that in IP-subnetwork, which I am using there is no > > use for RESET or UNBLOCK procedure, so I had to do a PATCH in > > gprs_ns.c, which was needed to complete succesful connection between > > sim-bss and OsmoSGSN: > > If you would like to see such code merged, please extend osmo-sgsn so > that the type of BSS can be configured via vty, and make the code > conditional. At that point you could simply have a different config > file for your sim-bss than we have. > > > another PATCH I needed to do was to change a little bit procedure for > > allocation of P-TMSI in procedure uint32_t sgsn_alloc_ptmsi(void) in > > gprs_sgsn.c > > > > uint32_t sgsn_alloc_ptmsi(void) > > { > > struct sgsn_mm_ctx *mm; > > uint32_t ptmsi; > > > > restart: > > +++ ptmsi = rand() | 0xc0000000; /*because of GPRS IMSI > > ATTACH*/ > > llist_for_each_entry(mm, &sgsn_mm_ctxts, list) { > > if (mm->p_tmsi == ptmsi) > > goto restart; > > } > > return ptmsi; > > } > > > > because in GPRS IMSI ATTACH in message ATTACH COMPLETE (3GPP 24.008, > > 23.003, 48.018) there is new TLLI==new allocated P-TMSI and I need local > > TLLI, so I had to do it this way > > This is most certainly not the right way to fix the problem. The TLLI > is generated at a different layer than the P-TMSI. The P-TMSI should be > completely random, and the TLLI derived from that should mask the upper > bits, using the gprs_tmsi2tlli() function. > > Can you please explain more what the actual problem was and how it > manifested iself? If possible, include pcap traces for further > illustration. > > Thanks, > Harald > > -- > - Harald Welte > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. > A6) > --- gprs_sgsn_before_patch.c 2014-05-23 11:14:48.121829000 +0200 +++ gprs_sgsn_patch.c 2014-05-23 11:15:48.229829001 +0200 @@ -361,7 +361,7 @@ uint32_t ptmsi; restart: - ptmsi = rand(); + ptmsi = rand() | 0xc0000000; //because of GPRS IMSI ATTACH llist_for_each_entry(mm, &sgsn_mm_ctxts, list) { if (mm->p_tmsi == ptmsi) goto restart; --- gprs_ns_before_patch.c 2014-05-23 10:36:09.041829000 +0200 +++ gprs_ns_patch.c 2014-05-23 10:34:17.101829001 +0200 @@ -1217,16 +1217,14 @@ switch (nsh->pdu_type) { case NS_PDUT_ALIVE: - /* If we're dead and blocked and suddenly receive a - * NS-ALIVE out of the blue, we might have been re-started - * and should send a NS-RESET to make sure everything recovers - * fine. */ - -LOGP(DNS, LOGL_INFO, "Rx NS ALIVE\n"); -if ((*nsvc)->state == NSE_S_BLOCKED) - rc = gprs_ns_tx_reset((*nsvc), NS_CAUSE_PDU_INCOMP_PSTATE); - else - rc = gprs_ns_tx_alive_ack(*nsvc); + LOGP(DNS, LOGL_INFO, "Rx NS ALIVE\n"); + rc = gprs_ns_tx_alive_ack(*nsvc); + /*mark NS-VC as unblocked and active*/ + (*nsvc)->state = NSE_S_ALIVE; + (*nsvc)->remote_state = NSE_S_ALIVE; + /*Initiate TEST proc.: Send ALIVE_ACK and start timer*/ + rc = gprs_ns_tx_simple((*nsvc), NS_PDUT_ALIVE_ACK); + nsvc_start_timer((*nsvc), NSVC_TIMER_TNS_TEST); break; case NS_PDUT_ALIVE_ACK: /* stop Tns-alive and start Tns-test */