pipapo_get_boundaries(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

Welcome to pipapo_get_boundaries(9), bestie πŸ’– β€” this is the Kernel API Manual, and today’s main character energy is all about getting the byte interval for associated rules. Let’s go.

πŸ’– NAME πŸ’–

pipapo_get_boundaries β€” Get byte interval for associated rules. No cap.

✨ SYNOPSIS ✨

int pipapo_get_boundaries (struct nft_pipapo_field *f , int first_rule ,
int rule_count , u8 *left , u8 *right );

πŸŽ€ ARGUMENTS πŸŽ€

  • f β€” the field including the lookup table.
  • first_rule β€” first rule (lowest index).
  • rule_count β€” number of associated rules.
  • left β€” byte expression for left boundary (start of range).
  • right β€” byte expression for right boundary (end of range).

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here’s the vibe: given the first rule and amount of rules that originated from the same entry, this function builds the original range associated with the entry, and it calculates the length of the originating netmask. Obsessed.

In pictures:

bucket group  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14
15 0                                                   1,2 1   1,2 2
1,2 3                                   1,2 4   1,2 5        1   2 6
1,2  1   1   1   1   1   1   1   1   1   1   1   1   1   1   1 7   1,2
1,2  1   1   1   1   1   1   1   1   1   1   1   1   1   1

This is the lookup table corresponding to the IPv4 range 192.168.1.0-192.168.2.1, which was expanded to the two composing netmasks, rule #1: 192.168.1.0/24, and rule #2: 192.168.2.0/31.

This function fills left and right with the byte values of the leftmost and rightmost bucket indices for the lowest and highest rule indices, respectively. If first_rule is 1 and rule_count is 2, we obtain, in nibbles: left: < 12, 0, 10, 8, 0, 1, 0, 0 > and right: < 12, 0, 10, 8, 0, 2, 2, 1 >, corresponding to bytes: left: < 192, 168, 1, 0 > and right: < 192, 168, 2, 1 >. The mask length is irrelevant here, unused on return, because the range is already defined by its start and end points. The mask length is relevant for a single ranged entry instead: if first_rule is 1 and rule_count is 1, we ignore rule 2 above: left becomes < 192, 168, 1, 0 >, right becomes < 192, 168, 1, 255 >, and the mask length, calculated from the distances between leftmost and rightmost bucket indices for each group, would be 24. Periodt.

🌸 RETURN 🌸

Mask length, in bits. That’s the whole return, bestie.

🌈 SEE ALSO 🌈

Go read these too, iykyk:


xoxo, your Unix bestie πŸ’… β€” source/version: ./net/netfilter; date: October 2026. That’s the footer, periodt. 🫢

πŸ“¦ where this page comes from