]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/tcp: Add a helper tcp_ao_hdr_maclen()
authorDmitry Safonov <0x7f454c46@gmail.com>
Thu, 6 Jun 2024 23:25:56 +0000 (00:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Jun 2024 05:39:04 +0000 (06:39 +0100)
It's going to be used more in TCP-AO tracepoints.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp_ao.h
net/ipv4/tcp_ao.c

index 5d8e9ed2c0056f8437baf6b7d1853d30f079a64a..198e02004ad2307c130b40eab210f6d0c3f7858f 100644 (file)
@@ -19,6 +19,11 @@ struct tcp_ao_hdr {
        u8      rnext_keyid;
 };
 
+static inline u8 tcp_ao_hdr_maclen(const struct tcp_ao_hdr *aoh)
+{
+       return aoh->length - sizeof(struct tcp_ao_hdr);
+}
+
 struct tcp_ao_counters {
        atomic64_t      pkt_good;
        atomic64_t      pkt_bad;
index 37c42b63ff993466b52c5eea7270312149ca913b..50ae43c928290f1c7cc4cf2dc2fdb47729e3cb6d 100644 (file)
@@ -884,8 +884,8 @@ tcp_ao_verify_hash(const struct sock *sk, const struct sk_buff *skb,
                   const struct tcp_ao_hdr *aoh, struct tcp_ao_key *key,
                   u8 *traffic_key, u8 *phash, u32 sne, int l3index)
 {
-       u8 maclen = aoh->length - sizeof(struct tcp_ao_hdr);
        const struct tcphdr *th = tcp_hdr(skb);
+       u8 maclen = tcp_ao_hdr_maclen(aoh);
        void *hash_buf = NULL;
 
        if (maclen != tcp_ao_maclen(key)) {