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/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Feb 5 20:47:42 UTC 2021


laforge has submitted this change. ( 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_vty.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



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 @@
 	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;

-- 
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: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210205/21b77f57/attachment.htm>


More information about the gerrit-log mailing list