]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix streamtcp to print packet data to stdout. This makes the
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 20 Jul 2020 08:34:40 +0000 (10:34 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 20 Jul 2020 08:34:40 +0000 (10:34 +0200)
  stdout and stderr not mix together lines, when parsing its output.

doc/Changelog
testcode/streamtcp.c

index 8d820ca924296ef42354e72c66c7e0bf8501745e..7ed21c876aff65acfcc5386db65dceea4c72db54 100644 (file)
@@ -1,3 +1,7 @@
+20 July 2020: Wouter
+       - Fix streamtcp to print packet data to stdout.  This makes the
+         stdout and stderr not mix together lines, when parsing its output.
+
 17 July 2020: Wouter
        - Fix libnettle compile for session ticket key callback function
          changes.
index 65ea8d4bcae96317a190db032e625010dcaca8dd..c49159d33a58b1421e7be92b6ed87b51c2b6700d 100644 (file)
@@ -200,6 +200,7 @@ write_q(int fd, int udp, SSL* ssl, sldns_buffer* buf, uint16_t id,
 static void
 recv_one(int fd, int udp, SSL* ssl, sldns_buffer* buf)
 {
+       size_t i;
        char* pktstr;
        uint16_t len;
        if(!udp) {
@@ -270,7 +271,13 @@ recv_one(int fd, int udp, SSL* ssl, sldns_buffer* buf)
                len = (size_t)l;
        }
        printf("\nnext received packet\n");
-       log_buf(0, "data", buf);
+       printf("data[%d] ", (int)sldns_buffer_limit(buf));
+       for(i=0; i<sldns_buffer_limit(buf); i++) {
+               const char* hex = "0123456789ABCDEF";
+               printf("%c%c", hex[(sldns_buffer_read_u8_at(buf, i)&0xf0)>>4],
+                        hex[sldns_buffer_read_u8_at(buf, i)&0x0f]);
+       }
+       printf("\n");
 
        pktstr = sldns_wire2str_pkt(sldns_buffer_begin(buf), len);
        printf("%s", pktstr);