diff options
| author | Richard Scheffenegger <rscheff@FreeBSD.org> | 2024-11-29 08:44:59 +0000 |
|---|---|---|
| committer | Richard Scheffenegger <rscheff@FreeBSD.org> | 2024-11-29 08:48:23 +0000 |
| commit | 0fc7bdc978366abb4351b0b76b50a5848cc5d982 (patch) | |
| tree | d44b508364fb24853ad6a11165ae0cd83e9db35d /sys/netgraph | |
| parent | 4020351325c02cc27aa4992c199ff18a9542a52c (diff) | |
tcp: extend the use of the th_flags accessor function
Formally, there are 12 bits for TCP header flags.
Use the accessor functions in more (kernel) places.
No functional change.
Reviewed By: cc, #transport, cy, glebius, #iflib, kbowling
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D47063
Diffstat (limited to 'sys/netgraph')
| -rw-r--r-- | sys/netgraph/netflow/netflow.c | 16 | ||||
| -rw-r--r-- | sys/netgraph/netflow/ng_netflow.h | 4 | ||||
| -rw-r--r-- | sys/netgraph/ng_tcpmss.c | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index f227bfda4e51..978d6fd0b54d 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -107,11 +107,11 @@ static int export_send(priv_p, fib_export_p, item_p, int); #ifdef INET static int hash_insert(priv_p, struct flow_hash_entry *, struct flow_rec *, - int, uint8_t, uint8_t); + int, uint8_t, uint16_t); #endif #ifdef INET6 static int hash6_insert(priv_p, struct flow_hash_entry *, struct flow6_rec *, - int, uint8_t, uint8_t); + int, uint8_t, uint16_t); #endif static void expire_flow(priv_p, fib_export_p, struct flow_entry *, int); @@ -320,7 +320,7 @@ ng_netflow_copyinfo(priv_p priv, struct ng_netflow_info *i) #ifdef INET static int hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, - int plen, uint8_t flags, uint8_t tcp_flags) + int plen, uint8_t flags, uint16_t tcp_flags) { struct flow_entry *fle; @@ -397,7 +397,7 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, #ifdef INET6 static int hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, - int plen, uint8_t flags, uint8_t tcp_flags) + int plen, uint8_t flags, uint16_t tcp_flags) { struct flow6_entry *fle6; @@ -659,7 +659,7 @@ ng_netflow_flow_add(priv_p priv, fib_export_p fe, struct ip *ip, struct flow_rec r; int hlen, plen; int error = 0; - uint8_t tcp_flags = 0; + uint16_t tcp_flags = 0; bzero(&r, sizeof(r)); @@ -702,7 +702,7 @@ ng_netflow_flow_add(priv_p priv, fib_export_p fe, struct ip *ip, tcp = (struct tcphdr *)((caddr_t )ip + hlen); r.r_sport = tcp->th_sport; r.r_dport = tcp->th_dport; - tcp_flags = tcp->th_flags; + tcp_flags = tcp_get_flags(tcp); break; } case IPPROTO_UDP: @@ -787,7 +787,7 @@ ng_netflow_flow6_add(priv_p priv, fib_export_p fe, struct ip6_hdr *ip6, struct flow6_rec r; int plen; int error = 0; - uint8_t tcp_flags = 0; + uint16_t tcp_flags = 0; /* check version */ if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) @@ -816,7 +816,7 @@ ng_netflow_flow6_add(priv_p priv, fib_export_p fe, struct ip6_hdr *ip6, tcp = (struct tcphdr *)upper_ptr; r.r_ports = *(uint32_t *)upper_ptr; - tcp_flags = tcp->th_flags; + tcp_flags = tcp_get_flags(tcp); break; } case IPPROTO_UDP: diff --git a/sys/netgraph/netflow/ng_netflow.h b/sys/netgraph/netflow/ng_netflow.h index ec62ccd3f7b2..8e18bb5a4bf4 100644 --- a/sys/netgraph/netflow/ng_netflow.h +++ b/sys/netgraph/netflow/ng_netflow.h @@ -259,7 +259,7 @@ struct flow_entry_data { u_long bytes; long first; /* uptime on first packet */ long last; /* uptime on last packet */ - u_char tcp_flags; /* cumulative OR */ + uint16_t tcp_flags; /* cumulative OR */ }; struct flow6_entry_data { @@ -277,7 +277,7 @@ struct flow6_entry_data { u_long bytes; long first; /* uptime on first packet */ long last; /* uptime on last packet */ - u_char tcp_flags; /* cumulative OR */ + uint16_t tcp_flags; /* cumulative OR */ }; /* diff --git a/sys/netgraph/ng_tcpmss.c b/sys/netgraph/ng_tcpmss.c index 02fa097369ad..ab055bd9bb24 100644 --- a/sys/netgraph/ng_tcpmss.c +++ b/sys/netgraph/ng_tcpmss.c @@ -330,7 +330,7 @@ ng_tcpmss_rcvdata(hook_p hook, item_p item) ERROUT(EINVAL); /* Check SYN packet and has options. */ - if (!(tcp->th_flags & TH_SYN) || tcphlen == sizeof(struct tcphdr)) + if (!(tcp_get_flags(tcp) & TH_SYN) || tcphlen == sizeof(struct tcphdr)) goto send; /* Update SYN stats. */ |
