diff options
author | Parav Pandit <parav@mellanox.com> | 2019-07-09 07:17:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-09 22:02:13 +0300 |
commit | a2c6b87dd08cdfc2d065d4ae369e4e747b521a7f (patch) | |
tree | 1eab6fbb7646f158ed71f56702b9fd9aab2c4fd1 /net | |
parent | 378ef01b5f75e6c485b8f16b4f6a7842a312aa07 (diff) | |
download | linux-a2c6b87dd08cdfc2d065d4ae369e4e747b521a7f.tar.xz |
devlink: Return physical port fields only for applicable port flavours
Physical port number and split group fields are applicable only to
physical port flavours such as PHYSICAL, CPU and DSA.
Hence limit returning those values in netlink response to such port
flavours.
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/devlink.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index eacaf37b5108..a9c4e5d8a99c 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -515,6 +515,10 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, return 0; if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) return -EMSGSIZE; + if (devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PHYSICAL && + devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_CPU && + devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_DSA) + return 0; if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER, attrs->phys.port_number)) return -EMSGSIZE; |