Le 05/01/2017 à 17:59, Davide Caratti a écrit : > 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 <dcara...@redhat.com> > --- > 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.
> }; > > 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] > @@ -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)) > + 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