bridge link: add option 'self'
Currently self is set internally only if hwmode is set.
This makes it necessary for the hw to have a mode.
There is no hwmode really required to go to hardware. So, introduce
self for anybody who wants to target hardware.
v1 -> v2
- fix a few bugs. Initialize flags to zero: this was required to
keep the current behaviour unchanged.
v2 -> v3
- fix comment
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
This commit is contained in:
parent
a1e2e5fcee
commit
6fdb465869
|
|
@ -261,7 +261,7 @@ static int brlink_modify(int argc, char **argv)
|
||||||
__s16 priority = -1;
|
__s16 priority = -1;
|
||||||
__s8 state = -1;
|
__s8 state = -1;
|
||||||
__s16 mode = -1;
|
__s16 mode = -1;
|
||||||
__u16 flags = BRIDGE_FLAGS_MASTER;
|
__u16 flags = 0;
|
||||||
struct rtattr *nest;
|
struct rtattr *nest;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
|
@ -321,6 +321,8 @@ static int brlink_modify(int argc, char **argv)
|
||||||
"\"veb\".\n");
|
"\"veb\".\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(*argv, "self") == 0) {
|
||||||
|
flags = BRIDGE_FLAGS_SELF;
|
||||||
} else {
|
} else {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
@ -369,16 +371,16 @@ static int brlink_modify(int argc, char **argv)
|
||||||
|
|
||||||
addattr_nest_end(&req.n, nest);
|
addattr_nest_end(&req.n, nest);
|
||||||
|
|
||||||
/* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
|
/* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that
|
||||||
* designates master or self operation as well as 'vepa' or 'veb'
|
* designates master or self operation and IFLA_BRIDGE_MODE
|
||||||
* operation modes. These are only valid in 'self' mode on some
|
* for hw 'vepa' or 'veb' operation modes. The hwmodes are
|
||||||
* devices so far. Thus we only need to include the flags attribute
|
* only valid in 'self' mode on some devices so far.
|
||||||
* if we are setting the hw mode.
|
|
||||||
*/
|
*/
|
||||||
if (mode >= 0) {
|
if (mode >= 0 || flags > 0) {
|
||||||
nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
|
nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
|
||||||
|
|
||||||
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
|
if (flags > 0)
|
||||||
|
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
|
||||||
|
|
||||||
if (mode >= 0)
|
if (mode >= 0)
|
||||||
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
|
addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue