Fix for debug output on Big Endian
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | set_elem: Review debug outputsrc/ | +21 | 0 replies | |
| 2/9 | expr: data_reg: Avoid extra whitespacesrc/ src/ src/ +3 more | +24 | 0 replies | |
| 3/9 | expr: Pass byteorder to struct expr_ops::set callbackinclude/ src/ src/ +38 more | +77 | 0 replies | |
| 4/9 | data_reg: Introduce struct nftnl_data_reg::byteorder fieldinclude/ src/ src/ +4 more | +18 | 0 replies | |
| 5/9 | data_reg: Introduce struct nftnl_data_reg::sizes arrayinclude/ src/ src/ +4 more | +22 | 0 replies | |
| 6/9 | Introduce nftnl_{expr,set_elem}_set_imm()include/ include/ src/ +2 more | +38 | 0 replies | |
| 7/9 | data_reg: Respect data byteorder when printingsrc/ | +23 | 0 replies | |
| 8/9 | data_reg: Support concatenated datasrc/ | +38 | 0 replies | |
| 9/9 | udata: Store u32 udata values in Big Endiansrc/ | +5 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [libnftnl PATCH 0/9] Fix for debug output on Big Endian
This series aims at providing identical netlink debug output in nftables on Big and Little Endian systems. Particularly problematic are all data regs in host byte order, worsened by the potential for byte order swaps within a single data reg (concatenated set elements).
A bonus task is cropping data reg values to their actual size. Previously, every four-byte register containing data was printed which further reduces data expressiveness.
This series introduces data attribute setters for expressions and set elements which accept a byteorder value (plus an array of component sizes in the latter case) and changes the data reg printer to:
- Print only nftnl_data_reg::len bytes at max
- Print data byte-by-byte, not four byte chunks as u32 values interpreted in host byte order
- Print data in reverse if in host byte order on Little Endian
If nftnl_data_reg::sizes array has non-zero fields, data is assumed to be concatenated and bits in nftnl_data_reg::byteorder signal host byte order in components. Each component is then printed as per the above rules and separated by a dot (".").
Patches 3-8 implement the above. Since debug output changes significantly, use the occasion to:
- Print a colon (":") and flags value only if relevant (patch 1)
- Fix for missing object name in objmap elements (patch 1)
- Avoid ambiguity between data and flags value by prefixing with 'flags' (patch 1)
- Avoid trailing whitespace or space before tab (patch 2)
Finally, patch 8 tries to avoid userdata values in host byte order by storing u32 values in Big Endian. Since nftnl_udata_put_u32() is the only typed attribute setter (apart from the unproblematic strz one), this may be good enough for the purpose.
Phil Sutter (9):
set_elem: Review debug output
expr: data_reg: Avoid extra whitespace
expr: Pass byteorder to struct expr_ops::set callback
data_reg: Introduce struct nftnl_data_reg::byteorder field
data_reg: Introduce struct nftnl_data_reg::sizes array Introduce nftnl_{expr,set_elem}_set_imm()
data_reg: Respect data byteorder when printing
data_reg: Support concatenated data
udata: Store u32 udata values in Big Endian
include/data_reg.h | 5 +++- include/expr_ops.h | 2 +- include/libnftnl/expr.h | 1 + include/libnftnl/set.h | 1 + src/expr.c | 22 +++++++++++--- src/expr/bitwise.c | 18 ++++++++---- src/expr/byteorder.c | 2 +- src/expr/cmp.c | 8 ++++-- src/expr/connlimit.c | 2 +- src/expr/counter.c | 2 +- src/expr/ct.c | 2 +- src/expr/data_reg.c | 64 ++++++++++++++++++++++++++++++++++++----- src/expr/dup.c | 5 ++-- src/expr/dynset.c | 2 +- src/expr/exthdr.c | 2 +- src/expr/fib.c | 2 +- src/expr/flow_offload.c | 5 ++-- src/expr/fwd.c | 5 ++-- src/expr/hash.c | 2 +- src/expr/immediate.c | 8 ++++-- src/expr/inner.c | 2 +- src/expr/last.c | 5 ++-- src/expr/limit.c | 2 +- src/expr/log.c | 5 ++-- src/expr/lookup.c | 2 +- src/expr/masq.c | 2 +- src/expr/match.c | 2 +- src/expr/meta.c | 2 +- src/expr/nat.c | 2 +- src/expr/numgen.c | 2 +- src/expr/objref.c | 5 ++-- src/expr/osf.c | 5 ++-- src/expr/payload.c | 2 +- src/expr/queue.c | 5 ++-- src/expr/quota.c | 5 ++-- src/expr/range.c | 17 ++++++++--- src/expr/redir.c | 2 +- src/expr/reject.c | 5 ++-- src/expr/rt.c | 2 +- src/expr/socket.c | 2 +- src/expr/synproxy.c | 5 ++-- src/expr/target.c | 2 +- src/expr/tproxy.c | 2 +- src/expr/tunnel.c | 5 ++-- src/expr/xfrm.c | 2 +- src/libnftnl.map | 5 ++++ src/set_elem.c | 61 ++++++++++++++++++++++++++++----------- src/udata.c | 7 +++-- 48 files changed, 233 insertions(+), 92 deletions(-)
Signature · 1 line
2.51.0