Skip to content

Commit

Permalink
net: sched: use skb_ip_totlen and iph_totlen
Browse files Browse the repository at this point in the history
There are 1 action and 1 qdisc that may process IPv4 TCP GSO packets
and access iph->tot_len, replace them with skb_ip_totlen() and
iph_totlen() accordingly.

Note that we don't need to replace the one in tcf_csum_ipv4(), as it
will return for TCP GSO packets in tcf_csum_ipv4_tcp().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Xin Long authored and Jakub Kicinski committed Feb 2, 2023
1 parent ec84c95 commit 043e397
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/sched/act_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ static int tcf_ct_skb_network_trim(struct sk_buff *skb, int family)

switch (family) {
case NFPROTO_IPV4:
len = ntohs(ip_hdr(skb)->tot_len);
len = skb_ip_totlen(skb);
break;
case NFPROTO_IPV6:
len = sizeof(struct ipv6hdr)
Expand Down
2 changes: 1 addition & 1 deletion net/sched/sch_cake.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ static struct sk_buff *cake_ack_filter(struct cake_sched_data *q,
iph_check->daddr != iph->daddr)
continue;

seglen = ntohs(iph_check->tot_len) -
seglen = iph_totlen(skb, iph_check) -
(4 * iph_check->ihl);
} else if (iph_check->version == 6) {
ipv6h = (struct ipv6hdr *)iph;
Expand Down

0 comments on commit 043e397

Please sign in to comment.