Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in brstate.c -> br_set_state() #1

Open
mplum opened this issue Oct 7, 2011 · 1 comment
Open

Possible bug in brstate.c -> br_set_state() #1

mplum opened this issue Oct 7, 2011 · 1 comment

Comments

@mplum
Copy link

mplum commented Oct 7, 2011

In br_set_state() the port state is passed in as a u8 and the attribute is added to the netlink message with the following line:

addattr32(&req.n, sizeof(req.buf), IFLA_PROTINFO, state);

In the kernel: net/bridge/br_netlink.c -> br_rtm_setlink()
The port state is grabbed using:
new_state = nla_get_u8(protinfo);
if (new_state > BR_STATE_BLOCKING)
return -EINVAL;

I was seeing the port state always being returned as zero.

In br_set_state() I changed to:
addattr_l(&req.n, sizeof(req.buf), IFLA_PROTINFO, &state, 1);
To only add the port state as one byte to the netlink message which corrected the problem and the kernel correctly received change of port states.

@Debarge
Copy link

Debarge commented Nov 30, 2011

I have got the same problem on PowerPC CPU (MPC8315).
Your patch works great !
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants