diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-11-21 14:12:22 +0100 |
---|---|---|
committer | Stefan Sperling <ssperling@sysmocom.de> | 2018-11-21 14:14:10 +0100 |
commit | aee905b79016fec402e1d3b8fc0e6ce2332cb647 (patch) | |
tree | 8c2e663eef050377cbce6b2615ae8aeba21a0f32 /lib/tun.c | |
parent | fb75adfeda2372bbd0ebd2e13602eca78f505efa (diff) |
check ioctl() call return value in tun_new()
Coverity complains about a missing ioctl() return value check.
Check for failure of the TUNSETNOCSUM ioctl and log a warning
if it fails.
Change-Id: I88da2164d975d7a232619b8d31c5eadeef0f3a80
Related: CID#57661
Diffstat (limited to 'lib/tun.c')
-rw-r--r-- | lib/tun.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -193,7 +193,10 @@ int tun_new(struct tun_t **tun, const char *dev_name, bool use_kernel, int fd0, strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ); (*tun)->devname[IFNAMSIZ - 1] = 0; - ioctl((*tun)->fd, TUNSETNOCSUM, 1); /* Disable checksums */ + /* Disable checksums */ + if (ioctl((*tun)->fd, TUNSETNOCSUM, 1) < 0) { + SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", (*tun)->devname); + } return 0; } else { strncpy((*tun)->devname, dev_name, IFNAMSIZ); |