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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/24494 )
Change subject: ggsn: Log tun fd write errors
......................................................................
ggsn: Log tun fd write errors
Change-Id: I5f681b5edcc4cf525629d2078ae0c0ffd7ebb72d
---
M ggsn/ggsn.h
M lib/tun.c
M lib/tun.h
3 files changed, 11 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/ggsn/ggsn.h b/ggsn/ggsn.h
index 82984a0..132d059 100644
--- a/ggsn/ggsn.h
+++ b/ggsn/ggsn.h
@@ -167,6 +167,3 @@
LOGP(DGGSN, level, "GGSN(%s): " fmt, (ggsn)->cfg.name, ## args)
#define LOGPPDP(level, pdp, fmt, args...) LOGPDPX(DGGSN, level, pdp, fmt, ## args)
-
-#define LOGTUN(level, tun, fmt, args...) \
- LOGP(DTUN, level, "TUN(%s): " fmt, (tun)->devname, ## args)
diff --git a/lib/tun.c b/lib/tun.c
index c771b92..cb66fef 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -318,7 +318,14 @@
int tun_encaps(struct tun_t *tun, void *pack, unsigned len)
{
- return write(tun->fd, pack, len);
+ int rc;
+ rc = write(tun->fd, pack, len);
+ if (rc < 0) {
+ SYS_ERR(DTUN, LOGL_ERROR, errno, "TUN(%s): write() failed", tun->devname);
+ } else if (rc < len) {
+ LOGTUN(LOGL_ERROR, tun, "short write() %d < %u\n", rc, len);
+ }
+ return rc;
}
int tun_runscript(struct tun_t *tun, char *script)
diff --git a/lib/tun.h b/lib/tun.h
index 07ca04a..36a4f7e 100644
--- a/lib/tun.h
+++ b/lib/tun.h
@@ -59,4 +59,7 @@
int tun_ip_local_get(const struct tun_t *tun, struct in46_prefix *prefix_list,
size_t prefix_size, int flags);
+#define LOGTUN(level, tun, fmt, args...) \
+ LOGP(DTUN, level, "TUN(%s): " fmt, (tun)->devname, ## args)
+
#endif /* !_TUN_H */
--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/24494
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I5f681b5edcc4cf525629d2078ae0c0ffd7ebb72d
Gerrit-Change-Number: 24494
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
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/20210601/5faddfd0/attachment.htm>