MCPcopy Index your code
hub / github.com/tailscale/tailscale / ethtoolImpl

Function ethtoolImpl

doctor/ethtool/ethtool_linux.go:18–51  ·  view source on GitHub ↗
(logf logger.Logf)

Source from the content-addressed store, hash-verified

16)
17
18func ethtoolImpl(logf logger.Logf) error {
19 et, err := ethtool.NewEthtool()
20 if err != nil {
21 logf("could not create ethtool: %v", err)
22 return nil
23 }
24 defer et.Close()
25
26 netmon.ForeachInterface(func(iface netmon.Interface, _ []netip.Prefix) {
27 ilogf := logger.WithPrefix(logf, iface.Name+": ")
28 features, err := et.Features(iface.Name)
29 if err == nil {
30 enabled := []string{}
31 for feature, value := range features {
32 if value {
33 enabled = append(enabled, feature)
34 }
35 }
36 sort.Strings(enabled)
37 ilogf("features: %v", enabled)
38 } else {
39 ilogf("features: error: %v", err)
40 }
41
42 stats, err := et.Stats(iface.Name)
43 if err == nil {
44 printStats(ilogf, stats)
45 } else {
46 ilogf("stats: error: %v", err)
47 }
48 })
49
50 return nil
51}
52
53// Stats that should be printed if non-zero
54var nonzeroStats = set.SetOf([]string{

Callers 1

RunMethod · 0.70

Calls 6

ForeachInterfaceFunction · 0.92
WithPrefixFunction · 0.92
printStatsFunction · 0.85
StringsMethod · 0.80
StatsMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…