Skip to contentSkip to conversation

nfct: helper: Fix NFCTH_ATTR_PROTO_L4NUM size

PATCH In review Phil Sutter 2 participants 2 messages Sep 10, 2019 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 nfct: helper: Fix NFCTH_ATTR_PROTO_L4NUM size

Kernel defines NFCTH_TUPLE_L4PROTONUM as of type NLA_U8. When adding a helper, NFCTH_ATTR_PROTO_L4NUM attribute is correctly set using nfct_helper_attr_set_u8(), though when deleting nfct_helper_attr_set_u32() was incorrectly used. Due to alignment, this causes trouble only on Big Endian.

Fixes 5e8f64f46cb1d ("conntrackd: add cthelper infrastructure (+ example FTP helper)")
---
 src/nfct-extensions/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/nfct-extensions/helper.c +1 -1
index 0569827612f06..e5d8d0a905df0 100644
@@ -284,7 +284,7 @@ nfct_cmd_helper_delete(struct mnl_socket *nl, int argc, char *argv[])
 			nfct_perror("unsupported layer 4 protocol");
 			return -1;
 		}
-		nfct_helper_attr_set_u32(t, NFCTH_ATTR_PROTO_L4NUM, l4proto);
+		nfct_helper_attr_set_u8(t, NFCTH_ATTR_PROTO_L4NUM, l4proto);
 	}
 
 	seq = time(NULL);
Signature · 1 line
2.22.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Phil Sutter

Kernel defines NFCTH_TUPLE_L4PROTONUM as of type NLA_U8. When adding a helper, NFCTH_ATTR_PROTO_L4NUM attribute is correctly set using nfct_helper_attr_set_u8(), though when deleting nfct_helper_attr_set_u32() was incorrectly used. Due to alignment, this causes trouble only on Big Endian.

Fixes 5e8f64f46cb1d ("conntrackd: add cthelper infrastructure (+ example FTP helper)")