Page MenuHomeFreeBSD

Bug 223722 add sys/class/net data to linsysfs
ClosedPublic

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

Details

Summary

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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 https://wiki.freebsd.org/action/show/Phabricator

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
cneirabustos_gmail.com edited the summary of this revision. (Show Details)Mar 21 2019, 3:57 PM
cneirabustos_gmail.com edited the test plan for this revision. (Show Details)
cneirabustos_gmail.com updated this revision to Diff 55321.

Fixed style.

style (9)

sys/compat/linsysfs/linsysfs.c
125 ↗(On Diff #55321)

tab until }?

141 ↗(On Diff #55321)

extra line

163 ↗(On Diff #55321)

remove '\n'

165 ↗(On Diff #55321)

whitespace

169 ↗(On Diff #55321)

add '\n'

187 ↗(On Diff #55321)

same

200 ↗(On Diff #55321)

same

235 ↗(On Diff #55321)

whitespace in function, below too

Fixed latest style issue.

cneirabustos_gmail.com 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)?

Hi,

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
sys/compat/linsysfs/linsysfs.c
268 ↗(On Diff #55423)

btw, why lo instead of lo0?

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

It's Linux's name for the loopback interface (not lo0).

cneirabustos_gmail.com marked 2 inline comments as done.May 6 2019, 5:39 PM
cneirabustos_gmail.com added inline comments.
sys/compat/linsysfs/linsysfs.c
268 ↗(On Diff #55423)

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

268 ↗(On Diff #55423)

That's correct.

cneirabustos_gmail.com 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
head/sys/compat/linsysfs/linsysfs.c
5

Ar you really need this line? As I rewrote most of the patch? )

cneirabustos_gmail.com marked an inline comment as done.May 6 2019, 11:07 PM
cneirabustos_gmail.com added inline comments.
head/sys/compat/linsysfs/linsysfs.c
5

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