osmith has submitted this change. (
https://gerrit.osmocom.org/c/libgtpnl/+/39160?usp=email )
Change subject: dev_create: support returning -EEXIST
......................................................................
dev_create: support returning -EEXIST
Check if netlink has set errno to EEXIST and return -EEXIST in
gtp_dev_create() and gtp_dev_create_sgsn(). Users of the function can
use this to delete the GTP device and try creating it again.
Related: SYS#7240
Change-Id: Ib99bd8eed854014a5c9118c23e4058a41f3145f2
---
M src/gtp-rtnl.c
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/gtp-rtnl.c b/src/gtp-rtnl.c
index e0db921..87c7c3f 100644
--- a/src/gtp-rtnl.c
+++ b/src/gtp-rtnl.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <string.h>
#include <time.h>
+#include <errno.h>
#include <libmnl/libmnl.h>
#include <net/if.h>
@@ -143,7 +144,15 @@
EXPORT_SYMBOL(gtp_dev_create);
int gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, int fd1)
{
- return _gtp_dev_create(dest_ns, gtp_ifname, fd0, fd1, GTP_ROLE_GGSN);
+ int rc;
+
+ errno = 0;
+ rc = _gtp_dev_create(dest_ns, gtp_ifname, fd0, fd1, GTP_ROLE_GGSN);
+
+ if (rc < 0 && errno)
+ return -errno;
+
+ return rc;
}
EXPORT_SYMBOL(gtp_dev_create_sgsn);
--
To view, visit
https://gerrit.osmocom.org/c/libgtpnl/+/39160?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: Ib99bd8eed854014a5c9118c23e4058a41f3145f2
Gerrit-Change-Number: 39160
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>