aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-02-05 14:15:20 +0100
committerOliver Smith <osmith@sysmocom.de>2021-02-05 16:37:02 +0100
commit02a82c3c9b88e6bbd4b49874fbf521b6e88b85fb (patch)
treebccf3fc535fb3e5259b7294b4132c220e68451f0
parent349cbfcf504901f4efad60a0f84b27d0bfb5d367 (diff)
apn_start: avoid segfault if missing tun-device
Check if tun-device is defined and give the user a hint that it is missing instead of segfaulting with gtpu-mode kernel-gtp: 20210205141701206 DGGSN <0002> ggsn.c:186 APN(internet): Starting 20210205141701206 DGGSN <0002> ggsn.c:204 APN(internet): Opening Kernel GTP device (null) Segmentation fault With gtpu-mode tun it didn't segfault, but still tried to open the NULL device: 20210205141557598 DGGSN <0002> ggsn.c:186 APN(internet): Starting 20210205141557599 DGGSN <0002> ggsn.c:189 APN(internet): Opening TUN device (null) 20210205141557599 DTUN <0001> tun.c:195 errno=1/Operation not permitted ioctl() failed Related: OS#3208 Change-Id: I9f71af65cc0eed71728c04b774e5c08352947913
-rw-r--r--ggsn/ggsn_vty.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index f76018e..71d8ff6 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -699,6 +699,10 @@ DEFUN(cfg_apn_no_shutdown, cfg_apn_no_shutdown_cmd,
struct apn_ctx *apn = (struct apn_ctx *) vty->index;
if (apn->cfg.shutdown) {
+ if (!apn->tun.cfg.dev_name) {
+ vty_out(vty, "%% Failed to start APN, tun-device is not configured%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
if (apn_start(apn) < 0) {
vty_out(vty, "%% Failed to start APN, check log for details%s", VTY_NEWLINE);
return CMD_WARNING;