Formally, there are 12 bits for TCP header flags.
Use the accessor functions in more (kernel) places.
No functional change.
Differential D47063
extend the use of the th_flags accessor function rscheff on Oct 11 2024, 4:13 PM. Authored by Tags None Referenced Files
Details Formally, there are 12 bits for TCP header flags. No functional change.
Diff Detail
Event TimelineComment Actions This fails to build in /sbin/natd. ld: error: undefined reference due to --no-allow-shlib-undefined: tcp_get_flags
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Stop. Comment Actions I'm happy with the pf bits. We should probably do this too: diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 30be1128d4d3..88f9c236b14d 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2338,7 +2338,7 @@ extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); extern void pf_print_state(struct pf_kstate *); -extern void pf_print_flags(u_int8_t); +extern void pf_print_flags(uint16_t); extern int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index bd8b709e396e..47134a169a68 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -2891,7 +2891,7 @@ pf_print_state_parts(struct pf_kstate *s, } void -pf_print_flags(u_int8_t f) +pf_print_flags(uint16_t f) { if (f) printf(" "); @@ -2911,6 +2911,8 @@ pf_print_flags(u_int8_t f) printf("E"); if (f & TH_CWR) printf("W"); + if (f & TH_AE) + printf("[AE]"); } #define PF_SET_SKIP_STEPS(i) \
Comment Actions
Comment Actions Thanks. I added this, but used the same character ("e") used by tcpdump ( https://github.com/the-tcpdump-group/tcpdump/pull/999/commits/55dc3206aa07c3cdfe19b8d23e7b134d37b9a6b7#diff-7334e7c33e9abb09f57bd40e3c24fbb29a7088bf0ab7cc2f499b1425fc6b9741 ) for consistency (even though here we use "A" instead of "." for the ACK flag).
Comment Actions I current concern is that new code for the TH_AE shall be in a separate patch, so that this patch can be a pure big non-functional change.
Comment Actions
Comment Actions This seems fine to me (cxgbe bits). In some places I misread tcp_set_flags as being an or (I) operation rather than assignment (=) since in English prose "setting a flag" usually means enabling a flag (or flags) leaving other bits unchanged. In a similar vein, having a tcp_clear_flags helper that took a mask of bits to clear might be nicer to replace places that previously used &= ~. Some sort of wrapper for |= might also be nice. I'm not sure what to call that wrapper though without further tripping over the ambiguity of tcp_set_flags. (atomic_set_* set bits rather than assigning values and that has caused some confusion in the past as well FWIW.) Comment Actions @kbowling, can you have a look at the intel driver changes and if they seem ok, remove that blocker?
|