diff options
author | Greger Wrang <gregermw@gmail.com> | 2016-05-06 10:23:49 +0200 |
---|---|---|
committer | Jiri Pirko <jiri@mellanox.com> | 2016-05-06 10:30:05 +0200 |
commit | 2df53681c954b555cb33a2cb9aacb90afb1e272e (patch) | |
tree | 2cecbb0b4bc4d601e7f54dd27262127ebad404bb | |
parent | 3fcdb6ba736fe2f9ea44895135808074e93472ce (diff) | |
download | libteam-2df53681c954b555cb33a2cb9aacb90afb1e272e.tar.gz |
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 <gregermw@gmail.com>
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
-rw-r--r-- | libteam/options.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libteam/options.c b/libteam/options.c index 79c98d7..3f444cf 100644 --- a/libteam/options.c +++ b/libteam/options.c @@ -259,6 +259,7 @@ int get_options_handler(struct nl_msg *msg, void *arg) int nla_type; int opt_type; long tmp; + bool tmp_bool; void *data; int data_len = 0; int err; @@ -317,8 +318,8 @@ int get_options_handler(struct nl_msg *msg, void *arg) opt_type = TEAM_OPTION_TYPE_BINARY; break; case NLA_FLAG: - tmp = (long) (data_attr ? true : false); - data = &tmp; + tmp_bool = data_attr ? true : false; + data = &tmp_bool; opt_type = TEAM_OPTION_TYPE_BOOL; break; case NLA_S32: |