Same output on non-affected interface type (e.g., 0x03, SFP), i.e., no regressions.
Fixed output on affected interface type (i.e., 0x02, soldered), i.e., as expected.
(* This has been verified by changing the type in GDB and checking output as below.)
Consistent output between affected and unaffected interface types, i.e., no changes
other than the changed type's value/string.
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ethtool -m $NIC; echo; done > ethtool_-m.proposed 2>&1
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ./ethtool-gdb.sh -m $NIC; echo; done > ethtool-gdb_-m.proposed 2>&1
Comparison:
---
No unexpected differences between unaffected and patched output
other than the change to make the unaffected NIC affected
(the 'Identifier' value modified in GDB)
$ diff -U0 ethtool_-m.release ethtool-gdb_-m.proposed
--- ethtool_-m.release 2024-04-01 23:11:17.545772332 +0000
+++ ethtool-gdb_-m.proposed 2024-04-01 23:18:30.643454466 +0000
@@ -2 +2,3 @@
- Identifier : 0x03 (SFP)
+217 netlink/module-eeprom.c: No such file or directory.
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
@@ -37 +39,3 @@
- Identifier : 0x03 (SFP)
+217 netlink/module-eeprom.c: No such file or directory.
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
@@ -68,0 +73 @@
+217 netlink/module-eeprom.c: No such file or directory.
Verification done on jammy-proposed.
Same output on non-affected interface type (e.g., 0x03, SFP), i.e., no regressions.
Fixed output on affected interface type (i.e., 0x02, soldered), i.e., as expected.
(* This has been verified by changing the type in GDB and checking output as below.)
Consistent output between affected and unaffected interface types, i.e., no changes
other than the changed type's value/string.
Environment:
---
$ lsb_release -cs
jammy
$ ls -1d /sys/class/net/* net/enp161s0f0 net/enp161s0f1 net/enp193s0f0 net/enp193s0f1 net/enp68s0f0 net/enp68s0f1
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/net/lo
Before:
---
$ apt-cache policy ethtool archive. ubuntu. com/ubuntu jammy/main amd64 Packages dpkg/status
ethtool:
Installed: 1:5.16-1
Candidate: 1:5.16-1
Version table:
*** 1:5.16-1 500
500 http://
100 /var/lib/
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ethtool -m $NIC; echo; done > ethtool_-m.release 2>&1
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ./ethtool-gdb.sh -m $NIC; echo; done > ethtool- gdb_-m. release 2>&1
After:
---
$ sudo add-apt-repository -yp proposed
$ sudo apt install -y -t jammy-proposed ethtool
$ apt-cache policy ethtool archive. ubuntu. com/ubuntu jammy-proposed/main amd64 Packages dpkg/status archive. ubuntu. com/ubuntu jammy/main amd64 Packages
ethtool:
Installed: 1:5.16-1ubuntu0.1
Candidate: 1:5.16-1ubuntu0.1
Version table:
*** 1:5.16-1ubuntu0.1 500
500 http://
100 /var/lib/
1:5.16-1 500
500 http://
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ethtool -m $NIC; echo; done > ethtool_-m.proposed 2>&1
for NIC in /sys/class/net/en*; do NIC=$(basename $NIC); echo $NIC; sudo ./ethtool-gdb.sh -m $NIC; echo; done > ethtool- gdb_-m. proposed 2>&1
Comparison:
---
Output files:
$ ls -lh ethtool{ ,-gdb}_ -m.{release, proposed} gdb_-m. proposed gdb_-m. release
-rw-rw-r-- 1 ubuntu ubuntu 4.4K Apr 1 23:18 ethtool-
-rw-rw-r-- 1 ubuntu ubuntu 1.8K Apr 1 23:19 ethtool-
-rw-rw-r-- 1 ubuntu ubuntu 4.1K Apr 1 23:16 ethtool_-m.proposed
-rw-rw-r-- 1 ubuntu ubuntu 4.1K Apr 1 23:11 ethtool_-m.release
No output changes for unaffected interfaces:
(just differences on temperature/voltage sensors which are expected.)
$ diff -U0 ethtool_-m.release ethtool_-m.proposed
$
Fixed output for affected (* with GDB) interfaces:
$ diff -U0 ethtool- gdb_-m. release ethtool- gdb_-m. proposed gdb_-m. release 2024-04-01 23:19:32.280414940 +0000 gdb_-m. proposed 2024-04-01 23:18:30.643454466 +0000
--- ethtool-
+++ ethtool-
@@ -3,10 +3,31 @@
-Offset Values
------- ------
-0x0000: 03 04 07 10 00 00 00 40 00 0c 00 06 67 00 00 00
...
-0x0070: 50 b5 1b 00 00 00 00 00 00 00 00 00 68 44 3d 5f
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
+ Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID)
+ Connector : 0x07 (LC)
+ Transceiver codes : 0x10 0x00 0x00 0x00 0x40 0x00 0x0c 0x00 0x
00
+ Transceiver type : 10G Ethernet: 10G Base-SR
...
@@ -19,10 +40,31 @@
-Offset Values
------- ------
-0x0000: 03 04 07 10 00 00 00 40 00 0c 00 06 67 00 00 00
...
-0x0070: bf 4b 54 00 00 00 00 00 00 00 00 00 4c f7 45 cd
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
+ Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID)
+ Connector : 0x07 (LC)
+ Transceiver codes : 0x10 0x00 0x00 0x00 0x40 0x00 0x0c 0x00 0x00
+ Transceiver type : 10G Ethernet: 10G Base-SR
...
Consistency check:
No unexpected differences between unaffected and patched output
other than the change to make the unaffected NIC affected
(the 'Identifier' value modified in GDB)
$ diff -U0 ethtool_-m.release ethtool- gdb_-m. proposed gdb_-m. proposed 2024-04-01 23:18:30.643454466 +0000 module- eeprom. c: No such file or directory. module- eeprom. c: No such file or directory. module- eeprom. c: No such file or directory.
--- ethtool_-m.release 2024-04-01 23:11:17.545772332 +0000
+++ ethtool-
@@ -2 +2,3 @@
- Identifier : 0x03 (SFP)
+217 netlink/
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
@@ -37 +39,3 @@
- Identifier : 0x03 (SFP)
+217 netlink/
+464 ./sfpid.c: No such file or directory.
+ Identifier : 0x02 (module soldered to motherboard)
@@ -68,0 +73 @@
+217 netlink/
GDB:
---
sudo apt install -y gdb
cat <<EOF >ethtool-gdb.sh /debuginfod. ubuntu. com' -iex 'set debuginfod enabled on' -x ethtool-gdb.gdb -ex "run \$*" -ex 'quit' /usr/sbin/ethtool
#!/bin/sh
sudo gdb --batch-silent -iex 'set debuginfod urls https:/
EOF
chmod +x ethtool-gdb.sh
cat <<EOF >ethtool-gdb.gdb
set confirm off
add-symbol-file /usr/sbin/ethtool
break module-eeprom.c:217
commands 1
if request.data[0] != 0
set request.data[0] = 2
end
disable 1
continue
end
break sfpid.c:464
commands 2
if request.data[0] != 0
set request.data[0] = 2
end
disable 2
continue
end
EOF