Hello,
I continue to play with sgsnemu, and found that it stopped for some reason after "Request accepted".
Does sgsnemu working?
At my mind problem inside `create_pdp_conf` function . After small changes, I start to see icmp inside gtp tunnel in trace. Please check attachments with console output, patch and pcap. May be I has wrong understanding.

--
Viktor
## original 
```
ubuntu@test:~/osmo-ggsn$ sudo sgsnemu --listen 10.121.0.18 --remote 
91.184.97.160  --contexts 1 --apn internet.ge.beeline.net --imsi 
282040234567890  --rai=282.04.0001.0001 --nsapi=5 --qos=34824735 --charging=2 
--createif --defaultroute -d --pingcount=3 --pinghost=10.123.0.18
remote: 91.184.97.160
listen: 10.121.0.18
debug: 1
imsi: 282040234567890
qos: 0x213621f
qose1: 0x9396404074f9ffff
qose2: 0x11
qose3: 0x0101
qose4: 0x4040
charging: 0x02
apn: internet.ge.beeline.net
msisdn: 46702123456
uid: mig
pwd: hemmelig
pidfile: ./sgsnemu.pid
statedir: ./
contexts: 1
timelimit: 0
createif: 1
defaultroute: 1
pinghost: 10.123.0.18
pingrate: 1
pingsize: 56
pingcount: 3
pingquiet: 0
norecovery: 0
no-tx-gpdu-seq: 0

Using default DNS server
Local IP address is:   10.121.0.18 (10.121.0.18)
Remote IP address is:  91.184.97.160 (91.184.97.160)
IMSI is:               282040234567890 (0xf098765432040282)
Using NSAPI:           5
Using GTP version:     1
Using APN:             internet
Using selection mode:  1
Using RAI:  282.04.0001.0001
->mcc : 282
->mnc : 04
->LAC: 0001
->RAC : 0001
Using MSISDN:          46702123456
Using ping host:       10.123.0.18 (10.123.0.18)

Initialising GTP library
<000d> gtp.c:757 GTP: gtp_newgsn() started at 10.121.0.18
<000d> gtp.c:714 State information file (.//gsn_restart) not found. Creating 
new file.
Setting up interface
Done initialising GTP library

Sending off echo request
Setting up PDP context #0
Waiting for response from ggsn........

idletime.tv_sec 3, idleTime.tv_usec 0
Received echo response
idletime.tv_sec 3, idleTime.tv_usec 0
idletime.tv_sec 3, idleTime.tv_usec 0
Received create PDP context response. Cause value: 128
```


## patch (in46a_from_eua(&pdp->eua, &addr)<=0)
```
ubuntu@test:~/osmo-ggsn$ sudo sgsnemu --listen 10.121.0.18 --remote 
91.184.97.160  --contexts 1 --apn internet.ge.beeline.net --imsi 
282040234567890  --rai=282.04.0001.0001 --nsapi=5 --qos=34824735 --charging=2 
--createif --defaultroute -d --pingcount=3 --pinghost=10.123.0.18
remote: 91.184.97.160
listen: 10.121.0.18
debug: 1
imsi: 282040234567890
qos: 0x213621f
qose1: 0x9396404074f9ffff
qose2: 0x11
qose3: 0x0101
qose4: 0x4040
charging: 0x02
apn: internet.ge.beeline.net
msisdn: 46702123456
uid: mig
pwd: hemmelig
pidfile: ./sgsnemu.pid
statedir: ./
contexts: 1
timelimit: 0
createif: 1
defaultroute: 1
pinghost: 10.123.0.18
pingrate: 1
pingsize: 56
pingcount: 3
pingquiet: 0
norecovery: 0
no-tx-gpdu-seq: 0

Using default DNS server
Local IP address is:   10.121.0.18 (10.121.0.18)
Remote IP address is:  91.184.97.160 (91.184.97.160)
IMSI is:               282040234567890 (0xf098765432040282)
Using NSAPI:           5
Using GTP version:     1
Using APN:             internet
Using selection mode:  1
Using RAI:  282.04.0001.0001
->mcc : 282
->mnc : 04
->LAC: 0001
->RAC : 0001
Using MSISDN:          46702123456
Using ping host:       10.123.0.18 (10.123.0.18)

Initialising GTP library
<000d> gtp.c:757 GTP: gtp_newgsn() started at 10.121.0.18
Setting up interface
Done initialising GTP library

Sending off echo request
Setting up PDP context #0
Waiting for response from ggsn........

idletime.tv_sec 3, idleTime.tv_usec 0
Received echo response
idletime.tv_sec 3, idleTime.tv_usec 0
Received create PDP context response. IP address: 10.16.0.2
Create_ping 0
idletime.tv_sec 0, idleTime.tv_usec 999952
Create_ping -1140
idletime.tv_sec 0, idleTime.tv_usec 998791
idletime.tv_sec 0, idleTime.tv_usec 998218
Create_ping -1039
idletime.tv_sec 10, idleTime.tv_usec 0
idletime.tv_sec 10, idleTime.tv_usec 0
Disconnecting PDP context #0


----10.123.0.18 PING Statistics----
3 packets transmitted in 12.012 seconds, 0 packets received, 100% packet loss
0 packets received in total
0 packets transmitted
idletime.tv_sec 3, idleTime.tv_usec 0
Received delete PDP context response. Cause value: 128
```

diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index bb55b1c..ffe9293 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1400,7 +1400,7 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, 
int cause)
                return EOF;     /* Not what we expected */
        }
 
-       if (in46a_from_eua(&pdp->eua, &addr)) {
+       if (in46a_from_eua(&pdp->eua, &addr)<=0) {
                printf
                    ("Received create PDP context response. Cause value: %d\n",
                     cause);

Attachment: sgsnemu_orig.pcap
Description: Binary data

Attachment: sgsnemu_patch.pcap
Description: Binary data

Reply via email to