key_extract(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… key_extract πŸ’…

okay bestie, welcome to the Kernel API Manual page for key_extract β€” the function that pulls a flow key out of an Ethernet frame. it's giving β€œextract the key, set the headers, no cap” 🫢

πŸ’– NAME πŸ’–

key_extract β€” extracts a flow key from an Ethernet frame. periodt. ✨

πŸŽ€ SYNOPSIS πŸŽ€

int key_extract (struct sk_buff *skb , struct sw_flow_key *key );

🌸 ARGUMENTS 🌸

  • skb β€” the sk_buff that contains the frame, with skb->data pointing to the Ethernet header. that's the main character input, fr fr. πŸ‘‘
  • key β€” the output flow key. this is where the key gets written out, bestie. πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function initializes skb header fields like this:

  • skb->mac_header β€” the L2 header. iconic. ✨
  • skb->network_header β€” just past the L2 header, or just past the VLAN header, to the first byte of the L2 payload. slay. 🌈
  • skb->transport_header β€” If key->eth.type is ETH_P_IP or ETH_P_IPV6 on output, then just past the IP header, if one is present and of a correct length, otherwise the same as skb->network_header. For other key->eth.type values it is left untouched. no cap, that's the whole rule. 🧚
  • skb->protocol β€” the type of the data starting at skb->network_header. Equals to key->eth.type. literally matching, adorable. πŸ’œ

πŸ’œ RETURN πŸ’œ

0 if successful, otherwise a negative errno value. bestie, if it's negative, that's your signal something went sideways. 😭

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./net/openvswitch/flow.c and the besties get_ipv6_ext_hdrs(9), parse_vlan_tag(9), key_extract_l3l4(9). iykyk πŸ’…


mwah πŸ’‹ β€” source ./net/openvswitch, October 2026, page key_extract(9).

πŸ“¦ where this page comes from