Skip to content

Commit

Permalink
checkpolicy: Check the right bits of an ibpkeycon rule subnet prefix
Browse files Browse the repository at this point in the history
The lower 64 bits of the subnet prefix for an ibpkeycon rule should
all be 0's. Unfortunately the check uses the s6_addr macro which refers
to the 16 entry array of 8-bit values in the union and does not refer
to the correct bits.

Use the s6_addr32 macro instead which refers to the 4 entry array of
32-bit values in the union and refers to the lower 64 bits.

Signed-off-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
jwcart2 authored and stephensmalley committed Jul 29, 2024
1 parent d96f27b commit b2889fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion checkpolicy/policy_define.c
Original file line number Diff line number Diff line change
Expand Up @@ -5036,7 +5036,7 @@ int define_ibpkey_context(unsigned int low, unsigned int high)
goto out;
}

if (subnet_prefix.s6_addr[2] || subnet_prefix.s6_addr[3]) {
if (subnet_prefix.s6_addr32[2] || subnet_prefix.s6_addr32[3]) {
yyerror("subnet prefix should be 0's in the low order 64 bits.");
rc = -1;
goto out;
Expand Down

0 comments on commit b2889fe

Please sign in to comment.