diff --git a/pping/pping_helpers.h b/pping/pping_helpers.h index 1e87db6..83d1078 100644 --- a/pping/pping_helpers.h +++ b/pping/pping_helpers.h @@ -29,7 +29,7 @@ struct parsing_context { void *data; //Start of eth hdr void *data_end; //End of safe acessible area struct hdr_cursor nh; //Position to parse next - __u32 len; //Full packet length (headers+data) + __u32 pkt_len; //Full packet length (headers+data) }; /* @@ -109,7 +109,7 @@ static int parse_tcp_identifier(struct parsing_context *ctx, bool is_egress, return -1; // Do not timestamp pure ACKs - if (is_egress && ctx->nh.pos - ctx->data >= ctx->len && !tcph->syn) + if (is_egress && ctx->nh.pos - ctx->data >= ctx->pkt_len && !tcph->syn) return -1; if (parse_tcp_ts(tcph, ctx->data_end, &tsval, &tsecr) < 0) diff --git a/pping/pping_kern_tc.c b/pping/pping_kern_tc.c index ddd9b84..c750ea3 100644 --- a/pping/pping_kern_tc.c +++ b/pping/pping_kern_tc.c @@ -31,14 +31,14 @@ struct bpf_elf_map SEC("maps") ts_start = { SEC(TCBPF_PROG_SEC) int tc_bpf_prog_egress(struct __sk_buff *skb) { - struct parsing_context pctx; struct packet_id p_id = { 0 }; struct packet_timestamp p_ts = { 0 }; - - pctx.data = (void *)(long)skb->data; - pctx.data_end = (void *)(long)skb->data_end; - pctx.len = skb->len; - pctx.nh.pos = pctx.data; + struct parsing_context pctx = { + .data = (void *)(long)skb->data, + .data_end = (void *)(long)skb->data_end, + .pkt_len = skb->len, + .nh = { .pos = pctx.data }, + }; if (parse_packet_identifier(&pctx, true, &p_id) < 0) goto end; diff --git a/pping/pping_kern_xdp.c b/pping/pping_kern_xdp.c index 3165eaa..f0a95aa 100644 --- a/pping/pping_kern_xdp.c +++ b/pping/pping_kern_xdp.c @@ -25,15 +25,15 @@ struct { SEC(XDP_PROG_SEC) int xdp_prog_ingress(struct xdp_md *ctx) { - struct parsing_context pctx; struct packet_id p_id = { 0 }; struct packet_timestamp *p_ts; struct rtt_event event = { 0 }; - - pctx.data = (void *)(long)ctx->data; - pctx.data_end = (void *)(long)ctx->data_end; - pctx.len = pctx.data_end - pctx.data; - pctx.nh.pos = pctx.data; + struct parsing_context pctx = { + .data = (void *)(long)ctx->data, + .data_end = (void *)(long)ctx->data_end, + .pkt_len = pctx.data_end - pctx.data, + .nh = { .pos = pctx.data }, + }; if (parse_packet_identifier(&pctx, false, &p_id) < 0) goto end;