lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 27 Oct 2021 21:12:10 +0200
From:   Robert Schlabbach <robert_s@....net>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     Toke Høiland-Jørgensen <toke@...hat.com>,
        netdev@...r.kernel.org
Subject: Re: ixgbe: How to do this without a module parameter?

"Andrew Lunn" <andrew@...n.ch> wrote:
> On Wed, Oct 27, 2021 at 01:50:52AM +0200, Robert Schlabbach wrote:
> > The parsing seems to be implemented in the kernel
>
> Actually, it might not be. A kernel that old might not have netlink
> ethtool, just the old ioctl interface. It could be the command line
> parsing is dependent on which API is used to the kernel.
>
> ethtool --debug 255 eno3

I should have mentioned that I also searched the ethtool source code
for link mode name parsing and came up empty. While ethtool contains
link mode names, those are "private" to the dump_link_mode_caps()
function and unavailable for any other access/use.

The ethtool debug option you gave shows that ethtool indeed sends the
link mode name strings down to the kernel for parsing:

sending genetlink packet (100 bytes):
    msg length 100 ethool ETHTOOL_MSG_LINKMODES_SET
    ETHTOOL_MSG_LINKMODES_SET
        ETHTOOL_A_LINKMODES_HEADER
            ETHTOOL_A_HEADER_DEV_NAME = "eno3"
        ETHTOOL_A_LINKMODES_OURS
            ETHTOOL_A_BITSET_BITS
                ETHTOOL_A_BITSET_BITS_BIT
                    ETHTOOL_A_BITSET_BIT_NAME = "2500baseT/Full"
                    ETHTOOL_A_BITSET_BIT_VALUE = true
                ETHTOOL_A_BITSET_BITS_BIT
                    ETHTOOL_A_BITSET_BIT_NAME = "5000baseT/Full"
                    ETHTOOL_A_BITSET_BIT_VALUE = true

And trying nonsense names for link modes confirms that ethtool does not
parse them at all, but rather passes them unchecked:

$ ethtool --debug 255 -s eno3 advertise NonSenseModeName off EvenMoreNonSense on

sending genetlink packet (104 bytes):
    msg length 104 ethool ETHTOOL_MSG_LINKMODES_SET
    ETHTOOL_MSG_LINKMODES_SET
        ETHTOOL_A_LINKMODES_HEADER
            ETHTOOL_A_HEADER_DEV_NAME = "eno3"
        ETHTOOL_A_LINKMODES_OURS
            ETHTOOL_A_BITSET_BITS
                ETHTOOL_A_BITSET_BITS_BIT
                    ETHTOOL_A_BITSET_BIT_NAME = "NonSenseModeName"
                ETHTOOL_A_BITSET_BITS_BIT
                    ETHTOOL_A_BITSET_BIT_NAME = "EvenMoreNonSense"
                    ETHTOOL_A_BITSET_BIT_VALUE = true

Running these commands on an old 4.15 kernel fails very early, supposedly when
ethtool checks whether the kernel supports above messages:

sending genetlink packet (32 bytes):
    msg length 32 genl-ctrl
    CTRL_CMD_GETFAMILY
        CTRL_ATTR_FAMILY_NAME = "ethtool"

offending message:
    ETHTOOL_MSG_LINKINFO_SET
        ETHTOOL_A_LINKINFO_PORT = 101
ethtool: bad command line argument(s)
For more information run ethtool -h

So a more user-friendly option to specify link modes to advertise is already
implemented, but only in more recent kernel versions.

Best regards,
-Robert Schlabbach

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ