iprule: amend ipproto netlink nla_put_u32 to nla_put_u8
authorPaul Donald <[email protected]>
Fri, 13 Dec 2024 03:17:50 +0000 (04:17 +0100)
committerRobert Marko <[email protected]>
Wed, 2 Apr 2025 08:58:38 +0000 (10:58 +0200)
FRA_IP_PROTO expects an 8 bit value.

Follow-up fix for d29cf707478cfc5465fc8a7b8ccfde72a739a4f6.

uint8 prevents the kernel log message:
netlink: 'netifd': attribute type 22 has an invalid length.

The message is otherwise harmless; ip rules using ipproto are created
successfully.

Tested on 24.10-snapshot

Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/netifd/pull/42
Signed-off-by: Robert Marko <[email protected]>
system-linux.c

index 3fff641072377a6210ea8eba840946acdf34983b..945ca4cef178912a918482f604eaa24aec8deecf 100644 (file)
@@ -3578,7 +3578,7 @@ static int system_iprule(struct iprule *rule, int cmd)
                nla_put_u32(msg, FRA_GOTO, rule->gotoid);
 
        if (rule->flags & IPRULE_IPPROTO)
-               nla_put_u32(msg, FRA_IP_PROTO, rule->ipproto);
+               nla_put_u8(msg, FRA_IP_PROTO, rule->ipproto);
 
        return system_rtnl_call(msg);
 }