Re: [PATCH net-next 2/2] net/sched: act_csum: compute crc32c on SCTP packets
From: Nicolas Dichtel <hidden>
Date: 2017-01-06 09:23:22
Le 05/01/2017 à 17:59, Davide Caratti a écrit :
quoted hunk ↗ jump to hunk
modify act_csum to compute crc32c on IPv4/IPv6 packets having SCTP in their payload, and extend UAPI definitions accordingly. Signed-off-by: Davide Caratti <redacted> --- include/uapi/linux/tc_act/tc_csum.h | 3 ++- net/sched/act_csum.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-)diff --git a/include/uapi/linux/tc_act/tc_csum.h b/include/uapi/linux/tc_act/tc_csum.h index 8ac8041..58d457f 100644 --- a/include/uapi/linux/tc_act/tc_csum.h +++ b/include/uapi/linux/tc_act/tc_csum.h@@ -21,7 +21,8 @@ enum { TCA_CSUM_UPDATE_FLAG_IGMP = 4, TCA_CSUM_UPDATE_FLAG_TCP = 8, TCA_CSUM_UPDATE_FLAG_UDP = 16, - TCA_CSUM_UPDATE_FLAG_UDPLITE = 32 + TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, + TCA_CSUM_UPDATE_FLAG_SCTP = 64
nit: please put a comma after the '64' so that the next person who adds a flag will not have to touch that line.
quoted hunk ↗ jump to hunk
}; struct tc_csum {diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index a0edd80..620ac9b 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c
[snip]
quoted hunk ↗ jump to hunk
@@ -365,6 +385,12 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) ntohs(iph->tot_len), 1)) goto fail; break; + case IPPROTO_SCTP: + if (update_flags & TCA_CSUM_UPDATE_FLAG_SCTP) + if (!tcf_csum_sctp(skb, iph->ihl * 4, + ntohs(iph->tot_len)))
nit: one 'if' only? if (update_flags & TCA_CSUM_UPDATE_FLAG_SCTP && !tcf_csum_sctp(skb, iph->ihl * 4, ntohs(iph->tot_len))
quoted hunk ↗ jump to hunk
+ goto fail; + break; } if (update_flags & TCA_CSUM_UPDATE_FLAG_IPV4HDR) {@@ -481,6 +507,12 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) pl + sizeof(*ip6h), 1)) goto fail; goto done; + case IPPROTO_SCTP: + if (update_flags & TCA_CSUM_UPDATE_FLAG_SCTP) + if (!tcf_csum_sctp(skb, hl, + pl + sizeof(*ip6h)))
Same here. Regards, Nicolas