diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-02-14 01:04:04 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-04-25 20:46:05 +0200 |
commit | 0757504a865e67b7108440959ec59ce29805883d (patch) | |
tree | 491901a57cf0f822b11f2b88dddd031863a677d7 | |
parent | 042a445cf360c8b6093918f52c7137dcb6e6c788 (diff) |
fix segfault in case of kernel gtp-u
There's a problem during the initial start-up of osmo-ggsn in case
of kernel gtp-u: apn->ggsn->gsn is not yet set while parsing the
'apn' nodes from the config file. This member is only set after
the last 'apn' node has been parsed at the end of the 'ggsn' node.
Closes: OS#3217
Change-Id: I022a5e5ebc1f155e8f94938856d310462f79bbe8
-rw-r--r-- | ggsn/ggsn.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index cb11c49..bbdb5c8 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -284,6 +284,14 @@ int apn_start(struct apn_ctx *apn) apn_stop(apn, false); return -1; } + if (apn->ggsn->gsn == NULL) { + /* skip bringing up the APN now if the GSN is not initialized yet. + * This happens during initial load of the config file, as the + * "no shutdown" in the ggsn node only happens after the "apn" nodes + * are brought up */ + LOGPAPN(LOGL_NOTICE, apn, "Skipping APN start\n"); + return 0; + } /* use GTP kernel module for data packet encapsulation */ if (gtp_kernel_init(apn->ggsn->gsn, apn->tun.cfg.dev_name, &apn->v4.cfg.ifconfig_prefix, apn->tun.cfg.ipup_script) < 0) { |