Code cleanup
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
#define O_CLOEXEC 0
|
#define O_CLOEXEC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GT_MTU(X) ((X) - 28)
|
#define GT_MTU(X) ((X)-28)
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
volatile sig_atomic_t quit;
|
volatile sig_atomic_t quit;
|
||||||
@@ -386,8 +386,7 @@ main(int argc, char **argv)
|
|||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
while (sizeof(buf) - size >= gt.mtu) {
|
while (sizeof(buf) - size >= gt.mtu) {
|
||||||
const int r = tun_read(tun_fd, &buf[size],
|
const int r = tun_read(tun_fd, &buf[size], sizeof(buf) - size);
|
||||||
sizeof(buf) - size);
|
|
||||||
|
|
||||||
if (r <= 0 || r > gt.mtu)
|
if (r <= 0 || r > gt.mtu)
|
||||||
break;
|
break;
|
||||||
@@ -422,7 +421,7 @@ main(int argc, char **argv)
|
|||||||
tc = ic.tc & 0xFC;
|
tc = ic.tc & 0xFC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == q)
|
if (p >= q)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int r = mud_send(mud, &buf[p], q - p, tc);
|
int r = mud_send(mud, &buf[p], q - p, tc);
|
||||||
|
|||||||
Reference in New Issue
Block a user