Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions iptables-module/xt_mpeg2ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ struct mpeg2ts_stream { /* Like xt_hashlimit: dsthash_ent */
*/
uint64_t packets ____cacheline_aligned;
uint64_t payload_bytes;
uint64_t null_bytes;

/* Per stream total skips and discontinuity */
/* TODO: Explain difference between skips and discontinuity */
Expand Down Expand Up @@ -975,6 +976,11 @@ dissect_tsp(const unsigned char *payload_ptr, uint16_t payload_len,
msg_dbg(PKTDATA, "TS header:0x%X pid:%d cc:%d afc:%u",
header, pid, cc_curr, afc);

/* TS packet counters */
if (unlikely(pid == 8191)) {
stream->null_bytes += payload_len;
}

/* Adaption Field Control header */
if (unlikely(afc == 2)) {
/* An 'adaptation field only' packet will have the
Expand Down Expand Up @@ -1056,7 +1062,7 @@ dissect_mpeg2ts(const unsigned char *payload_ptr, uint16_t payload_len,

while ((payload_len - offset) >= MP2T_PACKET_SIZE) {

skips = dissect_tsp(payload_ptr, payload_len, skb, stream);
skips = dissect_tsp(payload_ptr, MP2T_PACKET_SIZE, skb, stream);

if (skips > 0)
discontinuity++;
Expand Down Expand Up @@ -1308,7 +1314,8 @@ static int mpeg2ts_seq_show_real(struct mpeg2ts_stream *stream,

res = seq_printf(s, "bucket:%d dst:%pI4 src:%pI4 dport:%u sport:%u "
"pids:%d skips:%llu discontinuity:%llu "
"payload_bytes:%llu packets:%llu\n",
"payload_bytes:%llu packets:%llu "
"null_bytes:%llu\n",
bucket,
&stream->match.dst_addr,
&stream->match.src_addr,
Expand All @@ -1318,7 +1325,8 @@ static int mpeg2ts_seq_show_real(struct mpeg2ts_stream *stream,
stream->skips,
stream->discontinuity,
stream->payload_bytes,
stream->packets
stream->packets,
stream->null_bytes
);

atomic_dec(&stream->use);
Expand Down