Skip to content

Commit 7286308

Browse files
0x7f454c46davem330
authored andcommitted
net/tcp: Add a helper tcp_ao_hdr_maclen()
It's going to be used more in TCP-AO tracepoints. Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3966a66 commit 7286308

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/net/tcp_ao.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ struct tcp_ao_hdr {
1919
u8 rnext_keyid;
2020
};
2121

22+
static inline u8 tcp_ao_hdr_maclen(const struct tcp_ao_hdr *aoh)
23+
{
24+
return aoh->length - sizeof(struct tcp_ao_hdr);
25+
}
26+
2227
struct tcp_ao_counters {
2328
atomic64_t pkt_good;
2429
atomic64_t pkt_bad;

net/ipv4/tcp_ao.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,8 @@ tcp_ao_verify_hash(const struct sock *sk, const struct sk_buff *skb,
884884
const struct tcp_ao_hdr *aoh, struct tcp_ao_key *key,
885885
u8 *traffic_key, u8 *phash, u32 sne, int l3index)
886886
{
887-
u8 maclen = aoh->length - sizeof(struct tcp_ao_hdr);
888887
const struct tcphdr *th = tcp_hdr(skb);
888+
u8 maclen = tcp_ao_hdr_maclen(aoh);
889889
void *hash_buf = NULL;
890890

891891
if (maclen != tcp_ao_maclen(key)) {

0 commit comments

Comments
 (0)