netlink: settings: Fix for wrong auto-negotiation state
Subsystems (2)
PATCH 1/1 netlink: settings: Fix for wrong auto-negotiation state
Auto-negotiation state in json format showed the opposite state due to wrong comparison.
Fix for returning the correct auto-neg state implemented.
--- netlink/settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
netlink/settings.c +1 -1
@@ -546,7 +546,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data) (autoneg == AUTONEG_DISABLE) ? "off" : "on"); else print_bool(PRINT_JSON, "auto-negotiation", NULL, - autoneg == AUTONEG_DISABLE); + (autoneg == AUTONEG_DISABLE) ? false : true); }if (tb[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG ]) {uint8_t val;
Signature · 1 line
2.43.0
Quoted 14 lines · Mohan Prasad J
Auto-negotiation state in json format showed the opposite state due to wrong comparison.
Fix for returning the correct auto-neg state implemented.Signed-off-by Mohan Prasad J <[email protected]>--- netlink/settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)netlink/settings.c +0
-0
netlink/settings.c int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data) · line 552
Quoted 8 lines
netlink/settings.c +1
-1@@ -546,7 +546,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data) (autoneg == AUTONEG_DISABLE) ? "off" : "on"); else print_bool(PRINT_JSON, "auto-negotiation", NULL, - autoneg == AUTONEG_DISABLE); + (autoneg == AUTONEG_DISABLE) ? false : true); }if (tb[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG ]) {uint8_t val;
The fix looks correct but isn't
(autoneg == AUTONEG_DISABLE) ? false : true
just a more complicated way to say
autoneg != AUTONEG_DISABLE
(and harder to read)?
Michal
Hello Michal,
Thank you for the comments.
Quoted 29 lines · Mohan Prasad J
netlink/settings.c int linkmodes_reply_cb(const struct nlmsghdr
Quoted 14 lines
Auto-negotiation state in json format showed the opposite state due to wrong comparison.
Fix for returning the correct auto-neg state implemented.Signed-off-by Mohan Prasad J <[email protected]>--- netlink/settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)netlink/settings.c index renamed from netlink/settings.c +0
-0dbfb520..a454bfb 100644
netlink/settings.c +0
-0@@ -546,7 +546,7 @@ int linkmodes_reply_cb(const struct nlmsghdr*nlhdr, void *data)
netlink/settings.c int linkmodes_reply_cb(const struct nlmsghdr · line 546
Quoted 1 line
netlink/settings.c +0
-0(autoneg ==
AUTONEG_DISABLE) ? "off" : "on");netlink/settings.c int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data)
Quoted 4 lines
netlink/settings.c +1
-1else print_bool(PRINT_JSON, "auto-negotiation", NULL, - autoneg ==AUTONEG_DISABLE ); + (autoneg == AUTONEG_DISABLE) ? false :true);
netlink/settings.c int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data) · line 552
Quoted 3 lines
netlink/settings.c +0
-0}if (tb[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG ]) {uint8_t val;The fix looks correct but isn't
Quoted 7 lines
(autoneg == AUTONEG_DISABLE) ? false : truejust a more complicated way to say
autoneg != AUTONEG_DISABLE(and harder to read)?
You are right. (autoneg != AUTONEG_DISABLE) would be more simpler and easy to read. I will update it in the next version.
Thanks,
Mohan Prasad J