Page MenuHomeFreeBSD

Bug 223722 add sys/class/net data to linsysfs

Authored by on Dec 27 2017, 7:17 PM.



Adds sys/class/net devices to linsysfs. Only two interfaces are created eth0 and lo and they expose the following properties:
address, addr_len, flags, ifindex, mty, tx_queue_len and type.

Test Plan

Mount linsysfs in a jail or in the host system and check if devices are created under sys/class/net and if properties are available.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Thanks, I will try to take a detailed look at this soon. For future changes, and if you have reason to upload a new diff to this review, please upload with full context as described in

cem requested changes to this revision.Jan 29 2018, 12:07 AM
cem added a subscriber: cem.

The patch does not conform to style(9).

This revision now requires changes to proceed.Jan 29 2018, 12:07 AM edited the summary of this revision. (Show Details) edited the test plan for this revision. (Show Details)

Fixed style.

style (9)

125 ↗(On Diff #55321)

tab until }?

141 ↗(On Diff #55321)

extra line

163 ↗(On Diff #55321)

remove '\n'

165 ↗(On Diff #55321)


169 ↗(On Diff #55321)

add '\n'

187 ↗(On Diff #55321)


200 ↗(On Diff #55321)


235 ↗(On Diff #55321)

whitespace in function, below too

Fixed latest style issue. marked 8 inline comments as done.Mar 25 2019, 1:19 PM

updated patch to address style(9) issues.

ok, btw, what is the reason to create only 2 devices (eth0 and lo0)?

ok, btw, what is the reason to create only 2 devices (eth0 and lo0)?


The only reason is that two devices are the minimum needed to expose to applications that use sys/class/net data.

For future updates (to this review, if any, or other reviews) please include context e.g. git diff -U9999

dchagin added inline comments.May 1 2019, 8:05 PM
268 ↗(On Diff #55423)

btw, why lo instead of lo0?

cem added inline comments.May 1 2019, 9:19 PM
268 ↗(On Diff #55423)

It's Linux's name for the loopback interface (not lo0). marked 2 inline comments as done.May 6 2019, 5:39 PM added inline comments.
268 ↗(On Diff #55423)

As @cem explained, the loopback device is named lo in Linux.

268 ↗(On Diff #55423)

That's correct. marked an inline comment as done.May 6 2019, 5:40 PM
This revision was not accepted when it landed; it landed in state Needs Review.May 6 2019, 8:01 PM
This revision was automatically updated to reflect the committed changes.
dchagin added inline comments.May 6 2019, 9:29 PM

Ar you really need this line? As I rewrote most of the patch? ) marked an inline comment as done.May 6 2019, 11:07 PM added inline comments.

Thank you very much @dchagin, the patch looks nicer now!. Thanks for your help on this one.
You could remove that line if needed.