ENUM OVS_NAT_ATTR(9)
β¨ enum ovs_nat_attr(9) β¨
okay bestie, so this is the enum ovs_nat_attr(9) page from the Kernel API Manual β literally the glow-up guide for the attributes you can slap onto %OVS_CT_ATTR_NAT. yes, the NAT action. we're doing networking lore today, stay with me π
πΈ NAME πΈ
enum ovs_nat_attr β the attributes for %OVS_CT_ATTR_NAT. that's it, that's the whole vibe check. π¦
β¨ SYNOPSIS β¨
like, here's the whole squad, in order, no cap:
enum ovs_nat_attr {
OVS_NAT_ATTR_SRC ,
OVS_NAT_ATTR_DST ,
OVS_NAT_ATTR_IP_MIN ,
OVS_NAT_ATTR_IP_MAX ,
OVS_NAT_ATTR_PROTO_MIN ,
OVS_NAT_ATTR_PROTO_MAX ,
OVS_NAT_ATTR_PERSISTENT ,
OVS_NAT_ATTR_PROTO_HASH ,
OVS_NAT_ATTR_PROTO_RANDOM
};
π Constants π
so each of these little icons has a job. let's meet them π
OVS_NAT_ATTR_SRCβ the flag for Source NAT, aka mangle the source address/port. iconic behaviour honestly.OVS_NAT_ATTR_DSTβ the flag for Destination NAT, aka mangle the destination address/port.
π¨ okay so here's the fine print, and it's giving "read the docs before you ship": - only one of (OVS_NAT_ATTR_SRC,OVS_NAT_ATTR_DST) may be specified. pick a lane, bestie. - this is effective only for packets forct_stateNEW connections. - packets of committed connections get mangled by the NAT action according to the committed NAT type, regardless of the flags you specified. so your flags don't get a vote there, sorry π - as a corollary (fancy word, ate), a NAT action without a NAT type flag will only mangle packets of committed connections. - the following NAT attributes only apply for NEW (non-committed) connections, and they may be included only when the CT action has theOVS_CT_ATTR_COMMITflag and eitherOVS_NAT_ATTR_SRCorOVS_NAT_ATTR_DSTis also included. all the conditions, but we love a struct with standards π
OVS_NAT_ATTR_IP_MINβstruct in_addrorstruct in6_addr. two types, one attribute, main character energy.OVS_NAT_ATTR_IP_MAXβstruct in_addrorstruct in6_addr. same deal, but the upper one π«ΆOVS_NAT_ATTR_PROTO_MINβu16L4 protocol specific lower boundary (port). the floor πOVS_NAT_ATTR_PROTO_MAXβu16L4 protocol specific upper boundary (port). the ceiling βOVS_NAT_ATTR_PERSISTENTβ flag for persistent IP mapping across reboots. yes, it remembers. lowkey obsessed with continuity π₯OVS_NAT_ATTR_PROTO_HASHβ flag for pseudo random L4 port mapping (MD5). pseudo random, very demure.OVS_NAT_ATTR_PROTO_RANDOMβ flag for fully randomized L4 port mapping. fully. no half measures π
π SEE ALSO π
the whole friend group, go say hi π§:
- Kernel file
./include/uapi/linux/openvswitch.h struct ovs_header(9)enum ovs_datapath_attr(9)enum ovs_packet_attr(9)enum ovs_vport_type(9)enum ovs_vport_attr(9)enum ovs_vport_upcall_attr(9)enum ovs_frag_type(9)enum ovs_flow_attr(9)enum ovs_sample_attr(9)enum ovs_userspace_attr(9)struct ovs_action_push_mpls(9)struct ovs_action_add_mpls(9)struct ovs_action_push_vlan(9)enum ovs_ct_attr(9)struct ovs_action_push_eth(9)enum ovs_check_pkt_len_attr(9)enum ovs_psample_attr(9)enum ovs_action_attr(9)
okay that's the whole page, you understood it perfectly, I'm so proud of you π₯Ήπ
sign-off szn: this lil masterpiece lives in ./include/uapi/linux, dated October 2026. drink water, commit your changes, and remember: NAT flags are temporary but the kernel is forever πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms