26 Mar, 2020

1 commit


24 Mar, 2020

1 commit

  • Andrew noticed that some handlers for *_SET commands leak a netdev
    reference if required ethtool_ops callbacks do not exist. A simple
    reproducer would be e.g.

    ip link add veth1 type veth peer name veth2
    ethtool -s veth1 wol g
    ip link del veth1

    Make sure dev_put() is called when ethtool_ops check fails.

    v2: add Fixes tags

    Fixes: a53f3d41e4d3 ("ethtool: set link settings with LINKINFO_SET request")
    Fixes: bfbcfe2032e7 ("ethtool: set link modes related data with LINKMODES_SET request")
    Fixes: e54d04e3afea ("ethtool: set message mask with DEBUG_SET request")
    Fixes: 8d425b19b305 ("ethtool: set wake-on-lan settings with WOL_SET request")
    Reported-by: Andrew Lunn
    Signed-off-by: Michal Kubecek
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Michal Kubecek
     

13 Mar, 2020

1 commit

  • Andrew Lunn pointed out that even if it's documented that
    ethnl_parse_header() takes reference to network device if it fills it
    into the target structure, its name doesn't make it apparent so that
    corresponding dev_put() looks like mismatched.

    Rename the function ethnl_parse_header_dev_get() to indicate that it
    takes a reference.

    Suggested-by: Andrew Lunn
    Signed-off-by: Michal Kubecek
    Signed-off-by: David S. Miller

    Michal Kubecek
     

28 Dec, 2019

3 commits

  • Send ETHTOOL_MSG_LINKINFO_NTF notification message whenever device link
    settings are modified using ETHTOOL_MSG_LINKINFO_SET netlink message or
    ETHTOOL_SLINKSETTINGS or ETHTOOL_SSET ioctl commands.

    The notification message has the same format as reply to LINKINFO_GET
    request. ETHTOOL_MSG_LINKINFO_SET netlink request only triggers the
    notification if there is a change but the ioctl command handlers do not
    check if there is an actual change and trigger the notification whenever
    the commands are executed.

    As all work is done by ethnl_default_notify() handler and callback
    functions introduced to handle LINKINFO_GET requests, all that remains is
    adding entries for ETHTOOL_MSG_LINKINFO_NTF into ethnl_notify_handlers and
    ethnl_default_notify_ops lookup tables and calls to ethtool_notify() where
    needed.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Implement LINKINFO_SET netlink request to set link settings queried by
    LINKINFO_GET message.

    Only physical port, phy MDIO address and MDI(-X) control can be set,
    attempt to modify MDI(-X) status and transceiver is rejected.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Implement LINKINFO_GET netlink request to get basic link settings provided
    by ETHTOOL_GLINKSETTINGS and ETHTOOL_GSET ioctl commands.

    This request provides settings not directly related to autonegotiation and
    link mode selection: physical port, phy MDIO address, MDI(-X) status,
    MDI(-X) control and transceiver.

    LINKINFO_GET request can be used with NLM_F_DUMP (without device
    identification) to request the information for all devices in current
    network namespace providing the data.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek