void tap_fd_set_offload(int fd, int csum, int tso4,
                        int tso6, int ecn, int ufo)
{
    unsigned int offload = 0;
    if (csum) {
        offload |= TUN_F_CSUM;
        if (tso4)
            offload |= TUN_F_TSO4;
        if (tso6)
            offload |= TUN_F_TSO6;
        if ((tso4 || tso6) && ecn)
            offload |= TUN_F_TSO_ECN;
        if (ufo)
            offload |= TUN_F_UFO;
    if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
        offload &= ~TUN_F_UFO;
        if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
            fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n",
                    strerror(errno));
void tap_fd_set_offload(int fd, int csum, int tso4,
                        int tso6, int ecn, int ufo)
{
    unsigned int offload = 0;
    if (csum) {
        offload |= TUN_F_CSUM;
        if (tso4)
            offload |= TUN_F_TSO4;
        if (tso6)
            offload |= TUN_F_TSO6;
        if ((tso4 || tso6) && ecn)
            offload |= TUN_F_TSO_ECN;
        if (ufo)
            offload |= TUN_F_UFO;
    if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
        offload &= ~TUN_F_UFO;
        if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
            fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n",
                    strerror(errno));
void FUNC_0(int VAR_0, int VAR_1, int VAR_2,
                        int VAR_3, int VAR_4, int VAR_5)
{
    unsigned int VAR_6 = 0;
    if (VAR_1) {
        VAR_6 |= TUN_F_CSUM;
        if (VAR_2)
            VAR_6 |= TUN_F_TSO4;
        if (VAR_3)
            VAR_6 |= TUN_F_TSO6;
        if ((VAR_2 || VAR_3) && VAR_4)
            VAR_6 |= TUN_F_TSO_ECN;
        if (VAR_5)
            VAR_6 |= TUN_F_UFO;
    if (ioctl(VAR_0, TUNSETOFFLOAD, VAR_6) != 0) {
        VAR_6 &= ~TUN_F_UFO;
        if (ioctl(VAR_0, TUNSETOFFLOAD, VAR_6) != 0) {
            fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n",
                    strerror(errno));
void FUNC_0(int VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5)
{ unsigned int VAR_6 = 0; if (VAR_1) { VAR_6 |= TUN_F_CSUM; if (VAR_2)
VAR_6 |= TUN_F_TSO4; if (VAR_3)
VAR_6 |= TUN_F_TSO6; if ((VAR_2 || VAR_3) && VAR_4)
VAR_6 |= TUN_F_TSO_ECN; if (VAR_5)
VAR_6 |= TUN_F_UFO; if (ioctl(VAR_0, TUNSETOFFLOAD, VAR_6) != 0) { VAR_6 &= ~TUN_F_UFO; if (ioctl(VAR_0, TUNSETOFFLOAD, VAR_6) != 0) { fprintf(stderr, "TUNSETOFFLOAD ioctl() failed: %s\n",
strerror(errno));