ggsn: Log tun fd write errors
Change-Id: I5f681b5edcc4cf525629d2078ae0c0ffd7ebb72d
This commit is contained in:
parent
f32c6a9095
commit
bd2b55679e
|
@ -167,6 +167,3 @@ void ggsn_close_one_pdp(struct pdp_t *pdp);
|
|||
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)
|
||||
|
|
|
@ -318,7 +318,14 @@ int tun_decaps(struct tun_t *this)
|
|||
|
||||
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)
|
||||
|
|
|
@ -59,4 +59,7 @@ extern int tun_runscript(struct tun_t *tun, char *script);
|
|||
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 */
|
||||
|
|
Loading…
Reference in New Issue