Change in osmo-ggsn[master]: apn_start: avoid segfault if missing tun-device

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Fri Feb 5 13:21:07 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/22732 )


Change subject: apn_start: avoid segfault if missing tun-device
......................................................................

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
---
M ggsn/ggsn.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/32/22732/1

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 267637d..bb503ca 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -183,6 +183,11 @@
 	if (apn->started)
 		return 0;
 
+	if (!apn->tun.cfg.dev_name) {
+		LOGPAPN(LOGL_ERROR, apn, "Missing tun-device in config\n");
+		return -1;
+	}
+
 	LOGPAPN(LOGL_INFO, apn, "Starting\n");
 	switch (apn->cfg.gtpu_mode) {
 	case APN_GTPU_MODE_TUN:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/22732
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I9f71af65cc0eed71728c04b774e5c08352947913
Gerrit-Change-Number: 22732
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210205/ce1ee89e/attachment.htm>


More information about the gerrit-log mailing list