allow gtp tunnel updating in libgtpnl: gtp_add_tunnel()

Andreas Schultz aschultz at
Mon Mar 27 08:30:32 UTC 2017

Hi Jiannan, 

----- On Mar 27, 2017, at 7:16 AM, Jiannan Ouyang <ouyangj at> wrote: 

> Hi All,

> In current OAI implementation, we found that there are cases SPGW is out-of-sync
> with MME, because of the delete_session_request is not received by the SPGW
> because of some errors, however MME has cleared the state of that session. Then
> when the UE re-attaches, a new create_session_request is sent to SPGW; and
> because we try to allocate the same IP for the same IMSI (local change), the
> SPGW will result out in trying to update an existing GTP tunnel.

> According to [ |
> ] and [
> |
> ]
> , the NLM_F_EXCL flag is used to prevent updating an existing tunnel. I’m is
> wondering what is the reason of preventing updating?

The correct repository for libgtnl is:, my github tree of osmo-ggsn is outdated and shouldn't be used. 

> While we are actively investigating sending delete_session_request properly, as
> temporary workaround, I’m thinking to recovery from the out-of-sync problem, we
> can allow the new GTP tunnel to overwrite the old one in libgtpnl. Your
> suggestions are welcomed. Thanks.

It should be possible to update an existing PDP context as long as you don't change any of the hash keys. That would be GTP version, GTP socket, ms_addr, and i_tei. 
The validation of those values for updating is a bit weak in the kernel. Currently, it would to possible change any of the hash keys without the hash being updated. 

Adding gtp_update_tunnel to libgtpnl should be simple (but beware of the hash key changes). 

A gtp_update_tunnel that supports changing any the hash keys would have to set the NLM_F_REPLACE flag. That is currently not supported by the kernel implementation and libgtnl is not setting that flag. 
I found an old, untested, and most likely incomplete version of an update pdp implementation for the kernel in my repository at 

You are welcome to forward port, fix, test, and submit that to the kernel. 


> Regards,

> -Jiannan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the osmocom-net-gprs mailing list