Changeset 2c457ec for lib/format_tsh.c


Ignore:
Timestamp:
11/16/17 10:37:56 (3 years ago)
Author:
Robert A Zeh <razeh@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
9726d0e
Parents:
be32cc7
git-author:
Robert A Zeh <robert.a.zeh@…> (11/16/17 10:36:16)
git-committer:
Robert A Zeh <razeh@…> (11/16/17 10:37:56)
Message:

Add TRACE_ERR_WANDIO_FAILED for wandio error reporting.

Passing an errcode of 0 to trace_set_err triggers the assertion at
format_helper.c:290, making the error unrecoverable for the calling
code. This happens when the wandio layer encounters an error while
errno is still 0 (for example, an incomplete pcap packet).

To make the error recoverable, pass in TRACE_ERR_WANDIO_FAILED instead
of errno.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_tsh.c

    ree6e802 r2c457ec  
    131131                                        buffer2,
    132132                                        (size_t)sizeof(tsh_pkt_header_t))) == -1) {
    133                 trace_set_err(libtrace,errno,"read(%s)",
     133                trace_set_err(libtrace,TRACE_ERR_WANDIO_FAILED,"read(%s)",
    134134                                libtrace->uridata);
    135135                return -1;
     
    141141
    142142        if (numbytes < (int)sizeof(tsh_pkt_header_t)) {
    143                 trace_set_err(libtrace, errno, "Incomplete TSH header");
     143                trace_set_err(libtrace, TRACE_ERR_WANDIO_FAILED, "Incomplete TSH header");
    144144                return -1;
    145145        }
     
    152152                                (size_t)sizeof(libtrace_ip_t)+16))  /* 16 bytes of transport header */
    153153                        != sizeof(libtrace_ip_t)+16) {
    154                 trace_set_err(libtrace,errno,"read(%s)",
     154                trace_set_err(libtrace,TRACE_ERR_WANDIO_FAILED,"read(%s)",
    155155                                libtrace->uridata);
    156156                return -1;
     
    167167                                buffer2,
    168168                                16)) != 16) {
    169                 trace_set_err(libtrace,errno,"read(%s)",
     169                trace_set_err(libtrace,TRACE_ERR_WANDIO_FAILED,"read(%s)",
    170170                                libtrace->uridata);
    171171                return -1;
Note: See TracChangeset for help on using the changeset viewer.