[BACK]Return to patch-src_trace-tcp.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / net / tcptraceroute6 / patches

Annotation of pkgsrc/net/tcptraceroute6/patches/patch-src_trace-tcp.c, Revision 1.1

1.1     ! joerg       1: $NetBSD$
        !             2:
        !             3: --- src/trace-tcp.c.orig       2015-11-06 15:53:03.000000000 +0000
        !             4: +++ src/trace-tcp.c
        !             5: @@ -51,21 +51,21 @@ send_syn_probe (int fd, unsigned ttl, un
        !             6:        if (plen < sizeof (struct tcphdr))
        !             7:                plen = sizeof (struct tcphdr);
        !             8:
        !             9: -      struct
        !            10: -      {
        !            11: -              struct tcphdr th;
        !            12: -              uint8_t payload[plen - sizeof (struct tcphdr)];
        !            13: -      } packet;
        !            14: -
        !            15: -      memset (&packet, 0, sizeof (packet));
        !            16: -      packet.th.th_sport = sport;
        !            17: -      packet.th.th_dport = port;
        !            18: -      packet.th.th_seq = htonl ((ttl << 24) | (n << 16) | getpid ());
        !            19: -      packet.th.th_off = sizeof (packet.th) / 4;
        !            20: -      packet.th.th_flags = TH_SYN | (ecn ? (TH_ECE | TH_CWR) : 0);
        !            21: -      packet.th.th_win = htons (TCP_WINDOW);
        !            22: +      uint8_t buffer[plen];
        !            23:
        !            24: -      return send_payload (fd, &packet, plen, ttl);
        !            25: +      struct tcphdr th;
        !            26: +
        !            27: +      memset(&th, 0, sizeof (th));
        !            28: +      memset(buffer, 0, plen);
        !            29: +      th.th_sport = sport;
        !            30: +      th.th_dport = port;
        !            31: +      th.th_seq = htonl ((ttl << 24) | (n << 16) | getpid ());
        !            32: +      th.th_off = sizeof (th) / 4;
        !            33: +      th.th_flags = TH_SYN | (ecn ? (TH_ECE | TH_CWR) : 0);
        !            34: +      th.th_win = htons (TCP_WINDOW);
        !            35: +      memcpy(buffer, &th, sizeof(th));
        !            36: +
        !            37: +      return send_payload (fd, buffer, plen, ttl);
        !            38:  }
        !            39:
        !            40:
        !            41: @@ -128,21 +128,21 @@ send_ack_probe (int fd, unsigned ttl, un
        !            42:        if (plen < sizeof (struct tcphdr))
        !            43:                plen = sizeof (struct tcphdr);
        !            44:
        !            45: -      struct
        !            46: -      {
        !            47: -              struct tcphdr th;
        !            48: -              uint8_t payload[plen - sizeof (struct tcphdr)];
        !            49: -      } packet;
        !            50: -
        !            51: -      memset (&packet, 0, sizeof (packet));
        !            52: -      packet.th.th_sport = sport;
        !            53: -      packet.th.th_dport = port;
        !            54: -      packet.th.th_ack = htonl ((ttl << 24) | (n << 16) | getpid ());
        !            55: -      packet.th.th_off = sizeof (packet.th) / 4;
        !            56: -      packet.th.th_flags = TH_ACK;
        !            57: -      packet.th.th_win = htons (TCP_WINDOW);
        !            58: +      uint8_t buffer[plen];
        !            59: +
        !            60: +      struct tcphdr th;
        !            61: +
        !            62: +      memset(&th, 0, sizeof (th));
        !            63: +      memset(buffer, 0, plen);
        !            64: +      th.th_sport = sport;
        !            65: +      th.th_dport = port;
        !            66: +      th.th_ack = htonl ((ttl << 24) | (n << 16) | getpid ());
        !            67: +      th.th_off = sizeof (th) / 4;
        !            68: +      th.th_flags = TH_ACK;
        !            69: +      th.th_win = htons (TCP_WINDOW);
        !            70: +      memcpy(buffer, &th, sizeof(th));
        !            71:
        !            72: -      return send_payload (fd, &packet, plen, ttl);
        !            73: +      return send_payload (fd, buffer, plen, ttl);
        !            74:  }
        !            75:
        !            76:

CVSweb <webmaster@jp.NetBSD.org>