Skip to content

Commit 2df5368

Browse files
gwrgjpirko
authored andcommitted
libteam: fix TEAM_OPTION_TYPE_BOOL type for big endian architectures
The TEAM_OPTION_TYPE_BOOL is handled as a bool in the kernel and as a long in userspace. On a little endian architecture this is not a problem, but on a big endian architecture the result will not be correct. Signed-off-by: Greger Wrang <[email protected]> Signed-off-by: Jonas Johansson <[email protected]> Signed-off-by: Jiri Pirko <[email protected]>
1 parent 3fcdb6b commit 2df5368

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libteam/options.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ int get_options_handler(struct nl_msg *msg, void *arg)
259259
int nla_type;
260260
int opt_type;
261261
long tmp;
262+
bool tmp_bool;
262263
void *data;
263264
int data_len = 0;
264265
int err;
@@ -317,8 +318,8 @@ int get_options_handler(struct nl_msg *msg, void *arg)
317318
opt_type = TEAM_OPTION_TYPE_BINARY;
318319
break;
319320
case NLA_FLAG:
320-
tmp = (long) (data_attr ? true : false);
321-
data = &tmp;
321+
tmp_bool = data_attr ? true : false;
322+
data = &tmp_bool;
322323
opt_type = TEAM_OPTION_TYPE_BOOL;
323324
break;
324325
case NLA_S32:

0 commit comments

Comments
 (0)